Esempio n. 1
0
 public void copy(distance_register copyfrom)
 {
     x_distance_status = copyfrom.x_distance_status;
     y_distance_status = copyfrom.y_distance_status;
     z_distance_status = copyfrom.z_distance_status;
     xy_distance_status = copyfrom.xy_distance_status;
     xz_distance_status = copyfrom.xz_distance_status;
     yz_distance_status = copyfrom.yz_distance_status;
     xyz_distance_status = copyfrom.xyz_distance_status;
     theta_status = copyfrom.theta_status;
 }
Esempio n. 2
0
        public jPair(Skeleton skel, JointType a, JointType b, String id)
        {
            name = id;
            skeleton = skel;
            jointType0 = a;
            jointType1 = b;

            pairStatus = false;
            distReg = new distance_register();

            joint0 = skeleton.Joints[jointType0];
            joint1 = skeleton.Joints[jointType1];
            isDefined = 1;
            firstPoint = new Point3(jointType0.ToString(), joint0.Position.X, joint0.Position.Y, joint0.Position.Z);
            secondPoint = new Point3(jointType1.ToString(), joint1.Position.X, joint1.Position.Y, joint1.Position.Z);
            pair = new Point3Pair(firstPoint, secondPoint);
            pair.distance();
            pair.findtheta();
        }
Esempio n. 3
0
        public distanceMessages(jPair myJPair)
        {
            register = myJPair.distReg;
            //messageSender = mSend;
            StringBuilder addressRoot = new StringBuilder();
            addressRoot.Append("/");
            addressRoot.Append(myJPair.jointType0.ToString());
            addressRoot.Append("_");
            addressRoot.Append(myJPair.jointType1.ToString());
            addressRoot.Append("/");
            String root = addressRoot.ToString();

            StringBuilder xAddress = new StringBuilder(root);
            StringBuilder yAddress = new StringBuilder(root);
            StringBuilder zAddress = new StringBuilder(root);
            StringBuilder xyAddress = new StringBuilder(root);
            StringBuilder xzAddress = new StringBuilder(root);
            StringBuilder yzAddress = new StringBuilder(root);
            StringBuilder xyzAddress = new StringBuilder(root);
            StringBuilder angle = new StringBuilder(root);

            xAddress.Append("x");
            yAddress.Append("y");
            zAddress.Append("z");
            xyAddress.Append("xy");
            xzAddress.Append("xz");
            yzAddress.Append("yz");
            xyzAddress.Append("xyz");
            angle.Append("theta");

            xdistOSC = new OscMessage(xAddress.ToString(), (float)myJPair.pair.xdist);
            ydistOSC = new OscMessage(yAddress.ToString(), (float)myJPair.pair.ydist);
            zdistOSC = new OscMessage(zAddress.ToString(), (float)myJPair.pair.zdist);
            xydistOSC = new OscMessage(xyAddress.ToString(), (float)myJPair.pair.xydist);
            xzdistOSC = new OscMessage(xzAddress.ToString(), (float)myJPair.pair.xzdist);
            yzdistOSC = new OscMessage(yzAddress.ToString(), (float)myJPair.pair.yzdist);
            xyzdistOSC = new OscMessage(xyzAddress.ToString(), (float)myJPair.pair.xyzdist);
            angleOSC = new OscMessage(angle.ToString(), (float)myJPair.pair.theta);
        }
Esempio n. 4
0
        ///Execute Startup
        /// <param name="sender">object sending the event</param>
        /// <param name="e">event arguments</param>
        /// 
        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            // Create the drawing group we'll use for drawing
            this.drawingGroup = new DrawingGroup();

            // Create an image source that we can use in our image control
            this.imageSource = new DrawingImage(this.drawingGroup);

            // Display the drawing using our image control
            Image.Source = this.imageSource;

            //initialize the pair and joint on flags to 'false'
            //set up position and distance registers appropriately
            for (int i=0; i < numP; i++)
            {
                pOn[i] = false;
                pReg[i] = new distance_register();
            }

            for (int i = 0; i < numJ; i++)
            {
                jOn[i] = false;
                jReg[i] = new position_Register();
            }

            //initializes IP addresses
            IPs[0] = "127.0.0.1";
            IPs[1] = enterIP2.Text;
            IPs[2] = enterIP3.Text;
            IPs[3] = enterIP4.Text;
            IPs[4] = enterIP5.Text;
            IPs[5] = enterIP6.Text;

            //initializes ports
            ports[0] = System.Convert.ToInt32(enterPort.Text, 10);
            ports[1] = System.Convert.ToInt32(enterPort2.Text, 10);
            ports[2] = System.Convert.ToInt32(enterPort3.Text, 10);
            ports[3] = System.Convert.ToInt32(enterPort4.Text, 10);
            ports[4] = System.Convert.ToInt32(enterPort5.Text, 10);
            ports[5] = System.Convert.ToInt32(enterPort6.Text, 10);

            //initializes UDP senders to each IP and port
            for (int i = 0; i < numSenders; i++)
            {
                UDPs[i] = new UDPSender(IPs[i],ports[i]);
                UDPs[i].Port = ports[i];
                UDPs[i].Address = IPs[i];
            }

            //populates routing matrix
            for (int i = 0; i < numJ; i++)
            {
                for (int j = 0; j < numIPs; j++)
                {
                    j_IP[i, j] = true;
                }
            }
            for (int i = 0; i < numP; i++)
            {
                for (int j = 0; j < numIPs; j++)
                {
                    p_IP[i, j] = true;
                }
            }

            j_values[0] = (JointType)j01.SelectedValue;
            j_values[1] = (JointType)j02.SelectedValue;
            j_values[2] = (JointType)j03.SelectedValue;
            j_values[3] = (JointType)j04.SelectedValue;
            j_values[4] = (JointType)j05.SelectedValue;
            j_values[5] = (JointType)j06.SelectedValue;
            j_values[6] = (JointType)j07.SelectedValue;
            j_values[7] = (JointType)j08.SelectedValue;
            j_values[8] = (JointType)j09.SelectedValue;
            j_values[9] = (JointType)j10.SelectedValue;

            p_values[0, 0] = (JointType)p01A.SelectedValue;
            p_values[0, 1] = (JointType)p01B.SelectedValue;
            p_values[1, 0] = (JointType)p02A.SelectedValue;
            p_values[1, 1] = (JointType)p02B.SelectedValue;
            p_values[2, 0] = (JointType)p03A.SelectedValue;
            p_values[2, 1] = (JointType)p03B.SelectedValue;

                // Look through all sensors and start the first connected one.
                // This requires that a Kinect is connected at the time of app startup.

                foreach (var potentialSensor in KinectSensor.KinectSensors)
                {
                    if (potentialSensor.Status == KinectStatus.Connected)
                    {
                        this.sensor = potentialSensor;
                        break;
                    }
                }

            if (null != this.sensor)
            {
                // Turn on the skeleton stream to receive skeleton frames
                this.sensor.SkeletonStream.Enable(smoothParameters);

                // Add an event handler to be called whenever there is new color frame data
                this.sensor.SkeletonFrameReady += this.SensorSkeletonFrameReady;

                // Start the sensor!
                try
                {
                    this.sensor.Start();
                }
                catch (IOException)
                {
                    this.sensor = null;
                }
            }

            if (null == this.sensor)
            {
                this.statusBarText.Text = Properties.Resources.NoKinectReady;
            }
        }