View Single Post
  #7   Spotlight this post!  
Unread 25-01-2015, 00:45
Joshua Sicz Joshua Sicz is offline
Registered User
FRC #2403
 
Join Date: Jan 2014
Location: Mesa, Arizona
Posts: 29
Joshua Sicz is an unknown quantity at this point
Re: Realistic Velocity Calculation

Quote:
Originally Posted by slibert View Post
Just wanted to amplify Greg's point. It's complicated, so will take some focused effort and time, and understanding of the physics and related math.

The process is (a) the gravity vector has to be calculated, and to be done accurately, (b) the gyro and accelerometer data must be fused and filtered. Then (c), that vector is subtracted from calibrated accelerometer data to yield linear acceleration, (d)
rotated to be in "world" coordinates (overcoming pitch/roll effects and rotation), then (e) double-integrated to yield distance-traveled vectors in x and y axes.

In case you're interested, the navX MXP does parts (a-d). Here's a link to some Java code that does the calculations for (b-d) [step a is done in hardware on the navX MXP] so you'll get a feel for the process. In this code (see the setQuaternion() function), the gravity vector is derived from a quaternion (a representation of the orientation of the body which has fused the gyro and accelerometer data). This is then subtracted from the calibrated accelerometer, yielding linear acceleration.

The navX MXP provides this information to the RoboRio, and there are teams discussing on Chiefdelphi using the navX MXP and attempting to do step (e), what you are describing. The standard caveat is that this requires a double-integration (acceleration->velecity->distance) and small amounts of noise and error will quickly compound, so that actual distance that this will be accurate for is something still to be determined.

The next step after that would seem to be (f) fuse the encoder data w/the estimated distance vector, which if done well could potentially increase the quality of the estimate of the distance vector.
Yes, since the beginning of the season our team has been looking for the NavX board but it has been sold out at andymark every time we check. I would love to get one to play around to do what you are saying. Thank you so much for those link they will be very helpful.
Reply With Quote