Go to Post Time flies when you're freaking out. - Koko Ed [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 28-03-2014, 18:01
MrHollywood360's Avatar
MrHollywood360 MrHollywood360 is offline
Registered User
FRC #0240 (Tempast)
Team Role: Programmer
 
Join Date: Jun 2012
Rookie Year: 2013
Location: Planet Earth
Posts: 4
MrHollywood360 is an unknown quantity at this point
Gyro for driving straight

Can somebody please provide me with a basic example of how to use a gyro with tank drive to drive straight for a defined encoder distance during autonomous.
Reply With Quote
  #2   Spotlight this post!  
Unread 28-03-2014, 19:04
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,347
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Gyro for driving straight

Quote:
Originally Posted by MrHollywood360 View Post
Can somebody please provide me with a basic example of how to use a gyro with tank drive to drive straight for a defined encoder distance during autonomous.
Examples will be easier to provide if you let us know what language you are coding in.

The basic approach it to add the gyro provided angle, time some gain factor, to one side of the drive and subtract it from the other.

Code:
Psuedo code:

L = L+(Gyro*gain1)
R = R-(Gyro*gain1)
Gain1 is adjusted high enought to correct drift, but low enough to prevent oscillation.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
Reply With Quote
  #3   Spotlight this post!  
Unread 28-03-2014, 19:24
kylelanman's Avatar
kylelanman kylelanman is online now
Programming Mentor
AKA: Kyle
FRC #2481 (Roboteers)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Tremont Il
Posts: 186
kylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to all
Re: Gyro for driving straight

Quote:
Originally Posted by billbo911 View Post
Examples will be easier to provide if you let us know what language you are coding in.
No disrespect but this is the NI LabView forum so I would assume the OP would like a LabView example.
__________________
"May the coms be with you"

Is this a "programming error" or a "programmer error"?


Last edited by kylelanman : 28-03-2014 at 20:11. Reason: typo
Reply With Quote
  #4   Spotlight this post!  
Unread 28-03-2014, 22:16
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: Gyro for driving straight

It's a lot easier to do with Arcade Drive.

Reset the encoder and the gyro before you start moving. Use the gyro angle (multiplied by an empirically determined gain value) as the X axis "turn" input. Put the Gyro Get and the Arcade Drive blocks in a while loop that terminates when the encoder reaches the desired value.
Reply With Quote
  #5   Spotlight this post!  
Unread 29-03-2014, 00:14
lgphoneeric's Avatar
lgphoneeric lgphoneeric is offline
Registered User
FRC #2996 (Cougars Gone Wired)
Team Role: Mentor
 
Join Date: Nov 2012
Rookie Year: 2010
Location: United States
Posts: 68
lgphoneeric will become famous soon enough
We have a gyro on our robot and we mainly use it for auto. We had it do what you wanted, granted it is a mecanum drive but we found it actually slowed us down a lot. I'm not our programmer so i can't help with the program, but i would think about what you really want it for so you don't waste your time. Just my advice. They are wonderful for the right situation. Ours wasn't, but yours might be.
__________________
If you have everything under control, something's about to break.
Reply With Quote
  #6   Spotlight this post!  
Unread 29-03-2014, 01:24
billbo911's Avatar
billbo911 billbo911 is offline
I prefer you give a perfect effort.
AKA: That's "Mr. Bill"
FRC #2073 (EagleForce)
Team Role: Mentor
 
Join Date: Mar 2005
Rookie Year: 2005
Location: Elk Grove, Ca.
Posts: 2,347
billbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond reputebillbo911 has a reputation beyond repute
Re: Gyro for driving straight

Quote:
Originally Posted by kylelanman View Post
No disrespect but this is the NI LabView forum so I would assume the OP would like a LabView example.
No disrespect taken.

I have seen a LOT of posts in incorrect forums and did not want to assume, thus the request.
__________________
CalGames 2009 Autonomous Champion Award winner
Sacramento 2010 Creativity in Design winner, Sacramento 2010 Quarter finalist
2011 Sacramento Finalist, 2011 Madtown Engineering Inspiration Award.
2012 Sacramento Semi-Finals, 2012 Sacramento Innovation in Control Award, 2012 SVR Judges Award.
2012 CalGames Autonomous Challenge Award winner ($$$).
2014 2X Rockwell Automation: Innovation in Control Award (CVR and SAC). Curie Division Gracious Professionalism Award.
2014 Capital City Classic Winner AND Runner Up. Madtown Throwdown: Runner up.
2015 Innovation in Control Award, Sacramento.
2016 Chezy Champs Finalist, 2016 MTTD Finalist
Reply With Quote
  #7   Spotlight this post!  
Unread 21-04-2014, 17:19
Invictus3593's Avatar
Invictus3593 Invictus3593 is offline
time you like wasting is not wasted
FRC #3593 (Team Invictus)
Team Role: Leadership
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Tulsa, OK
Posts: 318
Invictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really nice
Re: Gyro for driving straight

Try searching for 1986 Team Titanium's 2013 Code here on CD. Their 2013 autonomous is a great example of exactly what you're wanting here (and it worked every time).

The "gain" other posters are talking about is calculated with PID and it takes some fine tuning. Tank drive would take a lot more math and headache to get right and you wouldn't have as much control over the turn. Like Alan said, I'd stick with Arcade for this Autonomous if I were you.

EDIT: this is one example of what you're looking for
__________________
Per Audacia Ad Astra

Last edited by Invictus3593 : 21-04-2014 at 17:33.
Reply With Quote
  #8   Spotlight this post!  
Unread 29-02-2016, 09:26
apm4242 apm4242 is offline
Registered User
FRC #4242
 
Join Date: Jan 2013
Location: United States
Posts: 79
apm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud of
Re: Gyro for driving straight

Hello,

If I simply wanted to turn right 60 degrees in autonomous, could I put the arcade drive vi in a while loop and tell it to turn right until the Get Angle vi >= 60?

The idea is to drive for a time, turn 60 degrees to the right, drive some more, and shoot. I wanted to use a flat sequence structure (film strip) with a while loop in the frame that does the 60 degree turn. Would this work?

Thanks!

PS: We don't have encoders.
Reply With Quote
  #9   Spotlight this post!  
Unread 01-03-2016, 20:48
apm4242 apm4242 is offline
Registered User
FRC #4242
 
Join Date: Jan 2013
Location: United States
Posts: 79
apm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud ofapm4242 has much to be proud of
Re: Gyro for driving straight

Quote:
If I simply wanted to turn right 60 degrees in autonomous, could I put the arcade drive vi in a while loop and tell it to turn right until the Get Angle vi >= 60?
To follow up on this - yes, it does seem to work. I'm not sure if it is the absolute best way to do this but it does work. I am using a test bed right now, so I assume the angle will have to be tuned to a little less than the desired 60 degrees to account for robot momentum.
Attached Thumbnails
Click image for larger version

Name:	4242_Auto_Gyro_turn_2016.png
Views:	63
Size:	58.3 KB
ID:	20242  
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 08:02.

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