Go to Post Aaaaah! I think my head just exploded from looking at this awesomeness. You guys are great. This is super cool. :) - Ian Curtis [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 14-01-2012, 08:26
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
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.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
Reply With Quote
  #2   Spotlight this post!  
Unread 14-01-2012, 10:08
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

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.
Reply With Quote
  #3   Spotlight this post!  
Unread 14-01-2012, 22:54
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

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.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
Reply With Quote
  #4   Spotlight this post!  
Unread 16-01-2012, 06:39
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

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.
__________________
In life, what you give, you keep. What you fail to give, you lose forever...
Reply With Quote
  #5   Spotlight this post!  
Unread 18-01-2012, 00:02
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

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
Reply With Quote
  #6   Spotlight this post!  
Unread 18-01-2012, 00:09
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: 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
Reply With Quote
  #7   Spotlight this post!  
Unread 18-01-2012, 00:18
dyanoshak dyanoshak is offline
Registered User
AKA: David Yanoshak
FRC #2158 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Austin, TX
Posts: 190
dyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond repute
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
__________________
David Yanoshak
Co-founder REV Robotics | www.revrobotics.com
Reply With Quote
  #8   Spotlight this post!  
Unread 18-01-2012, 10:08
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by NotInControl View Post
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.
Reply With Quote
  #9   Spotlight this post!  
Unread 18-01-2012, 11:35
nixiebunny nixiebunny is offline
Registered User
AKA: David Forbes
FRC #4183 (Bit Buckets)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2011
Location: Tucson
Posts: 163
nixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by Joe Ross View Post
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?
__________________
--David Forbes
Mentor, Bit Buckets team 4183. Assistant cat herder and dispenser of legendary tales.
Need a Nixie watch? Yes, you do. Ask me.
Reply With Quote
  #10   Spotlight this post!  
Unread 18-01-2012, 11:54
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: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by nixiebunny View Post
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
Reply With Quote
  #11   Spotlight this post!  
Unread 18-01-2012, 12:14
nixiebunny nixiebunny is offline
Registered User
AKA: David Forbes
FRC #4183 (Bit Buckets)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2011
Location: Tucson
Posts: 163
nixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by Joe Ross View Post
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.
__________________
--David Forbes
Mentor, Bit Buckets team 4183. Assistant cat herder and dispenser of legendary tales.
Need a Nixie watch? Yes, you do. Ask me.
Reply With Quote
  #12   Spotlight this post!  
Unread 18-01-2012, 12:34
dyanoshak dyanoshak is offline
Registered User
AKA: David Yanoshak
FRC #2158 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Austin, TX
Posts: 190
dyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond reputedyanoshak has a reputation beyond repute
Re: 2012: Tuning the Jaguar's Speed Control PID Loop

Quote:
Originally Posted by nixiebunny View Post
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
Reply With Quote
  #13   Spotlight this post!  
Unread 18-01-2012, 12:44
nixiebunny nixiebunny is offline
Registered User
AKA: David Forbes
FRC #4183 (Bit Buckets)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2011
Location: Tucson
Posts: 163
nixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond reputenixiebunny has a reputation beyond repute
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.
__________________
--David Forbes
Mentor, Bit Buckets team 4183. Assistant cat herder and dispenser of legendary tales.
Need a Nixie watch? Yes, you do. Ask me.

Last edited by nixiebunny : 18-01-2012 at 13:32.
Reply With Quote
  #14   Spotlight this post!  
Unread 18-01-2012, 14:01
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 nixiebunny View Post
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?


Last edited by Ether : 18-01-2012 at 15:21.
Reply With Quote
  #15   Spotlight this post!  
Unread 18-01-2012, 16:37
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 Mr. Lim View Post
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.

Attached Thumbnails
Click image for larger version

Name:	PID+FF.png
Views:	630
Size:	17.3 KB
ID:	11446  
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:51.

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