Thread: Compass sensor
View Single Post
  #4   Spotlight this post!  
Unread 13-01-2010, 07:56
M.Rehberg's Avatar
M.Rehberg M.Rehberg is offline
Registered User
AKA: Mike Rehberg
FRC #2619 (The Charge)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2008
Location: Michigan
Posts: 11
M.Rehberg is an unknown quantity at this point
Re: Compass sensor

Our team used (tried to use) a compass last year. It actually did work, but as the previous post described, they can be sensitive to motors and metal. If you use one I would suggest using it to check your heading, but use the gyro to control. The gyro with the integrator provided by the cRIO is very good, and didn’t seem to lose precision through these relatively short matches.

If you still have interest in a compass, here is basically how it worked:

They started with a mems compass mounted on a breakout board from SparkFun.com The output is I2C, which the FIRST cRIO has on the digital sidecar, but we couldn’t find what we needed in the libraries to use it. So the team used an Arduino (which is an ATmega168 programmed with C), which could talk to the compass on the I2C buss, then sent an analog 0-5 volts to the cRIO that translated to 0-359 degrees. They also had to set a digital output to tell the Arduino to put the compass in calibration mode, then the robot went into a 720 degree spin. This addition seem to help quite a bit, but as I said above, they ended up using a gyro.

The learning experience with the Arduino, and I2C was great, and there is also a lesson in the difference of how well something looks on paper Vs in practice…
__________________
Mike Rehberg

Team 2619
Midland, MI