Go to Post I think applying Gracious Professionalism to strictly legal game play trivializes what is a much more important and fundamental FIRST concept. - jimfortytwo [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 25-08-2010, 19:04
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
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?
Reply With Quote
  #2   Spotlight this post!  
Unread 25-08-2010, 19:55
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
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: Auto trimming using the gyro

Quote:
Originally Posted by baronep View Post
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?
what I hear you saying is this:

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.


~
Reply With Quote
  #3   Spotlight this post!  
Unread 26-08-2010, 00:32
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,112
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: Auto trimming using the gyro

Quote:
Originally Posted by baronep View Post
Does anyone have any ideas as to how to do this?
The basic idea is pretty simple. Use the yaw rate sensor to derive a "current heading" measurement value; the gyro support in the library does that for you. Maintain a "desired heading" control value, using joystick input to change the desired value. Tie the two of them together as the feedback and control parameters of a PID system, using the output of the PID as the "rotation" input of the mecanum drive.

I hope enough of that makes sense to give you a place to start.
Reply With Quote
  #4   Spotlight this post!  
Unread 26-08-2010, 10:11
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,015
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: Auto trimming using the gyro

Quote:
Originally Posted by baronep View Post
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?

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);
... which is a "P" (proportional) controller which uses your joystick Z value and the gyro signal to create the modified Z' command. This controller acts to make the robot's sensed rotational velocity match the joystick command regardless of whether it is zero or non-zero.

~

Last edited by Ether : 26-08-2010 at 11:34.
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
paper: Set and display your Auto-Mode using LabVIEW and the Driver Station PhilBot Extra Discussion 0 11-02-2009 12:32
CODE: Using the gyro in autonomous Kingofl337 Programming 1 20-01-2008 19:11
Using auto cad for the autodesk inventor competition [527]phil Inventor 7 18-01-2006 10:41
Is any team using the gyro chip? Ragin_Kage Kit & Additional Hardware 4 10-04-2002 12:11
[white paper] Auto-Balance Gyro Code Brandon Martus Technical Discussion 3 21-06-2001 10:36


All times are GMT -5. The time now is 08:41.

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