Beispiel #1
0
        public void Connect(string ip)
        {
            try
            {
                _motion = new MotionProxy(ip, 9559);
                // --------------- prepare limits --------------------------
                // three floats as an ArrayList for each joint in the chain
                // min,max,maxNoLoadSpeedPerCycle
                ArrayList rightArmLimits = (ArrayList)_motion.getLimits("RArm");
                ArrayList RSPitchLimits = (ArrayList)rightArmLimits[0];
                _RSminPitch = (float)RSPitchLimits[0];
                _RSmaxPitch = (float)RSPitchLimits[1];

                ArrayList RSRollLimits = (ArrayList)rightArmLimits[1];
                _RSminRoll = (float)RSRollLimits[0];
                _RSmaxRoll = (float)RSRollLimits[1];

                ArrayList REYawLimits = (ArrayList)rightArmLimits[2];
                _REminYaw = (float)REYawLimits[0];
                _REmaxYaw = (float)REYawLimits[1];

                ArrayList RERollLimits = (ArrayList)rightArmLimits[3];
                _REminRoll = (float)RERollLimits[0];
                _REmaxRoll = (float)RERollLimits[1];

                ArrayList leftArmLimits = (ArrayList)_motion.getLimits("LArm");
                ArrayList LSPitchLimits = (ArrayList)leftArmLimits[0];
                _LSminPitch = (float)LSPitchLimits[0];
                _LSmaxPitch = (float)LSPitchLimits[1];

                ArrayList LSRollLimits = (ArrayList)leftArmLimits[1];
                _LSminRoll = (float)LSRollLimits[0];
                _LSmaxRoll = (float)LSRollLimits[1];

                ArrayList LEYawLimits = (ArrayList)leftArmLimits[2];
                _LEminYaw = (float)LEYawLimits[0];
                _LEmaxYaw = (float)LEYawLimits[1];

                ArrayList LERollLimits = (ArrayList)leftArmLimits[3];
                _LEminRoll = (float)LERollLimits[0];
                _LEmaxRoll = (float)LERollLimits[1];

                // give the joints some stiffness
                _motion.stiffnessInterpolation("RArm", 1.0f, 1.0f);
                _motion.stiffnessInterpolation("LArm", 1.0f, 1.0f);

            }
            catch (Exception e)
            {
                Console.Out.WriteLine("Elbow.Connect exception: " + e);
            }
        }
Beispiel #2
0
        public void Connect(string ip)
        {
            try
            {
                _motion = new MotionProxy(ip,9559);
                // --------------- prepare limits --------------------------
                // three floats as an ArrayList for each joint in the chain
                // min,max,maxNoLoadSpeedPerCycle
                ArrayList limits = (ArrayList)_motion.getLimits("Head");
                ArrayList yawLimits = (ArrayList)limits[0];
                ArrayList pitchLimits = (ArrayList)limits[1];
                _minYaw = (float)yawLimits[0];
                _maxYaw = (float)yawLimits[1];
                _minPitch = (float)pitchLimits[0];
                _maxPitch = (float)pitchLimits[1];
                Console.WriteLine("MinYaw: " + _minYaw + " MaxYaw:" + _maxYaw + " MinPitch: " + _minPitch + " MaxPitch:" + _maxPitch);
                // give the joints some stiffness
                _motion.stiffnessInterpolation("Head",1.0f,1.0f);

            }
            catch(Exception e)
            {
                Console.Out.WriteLine("HeadPanning.Connect exception: " + e);
            }
        }
Beispiel #3
0
        /// <summary> 
        /// Connects to the motion system in the NAO robot 
        /// </summary> 
        /// <param name="ip"> ip address of the robot </param> 
        public void connect(string ip) 
        { 
            try 
            { 
                naoMotion = new MotionProxy(ip, 9559); 
 
                // give joints stiffness 
                naoMotion.stiffnessInterpolation("Head", 1.0f, 1.0f); 
                naoMotion.stiffnessInterpolation("LArm", 1.0f, 1.0f); 
                naoMotion.stiffnessInterpolation("RArm", 1.0f, 1.0f); 
            } 
            catch (Exception e) 
            { 
                MessageBox.Show("Exception occurred, error log in C:\\NAOcam\\exception.txt"); 
                System.IO.File.WriteAllText(@"C:\\NAOcam\\exception.txt", e.ToString()); // write exepctions to text file 
            } 
        } 
        //PostureProxy ALMotion = null;
        /// <summary>
        /// Connects to the motion system in the NAO robot
        /// </summary>
        /// <param name="ip"> ip address of the robot </param>
        public void connect(string ip)
        {
            try
            {
                naoMotion = new MotionProxy(ip, 9559);
                //  naoMotion = new ALProxy();

                // give joints stiffness
                naoMotion.stiffnessInterpolation("Head", 0.6f, 0.6f);
                naoMotion.stiffnessInterpolation("Body", 0.6f, 0.6f);
            }
            catch (Exception e)
            {
                MessageBox.Show("Exception occurred, error log in C:\\NAOserver\\exception.txt");
                System.IO.File.WriteAllText(@"C:\\NAOserver\\exception.txt", e.ToString()); // write exepctions to text file
            }
        }
Beispiel #5
0
        /// <summary> 
        /// Connects to the motion system in the NAO robot 
        /// </summary> 
        /// <param name="ip"> ip address of the robot </param> 
        /// 


        public void connect(string ip)
        {
            try
            {
                naoMotion = new MotionProxy(ip, 9559);
                bmp       = new BehaviorManagerProxy(ip, 9559);

                // give joints stiffness 
                naoMotion.stiffnessInterpolation("Head", 1.0f, 1.0f);
                naoMotion.stiffnessInterpolation("LArm", 1.0f, 1.0f);
                naoMotion.stiffnessInterpolation("RArm", 1.0f, 1.0f);
            }
            catch (Exception e)
            {
                //MessageBox.Show("Exception occurred, error log in C:\\NAOcam\\exception.txt");
                System.IO.File.WriteAllText(@"C:\\NAOcam\\exception.txt", e.ToString());  // write exepctions to text file 
            }
        }
Beispiel #6
0
        public static void StiffnessOn(MotionProxy proxy)
        {
            // We use the "Body" name to signify the collection of all joints
            var pNames          = "Body";
            var pStiffnessLists = 1.0f;
            var pTimeLists      = 1.0f;

            proxy.stiffnessInterpolation(pNames, pStiffnessLists, pTimeLists);
        }
Beispiel #7
0
        /// <summary>
        /// Connects to the motion system in the NAO robot
        /// </summary>
        /// <param name="ip"> ip address of the robot </param>
        public void connect(string ip)
        {
            // Make sure the standard output directory exists
            if (!Directory.Exists("C:\\NAO Motion\\"))
            {
                Directory.CreateDirectory("C:\\NAO Motion\\");
            }

            try
            {
                naoMotion = new MotionProxy(ip, 9559);

                // give joints stiffness
                naoMotion.stiffnessInterpolation("Head", 1.0f, 1.0f);
                naoMotion.stiffnessInterpolation("LArm", 1.0f, 1.0f);
                naoMotion.stiffnessInterpolation("RArm", 1.0f, 1.0f);;
            }
            catch (Exception e)
            {
                File.WriteAllText(@"C:\\NAO Motion\\exception.txt", e.ToString()); // Write exepctions to text file
            }
        }
Beispiel #8
0
        public bool Start()
        {
            NAOPositions curPosition = GetPosition();

            if (curPosition == NAOPositions.Unknown || curPosition == NAOPositions.HeadBack)
            {
                return(false);
            }

            motionProxy.stiffnessInterpolation("Body", 1, 1);
            while (curPosition != NAOPositions.Stand)
            {
                switch (curPosition)
                {
                case NAOPositions.Sit:
                    ChangePositionFromSitToCrouch();
                    ChangePositionFromCrouchToStand();
                    break;

                case NAOPositions.Crouch:
                    ChangePositionFromCrouchToStand();
                    break;

                case NAOPositions.Belly:
                case NAOPositions.Frog:
                case NAOPositions.Knee:
                    ChangePositionFromBellyToStand();
                    break;

                case NAOPositions.Back:
                    ChangePositionFromBackToStand();
                    break;

                case NAOPositions.Right:
                case NAOPositions.Left:
                    ChangePositionFromSideToBelly();
                    break;

                case NAOPositions.HeadBack:
                    break;

                case NAOPositions.Unknown:
                    return(false);

                default:
                    return(false);
                }
                curPosition = GetPosition();
            }
            return(true);
        }
Beispiel #9
0
        public bool Start()
        {
            NAOPositions curPosition = GetPosition();

            if (curPosition == NAOPositions.Unknown || curPosition == NAOPositions.HeadBack)
            {
                return(false);
            }

            motionProxy.stiffnessInterpolation(NAOBodyParts.Body.ToString(), 1, 1);
            while (curPosition != NAOPositions.Sit)
            {
                switch (curPosition)
                {
                case NAOPositions.Belly:
                case NAOPositions.Frog:
                case NAOPositions.Knee:
                    ChangePositionFromBellyToCrouch();
                    break;

                case NAOPositions.Back:
                    ChangePositionFromBackToSitDown();
                    break;

                case NAOPositions.Right:
                case NAOPositions.Left:
                    ChangePositionFromSideToBelly();
                    break;

                case NAOPositions.Stand:
                case NAOPositions.Crouch:
                    ChangePositionFromCrouchToSitDown();
                    break;

                case NAOPositions.HeadBack:
                    return(false);

                case NAOPositions.Unknown:
                    return(false);

                default:
                    return(false);
                }
                curPosition = GetPosition();
            }
            //motionProxy.stiffnessInterpolation(NAOBodyParts.Body.ToString(), 0, 1);//Release stiffness
            return(true);
        }
Beispiel #10
0
 /// <summary>
 /// Class deconstructor
 /// Cuts motor stiffness
 /// </summary>
 public void removeStiffness()
 {
     naoMotion.stiffnessInterpolation("Head", 0.0f, 0.0f);
     naoMotion.stiffnessInterpolation("LArm", 0.0f, 0.0f);
     naoMotion.stiffnessInterpolation("RArm", 0.0f, 0.0f);
 }