Go to Post I emailed Brandon Martus to have my username changed. It was updated within a day. Champion webmaster at work. - Gregor [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-01-2006, 18:20
Chris_Elston's Avatar
Chris_Elston Chris_Elston is offline
Controls Engineer
AKA: chakorules
FRC #1501 (Team THRUST)
Team Role: Engineer
 
Join Date: Feb 2004
Rookie Year: 2001
Location: Huntington, Indiana
Posts: 750
Chris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond reputeChris_Elston has a reputation beyond repute
Manual Velocity PID, anyone successful?

Has anyone been successful implementing a manual velocity PID for manual driving?

Did you use single or tank drive joysticks?

What worked better for you? Converting your PWM values to a percent based power where 255 = 100%, or just sticking with PWM values.

Did you design two independent PID's for each wheel? Then how did you integrate them together to make the robot drive straight? Did you have something joining your two PIDs together?

Basically, I was wondering if anyone wanted to share their theory if you've ever got this to work.

Seem rather tricky measuring a velocity from encoders, converting to a "PWM value or percent based command", then reading a joystick value, and integrating the encoder feedback two ways for each wheel, then trying to slave them together, and trying to TURN too....confusing control theory....

Anyone want to share?
__________________
Team T.H.R.U.S.T. 1501
Download all of our past robot's source code here:Repository

Favorite CD quote:
"That can't be their 'bot. not nearly enough (if any) rivets to be a 1501 machine." ~RogerR: Team #1369
  #2   Spotlight this post!  
Unread 18-01-2006, 19:31
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

We had an optional PID velocity control mode for our 2005 robot. The drivers didn't like it; they were used to the more direct joystick->motor power control. We never took the time to dial in the PID parameters for the best response, but it worked reasonably well at low speeds.

Our scheme for controlling the left and right sides might be a little unobvious. We actually tracked robot velocity and turn rate as our control and feedback values, and mixed them together in the fashion of a single-joystick system to command the motors. It gave us extremely repeatable autonomous drive paths (alas, we didn't manage to get the camera to choose which path to use before we decided to focus on other strategies).
  #3   Spotlight this post!  
Unread 18-01-2006, 19:48
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

I've had similar experiences.

All of our team's drivers prefer open-loop control for manual driving. Autonomous mode is another beast altogether, but a human driver is one of the better feedback "devices" around for controlling driving.

The only feedback functions that we bother using are:

1) Dynamically shifting between high and low gear on the AndyMark transmission based on RPM and turn rate. Basically, if you're in low gear going more or less straight, shift up when you reach a certain RPM threshold. Thus, when you're flying across the field, you stay in low to get your acceleration then ramp into high when you need it. This method also works well because if you suddenly start pushing, you automatically downshift because the RPM lowers.

2) Drive straightening. If we detect that the driver is trying to go in a straight line (i.e. p1_x is within a tolerance of neutral), we used gyro feedback as the control variable for balancing the motor speeds until our angular velocity was zero. This may or may not be useful depending on how reliable your drivetrain goes in a straight line, but we found it helpful nonetheless. As an added bonus, we found that even if one of our four drive motors died in a match we still drove mostly straight. Just be careful in implementing this, or you'll find that your drive motors will stop turning in a pushing match because they will be trying to slow down to match the other side. It isn't too hard to fix that, however.

Last edited by Jared Russell : 18-01-2006 at 19:50.
  #4   Spotlight this post!  
Unread 18-01-2006, 20:18
Joe Johnson's Avatar Unsung FIRST Hero
Joe Johnson Joe Johnson is offline
Engineer at Medrobotics
AKA: Dr. Joe
FRC #0088 (TJ2)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1996
Location: Raynham, MA
Posts: 2,648
Joe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond reputeJoe Johnson has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

It is my understanding that the Killer Bees (Team 33) do it every year (although I am not sure of the PID or just PI or perhaps P in terms feedback loop structure). I think that their 4 speed transmission more or less had to do everything from pick the gear to set the gas -- the driver joystick was used to set desired wheel speeds.

The Wise and Mighty Zondag once told me that his drivers merely make suggestions as to what the robot should be doing. The Code decides if it thinks the suggestions are any good. If The Code likes what is being suggested it tries to be accommodating, if not, well, that's why they are only suggestions...

Joe J.
__________________
Joseph M. Johnson, Ph.D., P.E.
Mentor
Team #88, TJ2
  #5   Spotlight this post!  
Unread 18-01-2006, 22:30
KenWittlief KenWittlief is offline
.
no team
Team Role: Engineer
 
Join Date: Mar 2003
Location: Rochester, NY
Posts: 4,213
KenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond reputeKenWittlief has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

as an engineer I have to say, a closed loop feedback control system is way more accurate and precise than any human on joystick could ever be.

Humans have eye to hand coordination at best around 1/10th of a second (100mS). The loop in the RC runs about ten times faster than that.

If a PID control robot drives worse than open loop, then something is not right with the control system: slop/backlash in the drive train, faulty sensors, PID gains not set for optimum response.

seriously, try to out calculate your calculator.

The one version of PID control I have seen used very successfully is a solid state yaw rate sensor (gyro chip) used to sense robot turn rate, and using a one joystick control setup. Then its very easy to use the turn rate from the gyro chip to close the loop on steering. This is exceptional when going up ramps and stuff, if your bot trys to turn sideways on the way up, and your driver is pushing the joystick straight, the PID loop will keep it going straight no matter what!
  #6   Spotlight this post!  
Unread 28-01-2006, 18:22
Rick TYler Rick TYler is offline
A VEX GUy WIth A STicky SHift KEy
VRC #0010 (Exothermic Robotics)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Redmond, Washington
Posts: 2,000
Rick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

Quote:
Originally Posted by KenWittlief
The one version of PID control I have seen used very successfully is a solid state yaw rate sensor (gyro chip) used to sense robot turn rate, and using a one joystick control setup. Then its very easy to use the turn rate from the gyro chip to close the loop on steering. This is exceptional when going up ramps and stuff, if your bot trys to turn sideways on the way up, and your driver is pushing the joystick straight, the PID loop will keep it going straight no matter what!
This is exactly what our software team is working on. They've asked me to look around for some sample PID code using the gyro. Our gyro is working (as is the camera), but they haven't integrated everything yet.

Anyone feel like helping point us to a sample?
__________________
Exothermic Robotics Club, Venturing Crew 2036
VRC 10A, 10B, 10D, 10Q, 10V, 10X, 10Z, and 575
  #7   Spotlight this post!  
Unread 28-01-2006, 22:30
Salik Syed Salik Syed is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Alumni
 
Join Date: Jan 2003
Rookie Year: 2001
Location: Stanford CA.
Posts: 514
Salik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud ofSalik Syed has much to be proud of
Send a message via AIM to Salik Syed
Re: Manual Velocity PID, anyone successful?

that yaw correction w/ gyro is a really good idea... i think i may try this!
__________________
Team 701
  #8   Spotlight this post!  
Unread 30-01-2006, 16:04
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

Gyro yaw correction sample pseudocode:
--------
Angular_Vel = Gyro_Value - GYRO_CENTER;
Error = Desired_Angular_Vel - Angular_Vel; // Set Desired to 0 to go straight

Left_Drive += K * Angular_Vel;
Right_Drive -= K * Angular_Vel;

--------

Define K to be a constant somewhere.
The +/- may vary depending on the gyro orientation (upside down) or drivetrain definition of forward.
Also, be sure to check the bounds on your drive motors (final value must be between 0 and 254).
Watch the types (signed, unsigned, char, int) you choose so as not to overflow.
  #9   Spotlight this post!  
Unread 30-01-2006, 18:13
CronosPrime1 CronosPrime1 is offline
Registered User
FRC #0321
 
Join Date: Jan 2006
Location: Hyperspace
Posts: 53
CronosPrime1 is an unknown quantity at this point
Re: Manual Velocity PID, anyone successful?

Honestly, I don't know why everyone does not like the direct joystick to PWM value mapping. All it takes is some driving experience. In the time it takes you to get a program for manual velocity PID working, you could instead become an experienced robot driver. You really could. And you would not clutter up unnecessary space on your robot controller. And you would save yourself many headaches. If there is some specific time when you need slow and precise control (say, for making a ramp when it is being cluttered by the two other robots), you could implement a half-velocity switch - press a switch, and the joystick inputs are reduced by half.
__________________
  #10   Spotlight this post!  
Unread 30-01-2006, 19:35
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Manual Velocity PID, anyone successful?

Quote:
Originally Posted by CronosPrime1
Honestly, I don't know why everyone does not like the direct joystick to PWM value mapping. All it takes is some driving experience. In the time it takes you to get a program for manual velocity PID working, you could instead become an experienced robot driver. You really could. And you would not clutter up unnecessary space on your robot controller. And you would save yourself many headaches. If there is some specific time when you need slow and precise control (say, for making a ramp when it is being cluttered by the two other robots), you could implement a half-velocity switch - press a switch, and the joystick inputs are reduced by half.
  • We have program memory to burn
  • I doubt anyone can aim their cannon that accurately using straight PWMs
  • Doesn't help you in autonomous
  • If we didn't screw around with PID, we'd be out of a job.
  • What if the driver stayed up a little too late last night and his/her abilities are not showing today?
  • Sometimes, 8-bit resolution just isn't enough
  • If your motors are a little off on one side, your drivers are going to be cursing
  • PID is pimp when done right
  • What about 2/3s velocity? 1/2 can be slow, and you only got 40 seconds before having to go do something else
  • There is a sense of accomplishment when you get through the headaches

Now be quiet and tune your loops.
  #11   Spotlight this post!  
Unread 30-01-2006, 23:17
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

Quote:
Originally Posted by CronosPrime1
Honestly, I don't know why everyone does not like the direct joystick to PWM value mapping. All it takes is some driving experience. In the time it takes you to get a program for manual velocity PID working, you could instead become an experienced robot driver. You really could. And you would not clutter up unnecessary space on your robot controller. And you would save yourself many headaches. If there is some specific time when you need slow and precise control (say, for making a ramp when it is being cluttered by the two other robots), you could implement a half-velocity switch - press a switch, and the joystick inputs are reduced by half.
One word: Intangibles.

A feedback loop will work regardless of battery problems, frictional differences, incidental contact...last year we lost a drive motor and our feedback algorithm compensated correctly so the driver didn't even notice until we got back to the pit!
  #12   Spotlight this post!  
Unread 31-01-2006, 01:11
Rick TYler Rick TYler is offline
A VEX GUy WIth A STicky SHift KEy
VRC #0010 (Exothermic Robotics)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2005
Location: Redmond, Washington
Posts: 2,000
Rick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond reputeRick TYler has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

Yeah, but, writing PID from scratch is hard. Does anyone have some sample code I could show to our student programmers?
__________________
Exothermic Robotics Club, Venturing Crew 2036
VRC 10A, 10B, 10D, 10Q, 10V, 10X, 10Z, and 575
  #13   Spotlight this post!  
Unread 31-01-2006, 09:32
Mike Shaul's Avatar
Mike Shaul Mike Shaul is offline
Registered User
FRC #0065 (Huskie Brigade)
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Farmington Hills, MI
Posts: 53
Mike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant future
Re: Manual Velocity PID, anyone successful?

Here is some basic P control code, let me know if anyone catches an error!

Code:
#define GAIN       10    //This will need to be tuned

u8 p_control(u16 desired, u16 actual)
{
    s16 error, control;

    error = desired - actual;
    control = error * GAIN;
    if( control > 504 )
		control = 504;
    else if( control < -504 )
   		control = -504;
    
    control /= 4;   /* Convert to 8-bits */

    return (u8)(control +127);   /* PWM Output */
}
__________________
By far the best proof is experience. - Sir Francis Bacon
  #14   Spotlight this post!  
Unread 31-01-2006, 09:53
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,078
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Manual Velocity PID, anyone successful?

Quote:
Originally Posted by Mike Shaul
Here is some basic P control code, let me know if anyone catches an error!

Code:
#define GAIN       10    //This will need to be tuned

u8 p_control(u16 desired, u16 actual)
{
    s16 error, control;

    error = desired - actual;
    control = error * GAIN;
    if( control > 504 )
		control = 504;
    else if( control < -504 )
   		control = -504;
    
    control /= 4;   /* Convert to 8-bits */

    return (u8)(control +127);   /* PWM Output */
}
You can replace the line:

control /= 4;

with:

control >> 2;

But that's about it - otherwise it works.
  #15   Spotlight this post!  
Unread 31-01-2006, 09:56
Mike Shaul's Avatar
Mike Shaul Mike Shaul is offline
Registered User
FRC #0065 (Huskie Brigade)
Team Role: Engineer
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Farmington Hills, MI
Posts: 53
Mike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant futureMike Shaul has a brilliant future
Re: Manual Velocity PID, anyone successful?

Also, here is a great article that explains the implementation of a full PID control as well as the behavior of each stage.

PID without a PhD
__________________
By far the best proof is experience. - Sir Francis Bacon
Closed Thread


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

Similar Threads
Thread Thread Starter Forum Replies Last Post
What Makes a FIRST Team Successful? Dr.Bot General Forum 17 23-12-2005 08:45
PID cmd_drive can't drive straight? gnormhurst Programming 4 18-02-2005 01:54
2005 Autonomous Scripting Manual Anthony Kesich Programming 31 17-02-2005 17:30
**FIRST EMAIL**/Important 2005 Competition Manual Information Sscamatt FIRST E-Mail Blast Archive 1 06-01-2005 18:50


All times are GMT -5. The time now is 15:32.

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