public static final int ENCODER_RIGHT_B = 3;
}
- public static class Climber {
- // MOTOR CONTROLLERS
- public static final int MOTOR = 1;
-
- }
-
public static enum Direction {
LEFT, RIGHT, DOWN, UP, FORWARD, BACKWARD;
}
package org.usfirst.frc.team3501.robot;
import org.usfirst.frc.team3501.robot.commands.driving.TimeDrive;
-import org.usfirst.frc.team3501.robot.subsystems.Climber;
import org.usfirst.frc.team3501.robot.subsystems.DriveTrain;
import org.usfirst.frc.team3501.robot.subsystems.Shooter;
public class Robot extends IterativeRobot {
private static DriveTrain driveTrain;
private static OI oi;
- private static Climber climber;
private static Shooter shooter;
@Override
public void robotInit() {
driveTrain = DriveTrain.getDriveTrain();
oi = OI.getOI();
- climber = Climber.getClimber();
shooter = Shooter.getShooter();
}
return DriveTrain.getDriveTrain();
}
- public static Climber getClimber() {
- return Climber.getClimber();
- }
-
public static OI getOI() {
return OI.getOI();
}
- public static Climber getClimber() {
- return Climber.getClimber();
- }
-
public static Shooter getShooter() {
return Shooter.getShooter();
}
/**
* This command runs the winch at a specified speed and time in seconds when the
- * button triggering it is pressed.
+ * button triggering it is pressed. This command also runs the drive train.
*
* pre-condition: This command is run by a button in OI. The robot must be
* attached to the rope.
private double motorVal;
/**
+ * See JavaDoc comment in class for details
*
- * @author shivanighanta
- *
+ * @param time
+ * time in seconds to run the winch
+ * @param motorVal
+ * value range is from -1 to 1
*/
public RunWinch(double time, double motorVal) {
- requires(Robot.getClimber());
+ requires(Robot.getDriveTrain());
this.time = time;
this.motorVal = motorVal;
}
@Override
protected void initialize() {
timer.start();
- Robot.getClimber().setMotorValue(motorVal);
}
@Override
protected void execute() {
+ Robot.getDriveTrain().setMotorValues(motorVal, motorVal);
}
@Override
protected void end() {
- Robot.getClimber().stop();
+ Robot.getDriveTrain().stop();
+
}
@Override
/**
* This command will run the winch motor continuously until the button
- * triggering it is released.
+ * triggering it is released. This command also runs the drive train.
*
* pre-condition: This command must be run by a button in OI. The robot must be
* attached to the rope.
private double motorVal;
/**
- *
+ * See JavaDoc comment in class for details
+ *
* @param motorVal
+ * value range is from -1 to 1
*/
public RunWinchContinuous(double motorVal) {
- requires(Robot.getClimber());
+ requires(Robot.getDriveTrain());
this.motorVal = motorVal;
}
@Override
protected void initialize() {
- Robot.getClimber().setMotorValue(motorVal);
+ Robot.getDriveTrain().setMotorValues(motorVal, motorVal);
}
@Override
protected boolean isFinished() {
- return !Robot.getOI().toggleWinch.get();
+ return false;
}
@Override
protected void end() {
- Robot.getClimber().stop();
+
}
@Override
+++ /dev/null
-package org.usfirst.frc.team3501.robot.commands.climber;
-
-import org.usfirst.frc.team3501.robot.Robot;
-
-import edu.wpi.first.wpilibj.command.Command;
-
-/**
- * This command stops the winch
- *
- * post-condition: the motor values are set to 0.
- *
- * @author shivanighanta
- *
- */
-public class StopWinch extends Command {
- /**
- *
- */
- public StopWinch() {
- requires(Robot.getClimber());
-
- }
-
- @Override
- protected void initialize() {
- }
-
- @Override
- protected void execute() {
- }
-
- @Override
- protected boolean isFinished() {
- return true;
- }
-
- @Override
- protected void end() {
- Robot.getClimber().stop();
-
- }
-
- @Override
- protected void interrupted() {
- end();
- }
-}
+++ /dev/null
-package org.usfirst.frc.team3501.robot.subsystems;
-
-import org.usfirst.frc.team3501.robot.Constants;
-
-import com.ctre.CANTalon;
-
-import edu.wpi.first.wpilibj.command.Subsystem;
-
-public class Climber extends Subsystem {
- private static Climber climber;
- private final CANTalon motor;
-
- private Climber() {
- motor = new CANTalon(Constants.Climber.MOTOR);
- }
-
- public static Climber getClimber() {
- if (climber == null) {
- climber = new Climber();
- }
- return climber;
- }
-
- public void stop() {
- setMotorValue(0);
- }
-
- public void setMotorValue(final double val) {
- motor.set(MOTOR);
-
- }
-}