|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
About button-controlled speed controllers
I am trying to have the shooting wheel spin at full speed when I hit a button. It is controlled via a Jaguar, and in the method, I just use (name).set(1.0);.
When I actually hit the button, though, the wheel just twitches on for a second and then stops before repeating it. On the smart dashboard, the command for the firing subsystem still reads the ShooterOn command. Does anyone know how to fix this? In FiringJag subsystem: Code:
Jaguar firingjag;
public FiringJag(){
firingjag = new Jaguar (3); // It is in PWM port 3
setSafetyEnabled(false);
}
public void initDefaultCommand(){
setDefaultCommand(new ShooterStop());
}
public void StartShooter(){
firingjag.set(1.0);
}
public void StopShooter(){
firingjag.set(0);
}
Code:
execute(){
firingjag.StartShooter();
}
Code:
execute(){
firingjag.StopShooter();
}
Code:
public OI(){
new JoystickButton(stick1, 4).whenPressed(new ShooterOn());
new JoystickButton(stick1, 5).whenPressed(new ShooterOff());
}
Edit: I've also tried the .whileHeld(new ShooterOn()), but the result is still the same; there's only pulsing Last edited by AmLameBro : 02-20-2013 at 07:55 AM. |
|
#2
|
|||
|
|||
|
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());
}
Hope that helps. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|