Go to Post Must...squish....bugs... :p - nighterfighter [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 24-02-2008, 22:15
Gary Bonner Gary Bonner is offline
Registered User
FRC #3974
 
Join Date: Jan 2002
Rookie Year: 2000
Location: PA
Posts: 120
Gary Bonner has a spectacular aura aboutGary Bonner has a spectacular aura about
Gyro Rate

Is it possible to get the gyro rate in EasyC? Do you just get the analog value, and if so, is that affected by or affect the 20 msec sampling taking place in the background?

Thanks.
  #2   Spotlight this post!  
Unread 25-02-2008, 12:40
TubaMorg TubaMorg is offline
Programmermechanicalelect ricalcoach
AKA: Dan
FRC #1480 (Robatos Locos)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2005
Location: Houston
Posts: 450
TubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond reputeTubaMorg has a reputation beyond repute
Re: Gyro Rate

You are correct, just poll the analog value. Keep in mind that the value you receive isn't truly analog, but the result of the analog to digital conversion. It returns a 10 bit value. To use it you need to find the resting value after the gyro is turned on (wait a second). That is the gyro's center. You also need to figure out the degrees/sec/bit for your gyro. As the value varies from resting value you can convert it to turn rate. So if you look at the spec sheet for your gyro, it will have a spec for mV/degree/sec. Take that along with the max turn rate (80, 150, 300, etc.) and the fact that the 10 bit value is proportional to 5v and you can figure out the turn rate. I'll let you figure out the math..

good luck!
  #3   Spotlight this post!  
Unread 21-03-2008, 20:03
Aerex Aerex is offline
Registered User
FRC #1369 (Minotaur)
Team Role: Programmer
 
Join Date: Mar 2008
Rookie Year: 2004
Location: Tampa
Posts: 9
Aerex is an unknown quantity at this point
Re: Gyro Rate

Regarding this topic I have a similar questions about the gyo

1.) If the gryo's results give a 10 bit value would 1024 represent a 360 degree angle.

2.) Can I take the assumption that the gryoscope uses flat plane of x and y coordinates.

3.) When you start the robot is the value initialized at 0 or at some angle that it captures
a.) if you were to turn a robot backwards would the values be the opposite value (ie. 25 to -25)
__________________
Myspace/Facebook + Academics = NoobsHelp.com
  #4   Spotlight this post!  
Unread 22-03-2008, 08:15
Kingofl337's Avatar
Kingofl337 Kingofl337 is offline
You didn't see anything....
AKA: Adam
FRC #0501 (Power Knights)
Team Role: Mentor
 
Join Date: Feb 2005
Rookie Year: 1998
Location: Manchester, NH
Posts: 861
Kingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond reputeKingofl337 has a reputation beyond repute
Send a message via Yahoo to Kingofl337
Re: Gyro Rate

easyC Pro has natve support for the ADXRS Series of Gyros. Look at the inputs menu and Gyro is on the list. The analog ports are not effected by the 26ms loop.
__________________
FIRST Team 501 PowerKnights - Mentor
FIRST Team 40 Checkmate - Mentor Alum
FIRST Team 146 Blue Lightning - Alumni
  #5   Spotlight this post!  
Unread 22-03-2008, 13:59
Aerex Aerex is offline
Registered User
FRC #1369 (Minotaur)
Team Role: Programmer
 
Join Date: Mar 2008
Rookie Year: 2004
Location: Tampa
Posts: 9
Aerex is an unknown quantity at this point
Re: Gyro Rate

Quote:
Originally Posted by Kingof1337
easyC Pro has natve support for the ADXRS Series of Gyros. Look at the inputs menu and Gyro is on the list. The analog ports are not effected by the 26ms loop
Ok I am bit confused with your comment, does that have anything to do with the questions I have above?
__________________
Myspace/Facebook + Academics = NoobsHelp.com
  #6   Spotlight this post!  
Unread 22-03-2008, 14:11
Dad1279 Dad1279 is offline
Registered User
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: NJ
Posts: 511
Dad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud of
Re: Gyro Rate

Aerex,
You cannot get the angle by reading the analog input only. The gyro outputs an analog value, approx 2.5v when not moving. It will read above 2.5v when rotating clockwise, below counterclockwise.

see page 4 of this data sheet:http://www.analog.com/UploadedFiles/...s/ADXRS300.pdf

If you want the angle, you would need a routine to convert the rate output of the gyro (over time) to get the angle. This has already been done by EasyC/WPILib and Kevin: http://www.kevin.org/frc/
  #7   Spotlight this post!  
Unread 22-03-2008, 14:17
Dad1279 Dad1279 is offline
Registered User
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: NJ
Posts: 511
Dad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud of
Re: Gyro Rate

Quote:
Originally Posted by Aerex View Post
Regarding this topic I have a similar questions about the gyo

1.) If the gryo's results give a 10 bit value would 1024 represent a 360 degree angle.

2.) Can I take the assumption that the gryoscope uses flat plane of x and y coordinates.

