View Single Post
  #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