View Single Post
  #2   Spotlight this post!  
Unread 22-02-2012, 09:21
rrossbach rrossbach is offline
Registered User
AKA: Ron R
FRC #2607 (RoboVikings)
Team Role: Mentor
 
Join Date: Nov 2008
Rookie Year: 2008
Location: Warrington PA
Posts: 90
rrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to beholdrrossbach is a splendid one to behold
Re: Modest request for next Jaguar firmware

Quote:
Originally Posted by Levansic View Post
  1. For speed control; turn off the output if the commanded speed is 0, and the brake is set to coast.

    Rationale - We send 0 speed commands initially to our drive motors, as part of the initialization. When the robot is suspended (to keep the wheels off of the ground), there is enough backlash in the typical FRC gearboxes that the encoders will register small movements. The PID then attempts to counter the perceived speed, causing a thrashing of the wheels and gears, when a 0 rpm speed is commanded. Turning off the output for this case is safe.
If I've understood correctly, and assuming properly tuned PID gains, you can accomplish this by using enableControl() and disableControl() which are provided by the CANJaguar object in WPILib.

In your initialization code, you shouldn't need to send an initial 0 speed command. Just configure the speed mode, speed reference, PID gains, etc. Then enableControl() only when you actually want to start controlling the output - the motors won't move until you enableControl() and set a speed command via setX(). Each call to enableControl() turns off the output though, so only call it once when you want to start controlling.

disableControl() will turn off the output and set the Jaguar back into %voltage mode (which is the default).

The documentation in the Jaguar "reference design kit" - available here - also explains in more detail what all of the CAN messages do.

Hope that helps!

- Ron
__________________

FIRST Mid-Atlantic Volunteer
FRC Team #2607 Mentor

Last edited by rrossbach : 22-02-2012 at 09:23.
Reply With Quote