3.) When you start the robot is the value initialized at 0 or at some angle that it captures
a.) if you were to turn a robot backwards would the values be the opposite value (ie. 25 to -25)
1) No. See my comments above. 1024 (read from the analog input, not the gyro routine) would represent a rapid clockwise turn.
2) Yes, I suppose so, if it is mounted parallel to the plane of x & y. I do not know the results if mounted on an angle.
3) No. See documentation for Easy C/WPILib or Kevin's routines.

The Gyro output of 0-1024 represents the 'rate of turn' and should return a value of approximately 512 when at rest.

Last edited by Dad1279 : 22-03-2008 at 14:25. Reason: clarification
  #8   Spotlight this post!  
Unread 22-03-2008, 14:40
Aerex Aerex is offline
Registered User
FRC #1369 (Minotaur)
Team Role: Programmer
 
Join Date: Mar 2008
Rookie Year: 2004
Location: Tampa
Posts: 9
Aerex is an unknown quantity at this point
Re: Gyro Rate

I see, so as you mentioned from 0 - 511 would be counterclockwise and 513 - 1024 would be clockwise. But you also said that EasyC has already converted this analog to digital and returns the header, which is the angle correct. So what would the angle rest be when the analog output is 512. I appreciate the time for you to answer my questions.
__________________
Myspace/Facebook + Academics = NoobsHelp.com
  #9   Spotlight this post!  
Unread 22-03-2008, 15:46
Dad1279 Dad1279 is offline
Registered User
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: NJ
Posts: 511
Dad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud of
Re: Gyro Rate

I think we were confusing the topic by talking about the original post question about reading the analog input and gyro rate. Forget about that for now.

Assuming you want an angle, so you can turn x degrees, use the built in Easy C routines. Examples can be found in the help file, and in gyrotest.ecp, which is in the \frc\projects\test code directory. After InitGyro(A) and StartGyro(A) (where A = analog input gyro is plugged into) GetGyroAngle(A) will return an integer which represents tenths of degrees (900=90 degrees clockwise, -900=90 degrees counterclockwise)

Last edited by Dad1279 : 22-03-2008 at 15:49.
  #10   Spotlight this post!  
Unread 22-03-2008, 16:11
Aerex Aerex is offline
Registered User
FRC #1369 (Minotaur)
Team Role: Programmer
 
Join Date: Mar 2008
Rookie Year: 2004
Location: Tampa
Posts: 9
Aerex is an unknown quantity at this point
Re: Gyro Rate

I apologize, I intial thought that the gryo's analog input was in degress but I realize that that is not the case because EasyC convertes the voltage and intergrating the rate to a degree. Sry for the misunderstanding.

Anyway from what you said I am getting that initially the bot would read 0 degrees when starting and if the bot would turn completly 180 from the right it would positive and from the left negative (-180). I have a pic to what I mean
Attached Thumbnails
Click image for larger version

Name:	gryo.PNG
Views:	88
Size:	7.3 KB
ID:	6472  
__________________
Myspace/Facebook + Academics = NoobsHelp.com
  #11   Spotlight this post!  
Unread 22-03-2008, 16:21
Dad1279 Dad1279 is offline
Registered User
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: NJ
Posts: 511
Dad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud of
Re: Gyro Rate

Yes, that should be correct. A few precauctions, when the gyro is initialized, the robot needs to be still/stable for a second. We found that pressing the reset button after the robot is in place helps to get more predictable results. We have also found it possible to turn faster that the gyro can keep up. A rapid turn will not register properly.
  #12   Spotlight this post!  
Unread 22-03-2008, 16:30
Aerex Aerex is offline
Registered User
FRC #1369 (Minotaur)
Team Role: Programmer
 
Join Date: Mar 2008
Rookie Year: 2004
Location: Tampa
Posts: 9
Aerex is an unknown quantity at this point
Re: Gyro Rate

Ok thanks, so if I the bot were to be in autonomus mode I would have to slowing decrease one motor and slowly increase another motor for the gyro to read an angle (turn)
__________________
Myspace/Facebook + Academics = NoobsHelp.com
  #13   Spotlight this post!  
Unread 22-03-2008, 16:49
Dad1279 Dad1279 is offline
Registered User
FRC #1279 (Cold Fusion)
Team Role: Mentor
 
Join Date: Jan 2005
Rookie Year: 2004
Location: NJ
Posts: 511
Dad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud ofDad1279 has much to be proud of
Re: Gyro Rate

Depends how easy your robot rotates. You probably will not need to slowly increase the motors. Just set the PWMs for a moderate turning speed. (not 255 & 1!)
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
Gyro ADXRS150 rate out hinewwiner Programming 2 17-02-2008 11:24
Yaw Rate Gyro Problems RetroKamikaze Programming 3 27-01-2006 20:55
ADXRS150 gyro yaw rate sensor Brian M. Electrical 13 17-10-2004 02:28
ADXRS300EB Rate Gyro rmeenaks Electrical 18 05-04-2004 22:37
ADXRS300EB Rate Gyro rmeenaks Technical Discussion 0 31-03-2004 16:48


All times are GMT -5. The time now is 01:46.

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