Go to Post For a good time, call 1-800-GOFIRST - Wayne Doenges [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 12-02-2012, 15:06
cajsc cajsc is offline
Registered User
FRC #4091
 
Join Date: Jan 2012
Location: Dominican Republic
Posts: 4
cajsc is an unknown quantity at this point
using the pid module

good evening

I'm a mentor of a rookie team and everything is going well by now.
But we're trying to use a PID to self-balance the robot in the ramp using a Gyro to do so with no luck.

Can somebody give me an advise for it??

Thanks in advance.
Reply With Quote
  #2   Spotlight this post!  
Unread 13-02-2012, 12:03
baronep's Avatar
baronep baronep is offline
Student President
FRC #2848 (Jesuit All-Sparks)
Team Role: Leadership
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Dallas TX
Posts: 167
baronep is on a distinguished road
Re: using the pid module

Because I could not tell from your post, I am assuming that you have no prior knowledge of PID.

First of all, I would suggest using the accelerometer and not the gyro to balance your robot. Search Chief Delphi or the NI FRC examples to determine how that works, there is plenty of material available.

As far as PID goes, there are several inputs to that you must provide in order to get an output. Fist is the process variable, this is the sensor reading (filterer, scaled or unfiltered. You just have to experiment to figure out which gives you the cleanest results). Then you have the setpoint which is the value that you want your process variable to go to. Make sure that any scaling that you do to the PV (process variable), you also do to to setpoint. Then you have something along the lines out output range which is generally [-1,1] or [0,1], depending if you want your motor to run backwards to slow itself down. (You would probably want [0,1].

Then the most interesting part, the PID gains. You need to create a cluster control or constant which then has 3 inputs. The P, I and D coefficients. Changing these coefficents is known as tuning the PID loop. Search Chief Delphi on how to do this, there is a lot of good advice out there.

Finally, you can use the output of the PID function to control your motor speed.

Honestly the hardest parts of this is A) getting a clean enough input and B) getting the PID gains set correctly. If you find that the gains are at the very bottom of the accepted input values (ex. P=.001 is still unstable), try dividing both the PV and setpoint by 10 or 100. Then you can change P to .01 or .1 respectively. Then go from there.

Hope this helps
Reply With Quote
  #3   Spotlight this post!  
Unread 13-02-2012, 12:25
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: using the pid module

Quote:
Originally Posted by cajsc View Post
I'm a mentor of a rookie team and everything is going well by now.
But we're trying to use a PID to self-balance the robot in the ramp using a Gyro to do so with no luck.

Can somebody give me an advise for it??
.

We are going to try this but have not gotten around to it yet. Is the gyro working by itself? Note that it needs to be mounted vertically (in the X-Z plane) to accomplish your task. Are you using LabView or C++ or Java?

The basic approach is to use the gyro as the feedback (with the level setting as the setpoint) and your wheels as the actuator. Set the proportional gain very low - make sure the robot is moving in the correct direction. Then slowly raise the gain till you get a good rate of closure on the setpoint. Use the D gain for dampening any oscillation you get around the setpoint and the I gain for fine tuning the final position (where the servo settles). I suspect you might need no D gain since weight of the robot itself dampens the servo.

HTH
__________________
Fast, cheap or working - pick any two!
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 11:14.

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