Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ca.mcgill.ecse211.project;
- import static ca.mcgill.ecse211.project.Resources.*;
- /**
- * This class is used to activate the launcher on the robot
- *
- * @author Alex Choi
- * @author Louca Dufault
- */
- REEL_SPEED = slow;
- REEL_ACCELERATION = slow;
- LOCK_SPEED = slow;
- LOCK_ACCELERATION = slow;
- UNLOCK_SPEED = fast;
- UNLOCK_ACCELERATION = fast;
- public class Launcher {
- /**
- * Sets up the speeds and accelerations of the motors before beginning the launch
- */
- private static void setup() {
- reelMotor.setAcceleration(REEL_ACCELERATION);
- reelMotor.setSpeed(REEL_SPEED);
- latchMotor.setAcceleration(LOCK_ACCELERATION);
- latchMotor.setSpeed(LOCK_SPEED);
- //latchMotor.rotate(90, true); //rotate cw 90 deg, blocking unlock
- }
- /**
- * Performs the launch maneuver of the launcher hardware.
- */
- public static void launch() {
- setup();
- reelMotor.rotate(180, false); //non-blocking
- Thread.sleep(500); //once it has sufficiently wound up
- latchMotor.rotate(-90, false); //lock
- latchMotor.stop(); // keep lock in place
- reelMotor.rotate(-180, true); // unwind reel, blocking
- latchMotor.setAcceleration(UNLOCK_ACCELERATION);
- latchMotor.setSpeed(UNLOCK_SPEED);
- latchMotor.rotate(90, true); //unlock, blocking
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement