![]() |
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? |
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). |
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. |
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. |
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! |
Re: Manual Velocity PID, anyone successful?
Quote:
Anyone feel like helping point us to a sample? |
Re: Manual Velocity PID, anyone successful?
that yaw correction w/ gyro is a really good idea... i think i may try this!
|
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. |
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.
|
Re: Manual Velocity PID, anyone successful?
Quote:
Now be quiet and tune your loops. ;) |
Re: Manual Velocity PID, anyone successful?
Quote:
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! |
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?
|
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 |
Re: Manual Velocity PID, anyone successful?
Quote:
control /= 4; with: control >> 2; But that's about it - otherwise it works. |
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 |
| All times are GMT -5. The time now is 14:10. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi