Go to Post Thermodynamics says that offense is harder than defense. - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 20-02-2013, 07:52
AmLameBro AmLameBro is offline
Registered User
FRC #4034
 
Join Date: Jan 2013
Location: Pelham. NH
Posts: 6
AmLameBro is just really niceAmLameBro is just really niceAmLameBro is just really niceAmLameBro is just really nice
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);
}
Here's ShooterStart and ShooterStop commands:

Code:
execute(){
     firingjag.StartShooter();
}
Code:
execute(){
     firingjag.StopShooter();
}
And finally, in OI:

Code:
public OI(){
     new JoystickButton(stick1, 4).whenPressed(new ShooterOn());
     new JoystickButton(stick1, 5).whenPressed(new ShooterOff());
}
Thanks in advance to anyone who can tell me what's wrong.

Edit: I've also tried the .whileHeld(new ShooterOn()), but the result is still the same; there's only pulsing

Last edited by AmLameBro : 20-02-2013 at 07:55.
Reply With Quote
  #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: 103
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
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 22:15.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi