}                                  //Needed for serialization, do not use otherwise!

        public NetworkKinectSettings(string uniqueID, int kinectNumber)
        {
            uniqueKinectID = uniqueID;
            kinectID       = kinectNumber;

            //Set any necessary default values here
            mergeSkeletons = true; //this will always be true, as a networked kinects only job is to pull in skeletons to merge
            kinectPosition = new Point3D(0.0, 0.0, 0.0);
            kinectYaw      = 0.0;
            kinectRoll     = 0.0;
            kinectPitch    = 0.0;
            lhChannel      = 1;
            rhChannel      = 0;

            //Initialize the joint mappings
            jointMappings = new ObservableCollection <JointMapping>();
            for (int i = 0; i <= 26; i++)
            {
                JointType?tempJoint = mapChannelNumberToJoint(i);
                if (tempJoint.HasValue)
                {
                    JointMapping temp = new JointMapping(tempJoint.Value, i, 0.01);
                    jointMappings.Add(temp);
                }
            }
        }
Beispiel #2
0
        private JointMapping GetJointMapFromChannel(int channel)
        {
            JointMapping map = null;

            for (int i = 0; i < masterKinectSettings.jointMappings.Count; i++)
            {
                if (masterKinectSettings.jointMappings[i].channel == channel)
                {
                    map = masterKinectSettings.jointMappings[i];
                    break;
                }
            }

            return(map);
        }
Beispiel #3
0
        private void client_PositionChanged(object sender, TrackerChangeEventArgs e)
        {
            //If we try and pass a new skeleton for every tracker update we recieve, we'll spend way too much time and memory creating new skeleton objects
            //Therefore, this will only update the last skeleton object and the last skeleton data will be passed at regular time intervals
            Joint newJoint = new Joint();

            newJoint.utcTime = DateTime.UtcNow;  //We can't be sure if a specific VRPN server is using utc or local time, so we will grab our own time instead of using VRPNs
            JointMapping map = GetJointMapFromChannel(e.Sensor);

            newJoint.JointType     = map.joint;
            newJoint.Position      = new Point3D(e.Position.X, e.Position.Y, e.Position.Z);
            newJoint.Orientation   = e.Orientation;
            newJoint.TrackingState = TrackingState.Tracked;

            lastSkeleton.skeleton[map.joint] = newJoint;
        }
        public NetworkKinectSettings(string uniqueID, int kinectNumber)
        {
            uniqueKinectID = uniqueID;
            kinectID = kinectNumber;

            //Set any necessary default values here
            mergeSkeletons = true; //this will always be true, as a networked kinects only job is to pull in skeletons to merge
            kinectPosition = new Point3D(0.0, 0.0, 0.0);
            kinectYaw = 0.0;
            kinectRoll = 0.0;
            kinectPitch = 0.0;
            lhChannel = 1;
            rhChannel = 0;

            //Initialize the joint mappings
            jointMappings = new ObservableCollection<JointMapping>();
            for (int i = 0; i <= 26; i++)
            {
                JointType? tempJoint = mapChannelNumberToJoint(i);
                if (tempJoint.HasValue)
                {
                    JointMapping temp = new JointMapping(tempJoint.Value, i, 0.01);
                    jointMappings.Add(temp);
                }
            }
        }