Пример #1
0
        static public int ArmCommandCallback(Comnet.Header header, Comnet.ABSPacket packet, Comnet.CommNode node)
        {
            NGCP.ArmCommand ac = Comnet.ABSPacket.GetValue <NGCP.ArmCommand>(packet);
            //do some kind of switch case
            //@TODO ARM
            int servoPosition = ac.id;
            int servoValue    = ac.position;

            Console.WriteLine("test armCommand");
            //id_servo_GUI = ac.id;
            //val_servo_GUI = ac.position;



            return((Int32)(Comnet.CallBackCodes.CALLBACK_SUCCESS | Comnet.CallBackCodes.CALLBACK_DESTROY_PACKET));
        }
        public int ArmCommandCallback(Comnet.Header header, Comnet.ABSPacket packet, Comnet.CommNode node)
        {
            NGCP.ArmCommand ac = Comnet.ABSPacket.GetValue <NGCP.ArmCommand>(packet);

            //do some kind of switch case
            //@TODO ARM
            int armServo   = ac.id;
            int servoValue = ac.position;

            //// this method
            switch (armServo)
            {
            case armY_id:     //Arm Stepper Y
                Arm_Y_Servo_Box.Text = (servoValue).ToString();
                break;

            case armX_id:     //Arm Stepper X
                Arm_X_Servo_Box.Text = (servoValue).ToString();
                break;

            case turretServo_id:     //Turret Servo
                Base_Servo_Box.Text = (servoValue).ToString();
                break;

            case gripper_id:     //Gripper
                if (servoValue == 1)
                {
                    Gripper_Servo_Box.Text = "Closed";
                }
                else
                {
                    Gripper_Servo_Box.Text = "Retracted";
                }
                break;

            default:
                // write to none of the servos, the id written was not recognized
                break;
            }
            return((Int32)(Comnet.CallBackCodes.CALLBACK_SUCCESS | Comnet.CallBackCodes.CALLBACK_DESTROY_PACKET));
        }
Пример #3
0
 /// <summary>
 /// This method should be called by an event handler for each time there is a gain to be written for any servo
 /// </summary>
 /// <param name="servo_id"></param>
 /// <param name="write_value"></param>
 private void SendArmData(int servo_id, int write_value)
 {
     //@TODO send values
     NGCP.ArmCommand ac = new NGCP.ArmCommand((byte)servo_id, write_value);
     comms.Send(ac, UGV_ID);
 }
 public void SendArmCommand(byte armPartID, int position, byte id = 100)
 {
     NGCP.ArmCommand ap = new NGCP.ArmCommand(armPartID, position);
     Node.Send(ap, id);
 }