View Single Post
  #2   Spotlight this post!  
Unread 20-02-2013, 13:49
pblankenbaker pblankenbaker is offline
Registered User
FRC #0868
 
Join Date: Feb 2012
Location: Carmel, IN, USA
Posts: 102
pblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of lightpblankenbaker is a glorious beacon of light
Re: About button-controlled speed controllers

I'm guessing that the issue is that both your start/stop commands terminate immediately. So, the following sequence occurs:

1. You press the button to start the shooter.
2. The command runs and turns on the shooter and then is finished.
3. The default command associated with your subsystem then runs (the one you defined in initDefaultCommand()).

This results in the motor being turned off almost instantaneously.

To see the difference, try commenting out your default command:

Code:
public void initDefaultCommand(){
     // setDefaultCommand(new ShooterStop());
}
Alternatively, you could set your stop/start commands to be interruptible and update the isFinished() method to return false. In this case, they will both run until interrupted.

Hope that helps.
Reply With Quote