Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   CAN (http://www.chiefdelphi.com/forums/forumdisplay.php?f=185)
-   -   2012: Tuning the Jaguar's Speed Control PID Loop (http://www.chiefdelphi.com/forums/showthread.php?t=100135)

jhersh 08-03-2012 02:28

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
Quote:

Originally Posted by mjcoss (Post 1140883)
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

mjcoss 08-03-2012 16:12

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
Quote:

Originally Posted by jhersh (Post 1140891)
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

mikets 08-03-2012 17:48

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
My impression is that GetStatus is a LabView thing not for WindRiver C++.

jhersh 08-03-2012 19:07

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
Quote:

Originally Posted by mjcoss (Post 1141114)
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 (Post 1141140)
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.

jhersh 08-03-2012 19:10

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
Quote:

Originally Posted by mjcoss (Post 1141114)
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()


mjcoss 12-03-2012 19:24

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

6xpoppy 13-03-2012 14:56

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

Ether 13-03-2012 15:24

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
Quote:

Originally Posted by 6xpoppy (Post 1143657)
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.

Would you mind just posting them here as a ZIP attachment?



NotInControl 05-04-2012 00:48

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
Quote:

Originally Posted by vamfun (Post 1116054)
Funny, I always though it was the other way around. The Z-N methods were ment for guys that didn't understand control theory. The cookbook method was a way a plant manager could get his plant under control if he was unable to model the dynamics and apply control theory. The PID is a similar device.

Anyway, I took a look at your video and code. You did a great job and I wish our team had the capability. We are using C++ and I have longed for that data/plotting capability to tune the PID loops. I know teams like 254 have used a similar data loging scheme that reads the data bus and plots it using a custom LV GUI. Have you done any of this with C++ or can you offer some suggestions on the best way to set PID constants on the DS , send them to the robot and retrieve the sensor data and display it.


This year for our team we used Java... and with the help of the SmartDashbaord I have created a GUI for PID tuning that I used on our 2012 bot. Since We were running our own custom PID controllers on the CRIO this was very helpful.

So while I haven't done it with C++ per se, the code in java and the smartdashboard can help you get similar functionality.

I also worked on a new tutorial for tuning gains, using Matlab and Simulink, in order to get a more accurate controller. The method of tuning is the same as in my original video, but the method for modeling is different.

In the previous videos modeling of the plant was done using parameters provided by the datasheets of the motor and physical modeling techniques. However, there is always error between the model and the apparatus because of parameter mismatch.

The new method is based on taking measured data by running the actual system and logging to the file its performance to a step response, and using that data in matlab to perform parameter estimation. The estimated system is a far better realization of the plant model and allows for a more accurate controller design the first time around.

I am trying to find the time to post all this stuff, its just been hard. - My apologies

gpetilli 29-10-2013 17:02

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
1 Attachment(s)
I had the same idea of predicting the step response. Attached is my cut at estimating PID values of the drive train UNDER LOAD (without risk of crashing into walls). I have not tried this on the actual robot yet, but it will hopefully be a good starting point.

I have updated the post with a new excel to correct some typos

gpetilli 31-10-2013 15:24

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
1 Attachment(s)
1) Updated with PID in either robot FPS or motor RPS.
2) Improved wheel slip to use either static or kinetic friction based on previous state.


All times are GMT -5. The time now is 00:51.

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