Ejemplo n.º 1
0
 public indivJoint(Skeleton skel, JointType a, String id)
 {
     name = id;
     skeleton = skel;
     type = a;
     status = false;
     isDefined = true;
     posReg = new position_Register();
     j0 = skeleton.Joints[type];
     loc = new Point3(type.ToString(), j0.Position.X, j0.Position.Y, j0.Position.Z);
 }
Ejemplo n.º 2
0
        public positionMessages(indivJoint myJoint)
        {
            register = myJoint.posReg;
            //sender = msend;
            StringBuilder addressRoot = new StringBuilder();
            addressRoot.Append("/");
            addressRoot.Append(myJoint.type.ToString());
            addressRoot.Append("/");
            String root = addressRoot.ToString();

            StringBuilder xAddress = new StringBuilder(root);
            StringBuilder yAddress = new StringBuilder(root);
            StringBuilder zAddress = new StringBuilder(root);

            xAddress.Append("x");
            yAddress.Append("y");
            zAddress.Append("z");

            x_OSC = new OscMessage(xAddress.ToString(), (float)myJoint.loc.X);
            y_OSC = new OscMessage(yAddress.ToString(), (float)myJoint.loc.Y);
            z_OSC = new OscMessage(zAddress.ToString(), (float)myJoint.loc.Z);
        }
Ejemplo n.º 3
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;
            }
        }
Ejemplo n.º 4
0
 public void copy(position_Register copyfrom)
 {
     xPos_status = copyfrom.xPos_status;
     yPos_status = copyfrom.yPos_status;
     zPos_status = copyfrom.zPos_status;
 }