Go to Post Health. Family. School. FIRST. Any other order is a mistake. - pfreivald [more]
Home
Go Back   Chief Delphi > Technical > Electrical > CAN
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 21-02-2012, 17:19
Levansic's Avatar
Levansic Levansic is offline
Registered User
AKA: Len Evansic
FRC #0585 (Cyber Penguins)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2008
Location: Tehachapi, CA
Posts: 185
Levansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud of
Modest request for next Jaguar firmware

Like other teams using Jaguars on the CANbus, we saw a few areas of operation that need to be improved. As a mentor, I can see why quite a few teams are leery of the results. Quite often, the deficiencies we saw, and others have commented on, are not really fair to pin on the Jaguar, since it is more likely that the Jaguars expose problems that the cRIO's longer time slices tend to hide.

Instead of complaining about the Jaguars PID implementation, I think it would be more constructive to offer suggestions for incremental fixes that would make it easier to recommend closed-loop on the Jaguars with confidence. In this spirit, I'll offer the first suggestions:
  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.

  2. Offer a simple filter (e.g. moving average of last n readings) for the encoder feedback. This could be on all the time with a user-settable range like 0 < n < 32. Unfiltered would correspond to n = 1, and lag and smoothness increases from there.

    Rationale - It appears that the Jaguars are too responsive to the noise in the encoder signal. The speed of the control loop is far faster than the motors that will be hooked up, so the minor lag of grabbing 5-15 encoder readings would not be noticed.

Last edited by Levansic : 22-02-2012 at 01:08.
Reply With Quote
  #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
  #3   Spotlight this post!  
Unread 22-02-2012, 14:15
Levansic's Avatar
Levansic Levansic is offline
Registered User
AKA: Len Evansic
FRC #0585 (Cyber Penguins)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2008
Location: Tehachapi, CA
Posts: 185
Levansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud of
Re: Modest request for next Jaguar firmware

My team is using LabView, and we haven't found an equivalent for the enable and disable command for individual CAN jaguars. Perhaps there is a terminal on one of the vi's that we missed.

My proposal is essentially to automate the disable/enable on the jaguar, based on setting conditions, rather than explicit programming from the team code. If you look at limit switches, for example, there is no way to enable or disable them from LabView. They are explicitly enabled by default, so you do not have to send an explicit command to enable them on the Jaguar. If you use BDC-Comm, you can disable or enable the limit switches. The FIRST Labview libraries take this choice (or responsibility) away from the student programmer, and make the limit switches always functional. No code required.

Last edited by Levansic : 22-02-2012 at 14:24.
Reply With Quote
  #4   Spotlight this post!  
Unread 22-02-2012, 14:56
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,582
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Modest request for next Jaguar firmware

Quote:
Originally Posted by Levansic View Post
My team is using LabView, and we haven't found an equivalent for the enable and disable command for individual CAN jaguars. Perhaps there is a terminal on one of the vi's that we missed.
It's built into the Motor enable/disable VIs.

Quote:
Originally Posted by Levansic View Post
If you look at limit switches, for example, there is no way to enable or disable them from LabView. They are explicitly enabled by default, so you do not have to send an explicit command to enable them on the Jaguar. If you use BDC-Comm, you can disable or enable the limit switches. The FIRST Labview libraries take this choice (or responsibility) away from the student programmer, and make the limit switches always functional. No code required.
If there are existing CAN messages that you think should be implemented in the LabVIEW library, you can file a bug report on first forge http://firstforge.wpi.edu/sf/tracker...b_labview_bugs

You can also implement them yourself, using the the documentation that rrossbach pointed you to.

I do think that the choice to switch out of a closed loop mode into an open loop mode when 0 is commanded is better left to the programmer, rather then being built into the jaguar, because I think both options are correct, for different circumstances.

I do think having encoder filtering is something that should be implemented inside the jaguar.
Reply With Quote
  #5   Spotlight this post!  
Unread 22-02-2012, 15:22
Levansic's Avatar
Levansic Levansic is offline
Registered User
AKA: Len Evansic
FRC #0585 (Cyber Penguins)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2008
Location: Tehachapi, CA
Posts: 185
Levansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud of
Re: Modest request for next Jaguar firmware

I used the limit switches as an example, because it appears that there was a conscious decision by the WPI implementors to provide a default safe mode.

On the jaguars, I see that there is inconsistent behavior already with regard to the jaguar being commanded to a 0 set point. For example, if you use voltage mode with a ramp rate, and have the brake set by jumper or CAN specification. You can ramp to 100%, and then immediately ramp down to -50% or -100%, but as soon as you command a voltage between ~-10% to 10%, the brake kicks in immediately, with no ramp. A near 0 commanded voltage ignores the ramp rate that is set. Likewise, with the brake set to coast, there is no ramp down to 0, it just free-wheels.

In speed control mode, the jaguar is attempting to control the output, even if commanded to 0. My proposal would at least synchronize the behaviors of these two modes.
Reply With Quote
  #6   Spotlight this post!  
Unread 22-02-2012, 15:28
Levansic's Avatar
Levansic Levansic is offline
Registered User
AKA: Len Evansic
FRC #0585 (Cyber Penguins)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2008
Location: Tehachapi, CA
Posts: 185
Levansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud ofLevansic has much to be proud of
Re: Modest request for next Jaguar firmware

Quote:
Originally Posted by Joe Ross View Post
It's built into the Motor enable/disable VIs.
OK. Wasn't aware that those were polymorphic.


Thanks for the link for WPI feedback! Also, thanks to rossbach for the CAN documentation link. We will go through the CAN reference to see what we are missing.
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 17:50.

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