コード例 #1
0
 /// <summary>
 /// Swivels the cannon left
 /// </summary>
 public void AimCannonLeft()
 {
     if (aimServo.GetServoPosition() == (int)Servo.CONSTANTS.MIN_POSITION)
     {
         aimServo.MoveServo(aimServo.GetServoPosition() - move_motor_by_amount);
     }
 }
コード例 #2
0
        /// <summary>
        /// Drops the claw and attempts to grab the item as well as resets the claw
        /// </summary>
        /// <remarks> Add a way to handle errors/if something happens </remarks>
        public bool DropAndGrabClaw()
        {
            clawServo.MoveServo((int)Servo.CONSTANTS.MAX_POSITION);         // opens the claw
            winchMotor.SetPosition(100000);                                 // lowers the claw TODO: check if this is the correct position
            clawServo.MoveServo((int)Servo.CONSTANTS.MIN_POSITION);         // closes the claw
            winchMotor.SetPosition((int)TicMotor.CONSTANTS.MIN_POSITION);   // winches up the claw TODO: check if this is the correct position
            xMotor.SetPosition((int)TicMotor.CONSTANTS.MIN_POSITION);       // resets the claws x axis
            yMotor.SetPosition((int)TicMotor.CONSTANTS.MIN_POSITION);       // resets the claws y axis

            // TODO: make sure it's able to find 0 for all of the motors
            while (xMotor.GetPosition() != (int)TicMotor.CONSTANTS.MIN_POSITION && //
                   yMotor.GetPosition() != (int)TicMotor.CONSTANTS.MIN_POSITION && //
                   winchMotor.GetPosition() != (int)TicMotor.CONSTANTS.MIN_POSITION)
            {
                ;                                                                     // wait until the claw is back at the start point
            }
            return(true);
        }