DataStore.AngleConverter.getNaoSkeleton C# (CSharp) Method

getNaoSkeleton() public method

public getNaoSkeleton ( ) : NaoSkeleton
return NaoSkeleton
        public NaoSkeleton getNaoSkeleton()
        {
            Joint center = hk.getJoint(JointID.HipCenter);
            NaoPosition position = new NaoPosition((float)center.x, (float)center.y, (float)center.z);

            NaoElbow LElbow = new NaoElbow(this.angles[(int)NaoJointAngle.LElbowYaw], this.angles[(int)NaoJointAngle.LElbowRoll], true);
            NaoElbow RElbow = new NaoElbow(this.angles[(int)NaoJointAngle.RElbowYaw], this.angles[(int)NaoJointAngle.RElbowRoll], false);

            NaoShoulder LShoulder = new NaoShoulder(this.angles[(int)NaoJointAngle.LShoulderPitch], this.angles[(int)NaoJointAngle.LShoulderRoll], true);
            NaoShoulder RShoulder = new NaoShoulder(this.angles[(int)NaoJointAngle.RShoulderPitch], this.angles[(int)NaoJointAngle.RShoulderRoll], false);

            NaoWrist LWrist = new NaoWrist(0);
            NaoWrist RWrist = new NaoWrist(0);

            NaoHand LHand = new NaoHand(true);
            NaoHand RHand = new NaoHand(true);

            return new NaoSkeleton(position, LShoulder, RShoulder, LWrist, RWrist, LElbow, RElbow, LHand, RHand);
        }

Usage Example

Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Dictionary<string, string> actions = new Dictionary<string, string>();
            actions["raise the roof"] = "raisetheroof";
            actions["walk forward"] = "walkforward";
            actions["walk left"] = "walkleft";
            actions["wave right"] = "waveright";
            actions["wave left"] = "waveleft";
            string filename = "Z:/dev/kinect-nao/recordings/";
            ActionLibrary lib = new ActionLibrary();

            foreach (string actionName in actions.Keys)
            {
                List<HumanSkeleton> seq = new List<HumanSkeleton>();
                using (StreamReader s = new StreamReader(filename + actions[actionName] + "/"
                    + actionName + "1.rec"))
                {
                    while (!s.EndOfStream)
                    {
                        seq.Add(new HumanSkeleton(s.ReadLine()));
                    }
                }

                //List<float[]> naoSeq = new List<float[]>();
                ActionSequence<NaoSkeleton> naoSeq = new ActionSequence<NaoSkeleton>();
                foreach (HumanSkeleton h in seq)
                {
                    AngleConverter ac = new AngleConverter(h);
                    naoSeq.append(ac.getNaoSkeleton());
                    //naoSeq.Add(ac.getAngles());
                }

                lib.appendToCache(naoSeq);
                lib.setCachedName(actionName);
                lib.saveCache();
                //bool isJointAction = true; // false if is a walking action
                //ExecuteOnNao(naoSeq, isJointAction);
            }
            lib.save(MainController.ACTION_LIB_PATH);
        }
All Usage Examples Of DataStore.AngleConverter::getNaoSkeleton