![]() |
Auto trimming using the gyro
So this summer I have decided to work on programming challenges that would make our team more competitive during the FIRST season but that wouldn't necessarily have time to do during the first season.
One problem I'm trying to tackle is how can I use the gyro deg/sec output to calibrate a realtime auto trim for out robot. We have a mechanum system btw. I think I really only need to trim the z axis (rotation) so the accelerometer wouldn't be used. I need to figure out the correct formula to modify the z joystick value based on the gyro input and the current z axis joystick input (as if I were turning). Does anyone have any ideas as to how to do this? |
Re: Auto trimming using the gyro
Quote:
a) you want the vehicle to rotate at a speed proportional to the z-axis command when the z axis command is non-zero, and b) when the z-axis command is zero, you want to use the gyro to hold the vehicle's rotational orientation fixed regardless of X and Y motion. is that correct? If not, please explain in more detail what you are trying to accomplish. ~ |
Re: Auto trimming using the gyro
Quote:
I hope enough of that makes sense to give you a place to start. |
Re: Auto trimming using the gyro
Quote:
You could try the following simple approach, which is similar to what Team 341 (Miss Daisy) used successfully: Code:
if (Z!=0) Z'=Z else Z'=-K*gyro_rate;Z is the joystick value from its "rotate" command axis Z' is the modified value of Z gyro_rate is the rotation speed reading from the gyro K is a tuning constant, which you can adjust experimentally. what the code does is this: a) when you are commanding rotation (Z is not zero), your rotate command (Z) is passed through unmodified as an open-loop command b) when you are commanding zero rotation (ie Z is zero), the gyro's rotation signal is used instead of Z=0 to create a Z command to cancel out the rotation. A slightly different approach might be: Code:
Z' = K*(Z-gyro_rate);~ |
| All times are GMT -5. The time now is 11:08. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi