Esempio n. 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);
            }
        }
 /// <summary>
 ///
 /// </summary>
 /// <param name="RobotPortNumber"></param>
 /// <param name="Boudrate"></param>
 /// <param name="JointID"></param>
 public NineMansMorrisPlayer(DynamixelController controler, Joints jointIDs)
     : base(controler, jointIDs)
 {
     //this.MyFigureShop = new FigureShop();
     //this.CaptureShop = new FigureShop();
     //this.BoardFigurePositions = new RobotBoardPosition();
 }
Esempio n. 3
0
        /// <summary>
        /// Constructor
        /// </summary>
        public DynamixelArm(DynamixelController controller, Joints jointIDs)
        {
            this.jointIDs   = jointIDs;
            this.controller = controller;

            List <Servo> servos = this.controller.FindServos((byte)jointIDs.ToArray().Min(), (byte)jointIDs.ToArray().Max());

            this.baseServo     = servos.Where(x => x.ID == this.jointIDs.Base).First();
            this.shoulderServo = servos.Where(x => x.ID == this.jointIDs.Shoulder).First();
            this.elbowServo    = servos.Where(x => x.ID == this.jointIDs.Elbow).First();
            this.wristServo    = servos.Where(x => x.ID == this.jointIDs.Wrist).First();
            this.gripperServo  = servos.Where(x => x.ID == this.jointIDs.Gripper).First();
        }
Esempio n. 4
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);
            }
        }
Esempio n. 5
0
        //Angel Dimov
        private void btnSetPosition_Click(object sender, EventArgs e)
        {
            double baseJoint     = double.Parse(this.txtBase.Text);
            double shoulderJoint = double.Parse(this.txtShoulder.Text);
            double elbowJoint    = double.Parse(this.txtElbow.Text);
            double wristJoint    = double.Parse(this.txtWrist.Text);
            double gripperJoint  = double.Parse(this.txtGripper.Text);

            this.trackBar1.Value = (int)baseJoint;
            this.trackBar2.Value = (int)shoulderJoint;
            this.trackBar3.Value = (int)elbowJoint;
            this.trackBar4.Value = (int)wristJoint;
            this.trackBar5.Value = (int)gripperJoint;

            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);

                    //baseJoint -= tempBase;
                    //shoulderJoint -= tempShoulder;
                    //elbowJoint -= tempShoulder;
                    //wristJoint -= tempWrist;
                    //gripperJoint -= tempGripper;

                    myArm.LJInterpolation(new Joint(baseJoint, shoulderJoint, elbowJoint, wristJoint, gripperJoint), 20);

                    Decart pos = myArm.GetDPosition();
                    Console.WriteLine("XYZPR: {0}", pos.ToString());
                }
            }
            catch (Exception exception)
            {
                Console.WriteLine("Robot: {0}", exception.Message);
            }
        }