Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMoveRobotToHome_Click(object sender, EventArgs e)
        {
            if (!this.enableSending)
            {
                return;
            }

            int comIndex = Convert.ToInt32(this.robotSerialPortName.Replace("COM", ""));

            try
            {
                using (DynamixelController myDynamixel = new DynamixelController(comIndex, 1))
                {
                    DynamixelArm myArm = new DynamixelArm(myDynamixel, this.jointIDs);
                    //System.Threading.Thread.Sleep(2000);
                    myArm.GoToHome();
                    Decart pos = myArm.GetDPosition();
                    Console.WriteLine("XYZPR: {0}", pos.ToString());
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("Robot: {0}", exception.Message);
            }
        }
Example #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSendCommand_Click(object sender, EventArgs e)
        {
            if (!this.enableSending)
            {
                return;
            }

            int comIndex = Convert.ToInt32(this.robotSerialPortName.Replace("COM", ""));

            tsslblSerialStatus.Text = "";

            try
            {
                using (DynamixelController myDynamixel = new DynamixelController(comIndex, 1))
                {
                    DynamixelArm myArm = new DynamixelArm(myDynamixel, this.jointIDs);
                    myArm.ComState   += new EventHandler <StateEvent>(myRobot_RobotComState);
                    myArm.ServoState += new EventHandler <ErrorEvent>(myRobot_RobotServoState);

                    /*
                     * for (int iterator = 0; iterator < 10; iterator++)
                     * {
                     *  myArm.LJInterpolation(new Joint(20.0d, -20.0d, 20.0d, 20.0d, 0.0d), 20.0d);
                     *  myArm.LJInterpolation(new Joint(-40.0d, 40.0d, -40.0d, -40.0d, 0.0d), 40.0d);
                     *  myArm.LJInterpolation(new Joint(20.0d, -20.0d, 20.0d, 20.0d, 0.0d), 20.0d);
                     * }
                     */
                    myArm.GoToHome();

                    myArm.ComState   -= new EventHandler <StateEvent>(myRobot_RobotComState);
                    myArm.ServoState -= new EventHandler <ErrorEvent>(myRobot_RobotServoState);

                    this.TestProgram(myArm);
                }

                Joint homeJ = new Joint(0.0d, 0.0d, 0.0d, 0.0d, 0.0d);
                Robot.Experimantal.ArmConfiguration myConfig     = new Robot.Experimantal.ArmConfiguration(47, 47, 142, 110);
                Robot.Experimantal.ArmKinematics    myKinematics = new Robot.Experimantal.ArmKinematics(myConfig);
                Decart homeD  = myKinematics.Forward(homeJ);
                string values = homeD.ToString();
                Console.WriteLine("Values: {0}", values);
            }
            catch (Exception exception)
            {
                Console.WriteLine("Robot: {0}", exception.Message);
            }
        }