Go to Post I want to take a moment to thank every single FIRST mentor on behalf of all the FIRSTers (students) out there, for giving us the best we can get. - Arefin Bari [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 29-12-2003, 18:12
TheMightySteve2's Avatar
TheMightySteve2 TheMightySteve2 is offline
Registered User
#0484
 
Join Date: Dec 2003
Location: Haverford
Posts: 1
TheMightySteve2 is an unknown quantity at this point
Send a message via ICQ to TheMightySteve2 Send a message via AIM to TheMightySteve2 Send a message via MSN to TheMightySteve2 Send a message via Yahoo to TheMightySteve2
Arrow Gyroscopes

hey. can someone give me a example of the code for useing a gyro in C lanuage and a diagram on how to hook everything up? thanks alot in advance
__________________
www.stephenslinks.com
  #2   Spotlight this post!  
Unread 30-12-2003, 15:08
echos's Avatar
echos echos is offline
Jack of all trades
#1125
Team Role: Programmer
 
Join Date: Dec 2003
Location: San Diego, CA
Posts: 61
echos will become famous soon enough
Send a message via ICQ to echos Send a message via AIM to echos Send a message via MSN to echos Send a message via Yahoo to echos
Re: Gyroscopes

First of all I would like to know what kind of gyro it is, weather it be a helicopter gyro that outputs PWM signals or more an analog gyro.
  #3   Spotlight this post!  
Unread 31-12-2003, 00:44
Anthony Kesich's Avatar
Anthony Kesich Anthony Kesich is offline
Programmer Turned Engineer
AKA: SonKenshin
#1097 (Site 3 Engineernig)
Team Role: Leadership
 
Join Date: Jan 2003
Rookie Year: 2003
Location: Sacramento, CA
Posts: 186
Anthony Kesich has a spectacular aura aboutAnthony Kesich has a spectacular aura about
Send a message via AIM to Anthony Kesich
Re: Gyroscopes

one piece of advice, before bringing up something that is not completely obscure, search the forums and also just go the the appropriate forum and make sure to change the start date from one week to one year or something along those lines. here's one forum on gyroscopes and C and the like:
http://www.chiefdelphi.com/forums/sh...ad.php?t=23071
__________________
C is screwing up my English--I'm ending all my sentences in semi-colons;

Horray for most things! -George Carlin

"Sure, I'll play rugby. Besides, I have a lot of experience running from really big guys who want to cream me." -Me, Freshman year
  #4   Spotlight this post!  
Unread 01-01-2004, 02:00
KevinB's Avatar
KevinB KevinB is offline
Registered User
AKA: Alum
no team
Team Role: Alumni
 
Join Date: Dec 2002
Rookie Year: 2001
Location: AL
Posts: 188
KevinB will become famous soon enoughKevinB will become famous soon enough
Send a message via ICQ to KevinB
Re: Gyroscopes

Quote:
Originally Posted by echos
First of all I would like to know what kind of gyro it is, weather it be a helicopter gyro that outputs PWM signals or more an analog gyro.
It is in fact an analog gyro. Its output is simply a voltage between 0-5V and can be read via an analog input pin on the robot controller.
  #5   Spotlight this post!  
Unread 01-01-2004, 11:44
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: Gyroscopes

what do you want to do with it? the output from the solid state gyro (the yaw rate sensor) that FIRST supplies with the kit puts out a signal that is proportional to the turn rate, in degrees per second.

you can use that signal directly if you are closing the loop on the steering - if you want your robot to steer precisely and responsively, have your code read the command from the drivers joystick tell you how fast he wants the bot to turn, then read the output from the yaw rate sensor telling you how fast the bot actually IS turing - the difference between the two is the error signal - you can use it to control the power to the motors (instead of using the joysitck signal)

another thing you can do with the yaw rate sensor is create a compass heading - since the signal is degrees per second, if you add the signal (adjusting for the 127 offset being zero) to a 16 bit register on every loop of the code, what you are doing is integrating the signal over time

the results is seconds * degrees / second = degrees. If you start the 16 bit register off at 32000, with the bot pointing in the same direction when you turn it on, then while the robot is running if it turns one way, that register will have positive numbers added to it, so it will increase - turn the other way and the register goes down - so you can tell relatively which way your robot is pointing all the time and how far it has turned since you turned it on (initialized the 16 bit register)

to get the actual angle dont waste your time dividing by constants - test your bot with the code running - turn it 45° and see what the register reads - turn it 90, 180...360 in both directions

you will be amazed at how simple this is and how well it works - the only thing you need to keep an eye on is to make sure you dont have too much code running so that the amount of time it takes to run one complete loop (through your code) stays fairly consistant.

you want that sensor input read at fixed intervals, every 7ms or every 30ms... whatever - it doesnt really matter what the interval is, as long at its consistantly the same - you calibrate the interval out when you turn the robot and seeing how much the register 'count' changes.

Last edited by KenWittlief : 01-01-2004 at 11:51.
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
Gyroscopes Mike375 Technical Discussion 1 17-10-2001 23:04


All times are GMT -5. The time now is 19:59.

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