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)

Mr. Lim 14-01-2012 08:26

2012: Tuning the Jaguar's Speed Control PID Loop
 
There is a lot of background information here:

http://www.chiefdelphi.com/forums/sh...ad.php?t=90508

I am continuing this discussion in a new thread for the 2012 season, and would like to limit it to the specific methodologies you've used to tune your JAGUAR'S Speed Control PID Loop, and its pros/cons.

Method 1:
Use P-Only control, and tune the P constant until you achieve a stable loop at 50% of your setpoint. Leave I and D as ZERO. Do not touch them, do not pass go, do not collect $200. Now set your setpoints at TWICE the magnitude you actually desire. Profit.

Pros:
Simple to tune, and gives you a stable response.

Cons:
Far from ideal response. You will likely have offset and/or oscillations around your 50% target. You cannot take advantage of I or D because they depend on P being able to take to your setpoint.

Ether 14-01-2012 10:08

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
Method2: Use a PI control, and tune the I gain the way you would "normally" tune the P gain. Then tune the "P" gain the way you would "normally" tune the D gain.

Why? Because the drivetrain plant does not contain an integrator when the input to the plant is voltage and the output (that you are trying to control) is speed.

Mr. Lim 14-01-2012 22:54

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
We did a fair amount of work with Method 2 today as proposed by Ether.

We obtained fairly stable results, and would argue that they are overall better than Method 1.

There appears to be a major weakness with Method 2 however.

The I-term appears to be capped. Theoretically, even a small I-term should cause the speed control loop to reach its setpoint eventually. It might take a long time, but it should reach the setpoint, given enough time.

It does not.

What we're seeing is the maximum speed we can achieve is directly proportional to the I constant.

This is unfortunate, because we have been able to find some I-constants which appear to work beautifully, however since the I-term is capped, we can never quite achieve our top speed.

Capping the I-term is usually a great way to ensure our PIDs don't wind up too much, however in this case, it's inhibiting us from ever getting to our top speed.

Mr. Lim 16-01-2012 06:39

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
After another day of working on this...

I'm back to my opinion from 2011:

The Jaguars desperately need a Feed-Forward implementation in its speed control PID loop.

Everything else we've tried has seemed like a messy workaround which just won't give us as tight control as we want for either our drivetrain or shooter.

Are there any active Jaguar firmware developers from TI who are on ChiefDelphi who we can reach out to?

Right now, this feature is a) what is stopping me from recommending the Jags to our area's mid to upper tier teams, and b) a pretty standard speed control feature, which should be included in any speed PID controller worth its weight.

NotInControl 18-01-2012 00:02

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
Hello all, I am the Control System Engineering for Team 2168 the Aluminum Falcons.

Its going to be very hard to lock down a method of tuning the PID gains without fully understanding the implementation of the Controller in the Jag.

No two PID implementations are equal, and depending on weather the PID controller is an Ideal, Series, or Parallel implementation greatly affects how to go about tuning them.

For example, in the ideal case changing P has an effect on both I and D, where as in a parallel implementation, each term can be independently tuned.

Does anyone know if this implementation has been made available? Last time I looked the documentation was no where to be found.

I am going to spend more time this season reverse engineering the Jags and understanding the implementation, as my team does use CAN and I would likes to move my control loops off the CRIO... I will post my results.

However in the mean time, I have been working on a complete video walk through to show a simple way to tune the gains of a PID controller using Matlab and Simulink.

All the videos are not up yet, but the most important one is, the video which shows how to tune the gains. The video, m-files and .mdl files, and complete labview project are also available from our team website at:

http://team2168.org/index.php/resour...ntrol-tutorial


The custom PID controller I use is also provided to be used by any team who so desires, all I ask is that you give credit to us, if you do use it. Even though the files are provided in labview, I will soon also provide a Java implementation.

The example in the video covers tuning position control gains but it is easy to extend the method for speed control on your own. In the next few days I will be posting an official walk through for tuning speed control gains as well.

Please check it out, and post any feedback you may have.


-Kevin

Joe Ross 18-01-2012 00:09

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
The jaguar source code is available, but not the easiest thing to find. http://www.ti.com/tool/rdk-bdc24-cd

dyanoshak 18-01-2012 00:18

The code isn't the easiest to find but maybe my post in the aforementioned thread can help:

http://www.chiefdelphi.com/forums/sh...6&postcount=41

gpetilli 18-01-2012 10:08

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

Originally Posted by NotInControl (Post 1108191)
Hello all, I am the Control System Engineering for Team 2168 the Aluminum Falcons.

Its going to be very hard to lock down a method of tuning the PID gains without fully understanding the implementation of the Controller in the Jag.

No two PID implementations are equal, and depending on weather the PID controller is an Ideal, Series, or Parallel implementation greatly affects how to go about tuning them.

For example, in the ideal case changing P has an effect on both I and D, where as in a parallel implementation, each term can be independently tuned.

Does anyone know if this implementation has been made available? Last time I looked the documentation was no where to be found.

I am going to spend more time this season reverse engineering the Jags and understanding the implementation, as my team does use CAN and I would likes to move my control loops off the CRIO... I will post my results.

However in the mean time, I have been working on a complete video walk through to show a simple way to tune the gains of a PID controller using Matlab and Simulink.

All the videos are not up yet, but the most important one is, the video which shows how to tune the gains. The video, m-files and .mdl files, and complete labview project are also available from our team website at:

http://team2168.org/index.php/resour...ntrol-tutorial


The custom PID controller I use is also provided to be used by any team who so desires, all I ask is that you give credit to us, if you do use it. Even though the files are provided in labview, I will soon also provide a Java implementation.

The example in the video covers tuning position control gains but it is easy to extend the method for speed control on your own. In the next few days I will be posting an official walk through for tuning speed control gains as well.

Please check it out, and post any feedback you may have.


-Kevin

I applaud what you are trying to do - as an engineer, I strongly dislike the guess and check method. I downloaded your files, but am getting a "bad link" error in simulink for the PID Controller. I am using version 2008b will all toolboxes loaded. Also, your Matlab model appears to be setup for position, any intent to upgrade for speed mode?

I took a different path to a closed form solution. I am using Team 1640 - Sab-BOT-age Drivetrain Model to predict the step responce for various drive trains, using Astrom's (less overshoot than Ziegler-Nichols) equations to calculate P-I-D then as Either said - loading the calculated D into Jag P, calculated P into Jag I and 0 into Jag D. We are getting reasonable performance on the testbot. We intend to poll the Jaguars for step response data using voltage and PID control and compare results but things always take longer than you expect. This was all done with Excel spreadsheets - which i can share if you like.

nixiebunny 18-01-2012 11:35

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

Originally Posted by Joe Ross (Post 1108196)
The jaguar source code is available, but not the easiest thing to find. http://www.ti.com/tool/rdk-bdc24-cd

I don't see the source code anywhere in that zip file. Lots of PDFs, but no code tree. Is it hidden in one of the application programs or PDFs?

Joe Ross 18-01-2012 11:54

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

Originally Posted by nixiebunny (Post 1108346)
I don't see the source code anywhere in that zip file. Lots of PDFs, but no code tree. Is it hidden in one of the application programs or PDFs?

I told you it's tricky ;-)

Install RDK-BDC24-CD-683\Software\StellarisWare\SW-RDK-BDC24-8264.exe. The code will then be in C:\StellarisWare\boards\rdk-bdc24\qs-bdc24

nixiebunny 18-01-2012 12:14

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

Originally Posted by Joe Ross (Post 1108358)
I told you it's tricky ;-)

Install RDK-BDC24-CD-683\Software\StellarisWare\SW-RDK-BDC24-8264.exe. The code will then be in C:\StellarisWare\boards\rdk-bdc24\qs-bdc24

That would explain why the source files didn't show up on my Mac.

dyanoshak 18-01-2012 12:34

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

Originally Posted by nixiebunny (Post 1108370)
That would explain why the source files didn't show up on my Mac.

I believe you can change the ".exe" extension to a ".zip". It is a self extracting zip file, so by doing this you can manually unzip it.

-David

nixiebunny 18-01-2012 12:44

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
Thanks for the info. It turns out that you have to run the Windows installer program, which builds the source code tree as part of the install process. Typical Windowsness. I carried the file to my Windows box in the workshop and had much more luck.

My day job involves work on telescopes run by Linux computers, so I have gotten used to finding source code without executing an app first.

Ether 18-01-2012 14:01

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

Originally Posted by nixiebunny (Post 1108390)
My day job involves work on telescopes run by Linux computers, so I have gotten used to finding source code without executing an app first.

I suspect I am not the only Windows user who would rather have a ZIP file that I can manually open than an "installer" the actions of which are unknown until it is run. Who knows what it is going to "install" and what settings it will change and whether it is going to need admin privileges etc etc.

EDIT: for Windows users, you can avoid running the "installer" EXE file and instead inspect and then extract (with folder structure) the contents of the "installer" EXE file using the free app 7-zip. Does anyone know of a similar app for Linux?


Ether 18-01-2012 16:37

Re: 2012: Tuning the Jaguar's Speed Control PID Loop
 
1 Attachment(s)
Quote:

Originally Posted by Mr. Lim (Post 1106695)
The Jaguars desperately need a Feed-Forward implementation in its speed control PID loop.

I don't know is this is possible without completely breaking the Jag's comm protocol, but a flexible way to implement that would be updated Jag firmware which supports a second input command to the Jag (in addition to the setpoint) so that the user could use a lookup table or nonlinear equation or other arbitrary processing (based perhaps on open-loop experimental measurements) to create that "feedforward" command.

Until and unless the Jag firmware changes, moving the controller completely out of the Jag allows this flexibility, as some have suggested on other threads. An example is attached.



All times are GMT -5. The time now is 20:24.

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