We have a motor connected to a talon. In our code the Talon should always be set to full speed forwards/backwards or zero/off. Moving the motor forward or backwards works perfectly, but
whenever the motor should be set to zero/off, it continues to move backwards slowly. Any insight would be greatly appreciated.
Here is part of the code for reference:
Code:
public class OI {
public JoystickButton rollersIn;
public OI() {
rollersIn = new JoystickButton(rotateStick, 1);
rollersIn.toggleWhenPressed(new RollersInCommand());
}
Code:
public class RollersInCommand extends Command {
public RollersInCommand() {
requires(Robot.arm);
}
protected void initialize() {
Robot.arm.rollersIn();
}
protected void execute() {
}
protected boolean isFinished() {
return false;
}
protected void interrupted() {
Robot.arm.rollersStop();
}
}
Code:
public class Arm extends Subsystem {
SpeedController motor = RobotMap.armmotor;
public void initDefaultCommand() {
}
public void rollersIn(){
motor.set(-1.0);
}
public void rollersOut(){
motor.set(1.0);
}
public void rollersStop(){
motor.set(0.0);
}
}