I want to make a command that when hold a button it sets two motors speeds to the value of the throttle of a joystick(we’re using the Logitech ATK3). I’m running into an issue where it doesn’t like updating the value of the joystick when I hold the button(It crashes the robot and the driver station gives me the Robots don’t quit message). When the command is constantly running there’s no issue, but I would like it to not constantly run. I can make the command’s parameters request a double and then in OI put in the joysticks throttle value there but it doesn’t update after the init of the robot.
public class ShooterArcade extends Command {
OI oi;
Shooter shooter;
public ShooterArcade() {
requires(Robot.shooter);
shooter = Robot.shooter;
oi = Robot.oi;
}
// Called just before this Command runs the first time
protected void initialize() {
}
// Called repeatedly when this Command is scheduled to run
protected void execute() {
double shooterSpeed = oi.getShooterThrottle();
shooter.shooterArcade(shooterSpeed);
}
// Make this return true when this Command no longer needs to run execute()
protected boolean isFinished() {
return true;
}
Our team doesn’t use the Command-based template, but I’m guessing that having isFinished() always return true immediately is a problem. I think that you are starting and stopping the command over and over. Try changing isFinished() to return false and see if that helps.
the other part of information that is helpful is the lines above “robots don’t quit”. Those lines tell people trying to help you where your code was when it had trouble.