Go to Post Everyone together now, say 'thank you'. - ebarker [more]
Home
Go Back   Chief Delphi > Technical > Technical Discussion
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 19-01-2015, 21:39
alopex_rex's Avatar
alopex_rex alopex_rex is offline
Rainbow Professionalism Dash
AKA: Scott Morton
FRC #0830 (The RatPack)
Team Role: Alumni
 
Join Date: Dec 2014
Rookie Year: 2012
Location: Ann Arbor, MI
Posts: 92
alopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond repute
Trouble with ADXRS453 Gyro

This year we're trying to use an ADXRS453 gyro on our robot. (With this eval board.) Yesterday we wired it up and managed to communicate with using the WPILib SPI class. We simply read the sensor data every time TeleopPeriodic was called, and integrated the results to get a measure of our heading. This worked extremely well, as in, the heading would not change at all while the gyro was sitting still, and changed as we would expect it to when we rotated it.

Then we go to work with it today, without changing the program, and it drifts like crazy. (Like, a degree every couple of seconds.) We wrote code to try and compensate for it, by sampling the rate for a couple seconds while it's still, and the values still oscillate and drift while the gyro is sitting still.

In another thread, members of several teams said they had used this gyro with success. Any idea what's going on? Any wisdom you can share about how to work with it?
__________________
Ratpack programming lead 2013 - 2015

ἔκλαγξαν δ᾽ ἄρ᾽ ὀϊστοὶ ἐπ᾽ ὤμων χωομένοιο / αὐτοῦ κινηθέντος: ὃ δ᾽ ἤϊε νυκτὶ ἐοικώς. (Ancient Greek nerds unite!)
  #2   Spotlight this post!  
Unread 19-01-2015, 21:47
thatprogrammer's Avatar
thatprogrammer thatprogrammer is offline
Registered User
AKA: Ahad Bawany
no team (None)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: Florida
Posts: 610
thatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond reputethatprogrammer has a reputation beyond repute
Re: Trouble with ADXRS453 Gyro

Posting your code would help.
  #3   Spotlight this post!  
Unread 19-01-2015, 21:50
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,533
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: Trouble with ADXRS453 Gyro

Please post your code as you go. We've got a couple of these gyros on the way as well, and are curious as to how to go about computing bias, etc.
  #4   Spotlight this post!  
Unread 19-01-2015, 22:11
alopex_rex's Avatar
alopex_rex alopex_rex is offline
Rainbow Professionalism Dash
AKA: Scott Morton
FRC #0830 (The RatPack)
Team Role: Alumni
 
Join Date: Dec 2014
Rookie Year: 2012
Location: Ann Arbor, MI
Posts: 92
alopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond reputealopex_rex has a reputation beyond repute
Re: Trouble with ADXRS453 Gyro

As of this posting, a little bit out of date, (also generally rough) but here you go:
https://github.com/FRC830/2015Robot/tree/master/util

ADXRS450Gyro.h and ADXRS450Gyro.cpp are the relevant files. The ADXRS450Gyro::Update() function gets called in TeleopPeriodic.
__________________
Ratpack programming lead 2013 - 2015

ἔκλαγξαν δ᾽ ἄρ᾽ ὀϊστοὶ ἐπ᾽ ὤμων χωομένοιο / αὐτοῦ κινηθέντος: ὃ δ᾽ ἤϊε νυκτὶ ἐοικώς. (Ancient Greek nerds unite!)
  #5   Spotlight this post!  
Unread 07-02-2015, 12:03
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: Trouble with ADXRS453 Gyro

I took the previous posters code and improved it a bit - the drift is more than acceptable.

https://github.com/FRC1296/RHSRobot2.../ADXRS453Z.cpp

Enjoy
__________________
Fast, cheap or working - pick any two!
  #6   Spotlight this post!  
Unread 07-02-2015, 19:31
duane's Avatar
duane duane is offline
Registered User
FRC #0701 (RoboVikes)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2003
Location: Vacaville
Posts: 98
duane is an unknown quantity at this point
Send a message via AIM to duane
Re: Trouble with ADXRS453 Gyro

Thank you for sharing the code for the gyro. A couple of comments:

You used a Task and Timers rather than a notifier. Seems like a notifier could make the code easier, but there are also two timers which indeed complicate a bit. Are two timers needed? I'd have to read closer to work it out.

The floating point values are floats instead of doubles. Any particular reason? I'm used to thinking of doubles as being just fine for most uses. WPI Lib seems to use doubles everywhere.

The float values are being updated from a task and read from the robot loop. I think a mutex is needed to protect the values being read. Keep in mind that this year, we really do have multiple processors which means we should pay attention to atomic operations. I don't think a double or float is atomic.

This should be great for us to get going with the gyros.

I'll be happy to contribute to any changes we make.

...Duane
ps Gotta luv github!
__________________
Duane Murphy
Mentor - Software
Vanden Vikings FIRST Team 701
http://www.vandenrobotics.com
  #7   Spotlight this post!  
Unread 08-02-2015, 18:32
wireties's Avatar
wireties wireties is offline
Principal Engineer
AKA: Keith Buchanan
FRC #1296 (Full Metal Jackets)
Team Role: Mentor
 
Join Date: Jan 2006
Rookie Year: 2004
Location: Rockwall, TX
Posts: 1,170
wireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond reputewireties has a reputation beyond repute
Send a message via AIM to wireties
Re: Trouble with ADXRS453 Gyro

Quote:
Originally Posted by duane View Post
Thank you for sharing the code for the gyro. A couple of comments:
no problem

Quote:
Originally Posted by duane View Post
You used a Task and Timers rather than a notifier. Seems like a notifier could make the code easier, but there are also two timers which indeed complicate a bit. Are two timers needed? I'd have to read closer to work it out.
I did not change the original code all that much. The changes you recommend make sense. One could use a single timer for both the calibration and update functions. I've not used a WPI notifier yet. Is it a wrapper for a counting semaphore? The gyro started working right and I wanted to get it to the students to work on their autonomous behaviours.

Quote:
Originally Posted by duane View Post
The floating point values are floats instead of doubles. Any particular reason? I'm used to thinking of doubles as being just fine for most uses. WPI Lib seems to use doubles everywhere.
I did not think the precision was necessary. One can only "point" the robot with a certain amount of accuracy anyways. Doubles will work.

Quote:
Originally Posted by duane View Post
The float values are being updated from a task and read from the robot loop. I think a mutex is needed to protect the values being read. Keep in mind that this year, we really do have multiple processors which means we should pay attention to atomic operations. I don't think a double or float is atomic.
Floats are atomic as they are word-sized on a 32-bit machine. But a more portable implementation would protect the data - good idea.

Quote:
Originally Posted by duane View Post
This should be great for us to get going with the gyros.

I'll be happy to contribute to any changes we make.
good luck!

adding averaging would be nice

Quote:
Originally Posted by duane View Post
ps Gotta luv github!
ditto
__________________
Fast, cheap or working - pick any two!

Last edited by wireties : 08-02-2015 at 18:33. Reason: spelling
  #8   Spotlight this post!  
Unread 17-03-2015, 15:29
orangelight's Avatar
orangelight orangelight is offline
Registered User
AKA: Alex
FRC #0548 (Robostangs)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Northville
Posts: 168
orangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to beholdorangelight is a splendid one to behold
Re: Trouble with ADXRS453 Gyro

Does anyone have the source code for java?
__________________


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


All times are GMT -5. The time now is 00:57.

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