Go to Post Its not really a robotics competition. The robots are merely vehicles used to make society a better place, and to inspire the youth of the world to help one another, and to become more united. - Amanda M [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 Rating: Thread Rating: 75 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 24-01-2012, 07:13
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by Ether View Post
Some questions:

What wheel were you using?

What speed(s) were you controlling at? What was the approximate voltage at each speed?
I was using a 5in. colson wheel and controlled the motor speed between 500 rpm and 2500 rpm. I was not able to record voltage data because as mentioned, the interface I was using was through BDC-COM.

Quote:
Can you estimate the approximate transfer function from speed command to measured speed?
The answer to this question would also answer your other question on the voltage at each speed. I have not done the complete testing yet, but the transfer function is obviously non-linear. Which could be reasons for spikes in rpm around the set point. Ideally, a speed controller will clamp its output to the last output once the setpoint was reached, to prevent these fluctuations due to non-linear motor controllers.


Quote:
Did you collect any data, such as time traces of speed command and speed output (for step commands or sinusoids).
Sounds like your looking for information on rise time and settling time? Because I was running the Jag using BDC-COM, I wasn't able to record actual output information (unless there is a feature I am unaware of).

I tuned the gains of the controller to have a rise time of about 0.3 seconds and settle just under 1 second. Just visually, I would say settling time was closer too 2 seconds. When I run the setup on the CRIO, where I can log output data from the Jag I will be able to graph it and view true rise time and settling time for the response.

I am confident that the Jag will perform well under certain applications. It is my personal stance as a Control Engineer to have filtered feedback signals, and account for external disturbances if I need too with additional control, which the Jaguar can't do. I am confident the Jaguar can perform good speed and position control, but a smooth response where the controller is not being overworked may be hard obtain because the Jaguar does not allow the user to account for the variable non-linear effects. For FIRST purposes, I think the Jags can accommodate.

Hope this helps,
Kevin

Last edited by NotInControl : 24-01-2012 at 07:34.
Reply With Quote
  #2   Spotlight this post!  
Unread 24-01-2012, 09:42
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,101
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by NotInControl View Post
controlled the motor speed between 500 rpm and 2500 rpm
How closely did the actual measured speed match the speed you were commanding?

I ask this because other teams have reported that they could control speed, but the actual speed did not match the commanded speed.

Reply With Quote
  #3   Spotlight this post!  
Unread 24-01-2012, 16:42
NotInControl NotInControl is offline
Controls Engineer
AKA: Kevin
FRC #2168 (Aluminum Falcons)
Team Role: Engineer
 
Join Date: Oct 2011
Rookie Year: 2004
Location: Groton, CT
Posts: 261
NotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond reputeNotInControl has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by Ether View Post
How closely did the actual measured speed match the speed you were commanding?

I ask this because other teams have reported that they could control speed, but the actual speed did not match the commanded speed.


In all cases my steady state error was +/- 200 rpm. Now I say this sparingly. The only indication I had of actual speed was the readout from the BDC-COM interface, which was fluctuating within this range.

However, I would argue that most of that fluctuation is due to the lack of smoothing the input rate of the encoder and causing the PID loop to iterate to reduce the error. If there were no noise in the feedback signal, fluctuations in the output can be fixed by reducing the P term of a PI controller, however this will reduce your rise time.
Reply With Quote
  #4   Spotlight this post!  
Unread 24-01-2012, 20:14
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Some anecdotal notes to share with you: we're using 256 ppr Greyhill 63R series encoders, directly attached via surgical tubing to a ~6" wheel. We run them from 200-1800 RPM.

The vanilla PID implementation in the Jags is not well-suited to speed control PID. Tuning them using traditional methods as you have been may be futile. Hence the reason why I started this thread in the first place. Many of us have been down the same road you have, and have been left bitterly disappointed in the results.

The first two posts in this thread are exceptionally valuable IMO, as they are workarounds on how to massage the Jag's limited speed control PID into something workable.

If you insist on using more traditional PID tuning methods, I can suggest method #3, which is a more conventional DOES appear work for systems with very little resistance or changes in dynamics (i.e. a free-wheeling shooter wheel).

Start with 0 for all terms. Increase P until you reach approximately 50% of your setpoint. Adjust it down until you find the P value that results in the least amount of fluctuation in speed. You may need to reduce the P significantly to get a very stable value. You should be able to get ~1% deviation from wherever your speed happens to settle. The important thing here is that your output rpm remains as rock solid as possible, and you've pushed it as close to 50% of your setpoint as you can get it.

Now bump up your I term 0.001 at a time until your system finally achieves your setpoint. Use the least amount of I possible such that your system can reach it maximum speed.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
Reply With Quote
  #5   Spotlight this post!  
Unread 07-03-2012, 16:53
mjcoss mjcoss is offline
Registered User
FRC #0303
 
Join Date: Jan 2009
Location: Bridgewater,NJ
Posts: 70
mjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the rough
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Worked on this last night to try once more to tune the PID loop for speed control on our shooter motors. Unfortunately, I don't seem to be able to get a stable system over the entire range. Between 500 and 2000, I see pretty stable values, but system starts oscillating as I move up between 3000 and 4000. 4000 is close to the maximum that the motors can do.

I applied the method mentioned here where I got a stable min P @ 50% set point, then added I to get to the set point. Is there no reason to add the D term is is the Jaguar PID just to flaky?

I'm not sure whether to keep tinkering with this or just declare it stable enough.

---Michael J Coss

Quote:
Originally Posted by Mr. Lim View Post
Some anecdotal notes to share with you: we're using 256 ppr Greyhill 63R series encoders, directly attached via surgical tubing to a ~6" wheel. We run them from 200-1800 RPM.

The vanilla PID implementation in the Jags is not well-suited to speed control PID. Tuning them using traditional methods as you have been may be futile. Hence the reason why I started this thread in the first place. Many of us have been down the same road you have, and have been left bitterly disappointed in the results.

The first two posts in this thread are exceptionally valuable IMO, as they are workarounds on how to massage the Jag's limited speed control PID into something workable.

If you insist on using more traditional PID tuning methods, I can suggest method #3, which is a more conventional DOES appear work for systems with very little resistance or changes in dynamics (i.e. a free-wheeling shooter wheel).

Start with 0 for all terms. Increase P until you reach approximately 50% of your setpoint. Adjust it down until you find the P value that results in the least amount of fluctuation in speed. You may need to reduce the P significantly to get a very stable value. You should be able to get ~1% deviation from wherever your speed happens to settle. The important thing here is that your output rpm remains as rock solid as possible, and you've pushed it as close to 50% of your setpoint as you can get it.

Now bump up your I term 0.001 at a time until your system finally achieves your setpoint. Use the least amount of I possible such that your system can reach it maximum speed.
Reply With Quote
  #6   Spotlight this post!  
Unread 07-03-2012, 20:36
Mr. Lim Mr. Lim is offline
Registered User
AKA: Mr. Lim
no team
Team Role: Leadership
 
Join Date: Jan 2004
Rookie Year: 1998
Location: Toronto, Ontario
Posts: 1,125
Mr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond reputeMr. Lim has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

I have not been able to get the Jaguar's D term to give me any useful kind of system response when in Speed control.

Is your system oscillating with a regular period at the high RPMs? Or is it behaving erratically?

If the latter, you might just be getting a lot of noise on your encoder signal. You will run into problems if you are running your encoder wires beside your motor power wires.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
Reply With Quote
  #7   Spotlight this post!  
Unread 08-03-2012, 01:18
mjcoss mjcoss is offline
Registered User
FRC #0303
 
Join Date: Jan 2009
Location: Bridgewater,NJ
Posts: 70
mjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the rough
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

It's a bit erratic and it may well be just noise. I played a little more with it tonight, and feel like it is stable enough. One thing that I meant to mention, and was a bit surprised by was that the Get[() function on the Jaguars just return the set point, not the current speed. We have the encoder signal split, going to the digital side card, and I've been using the digital side card encoder to track the performance of the speed control.

I expected that the Jaguar would have reported the current speed, not the set point. I played some with the D term but got nothing useful.

---Michael J Coss

Quote:
Originally Posted by Mr. Lim View Post
I have not been able to get the Jaguar's D term (to give me any useful kind of system response when in Speed control.

Is your system oscillating with a regular period at the high RPMs? Or is it behaving erratically?

If the latter, you might just be getting a lot of noise on your encoder signal. You will run into problems if you are running your encoder wires beside your motor power wires.
Reply With Quote
  #8   Spotlight this post!  
Unread 08-03-2012, 02:28
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by mjcoss View Post
It's a bit erratic and it may well be just noise. I played a little more with it tonight, and feel like it is stable enough. One thing that I meant to mention, and was a bit surprised by was that the Get[() function on the Jaguars just return the set point, not the current speed. We have the encoder signal split, going to the digital side card, and I've been using the digital side card encoder to track the performance of the speed control.

I expected that the Jaguar would have reported the current speed, not the set point. I played some with the D term but got nothing useful.

---Michael J Coss
You need to use GetStatus to find the measured speed. The headers / context help contains information. You should read it.

-Joe
Reply With Quote
  #9   Spotlight this post!  
Unread 08-03-2012, 16:12
mjcoss mjcoss is offline
Registered User
FRC #0303
 
Join Date: Jan 2009
Location: Bridgewater,NJ
Posts: 70
mjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the rough
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by jhersh View Post
You need to use GetStatus to find the measured speed. The headers / context help contains information. You should read it.

-Joe
My CANJaguar.h does not have a GetStatus method, nor does the WindRiver IDE show any method by that name for my CANJaguar object. And I do look at the headers.

---Michael J Coss
Reply With Quote
  #10   Spotlight this post!  
Unread 08-03-2012, 17:48
mikets's Avatar
mikets mikets is online now
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 674
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

My impression is that GetStatus is a LabView thing not for WindRiver C++.
__________________
Reply With Quote
  #11   Spotlight this post!  
Unread 08-03-2012, 19:07
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by mjcoss View Post
My CANJaguar.h does not have a GetStatus method, nor does the WindRiver IDE show any method by that name for my CANJaguar object. And I do look at the headers.
Sorry... I had the wrong name... GetSpeed()

Quote:
Originally Posted by mikets View Post
My impression is that GetStatus is a LabView thing not for WindRiver C++.
You are correct... I forgot that the C++ implementation calls out the status each separately.
Reply With Quote
  #12   Spotlight this post!  
Unread 08-03-2012, 19:10
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by mjcoss View Post
My CANJaguar.h does not have a GetStatus method, nor does the WindRiver IDE show any method by that name for my CANJaguar object. And I do look at the headers.
Code:
/**
 * Get the recently set outputValue setpoint.
 * 
 * The scale and the units depend on the mode the Jaguar is in.
 * In PercentVbus Mode, the outputValue is from -1.0 to 1.0 (same as PWM Jaguar).
 * In Voltage Mode, the outputValue is in Volts.
 * In Current Mode, the outputValue is in Amps.
 * In Speed Mode, the outputValue is in Rotations/Minute.
 * In Position Mode, the outputValue is in Rotations.
 * 
 * @return The most recently set outputValue setpoint.
 */
float CANJaguar::Get()
Code:
/**
 * Get the speed of the encoder.
 * 
 * @return The speed of the motor in RPM based on the configured feedback.
 */
double CANJaguar::GetSpeed()
Reply With Quote
  #13   Spotlight this post!  
Unread 12-03-2012, 19:24
mjcoss mjcoss is offline
Registered User
FRC #0303
 
Join Date: Jan 2009
Location: Bridgewater,NJ
Posts: 70
mjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the roughmjcoss is a jewel in the rough
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Yes. Mea culpa

While I was looking for the GetStatus(), I found GetSpeed(). Meant to mention that in the post.

---Michael J Coss
Reply With Quote
  #14   Spotlight this post!  
Unread 13-03-2012, 14:56
6xpoppy 6xpoppy is offline
Registered User
FRC #0353
 
Join Date: Mar 2012
Location: Plainview, NY 11803
Posts: 1
6xpoppy is an unknown quantity at this point
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

My name is Martin Kanner (an old time controls engineer) and I have been mentoring for team 353 for 6 years. I marveled at the technology of the PID but I coudln't see how it could be applied in an engineering fashion with the information available. My basic point is that a closed loop is designed for performance and stability. This is not to be accomplished by trial and erorr. My experience has been with the application of Bode analysis and Bode plots. I have completed 3 files so far entitled "The PID Revisited". I expect to complete two more files to be complete. I believe they contain the basics for designing closed loops. If anyone is interested, I'll e-mail PID11, PID22 and
PID33. They are pretty short but I believe contain some simple but important fundamentals. My e-mail is, msixxpoppy@hotmail.com
Reply With Quote
  #15   Spotlight this post!  
Unread 07-03-2012, 20:43
dakaufma dakaufma is offline
Registered User
AKA: David Kaufman
FRC #0449 (Blair Robot Project)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2009
Location: Silver Spring
Posts: 28
dakaufma is an unknown quantity at this point
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Tuning with P is appropriate for position control PIDs but for speed control I should be your primary constant (imagine that the wheel is spinning just faster than the desired speed: P will try to reverse the motor). There are a couple of threads about this on CD with details.
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 13:02.

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