Skip to main content
gamedev.net
🔒 Locked 🤖 Godot

Accelerometer

Started by LilBudyWizer Apr 4, 2009 at 2:38 PM 3 replies 1.7k views
Original Post
LilBudyWizer
LilBudyWizer
I recently bought an accelerometer. My hopes are to use it on the motorcycle to better understand the dynamics of cornering. I have a gps that will lay down tracks at 1hz and a tuner that will record ecm data at 2hz or 8hz to combine with it. Right now I'm trying to understand how to use the accelerometer. The first problem I've run into is the 1g down vector. My understanding is you can't distinguish acceleration due to gravity from acceleration due to motion without an external referance and that's why that is there. The problem is how do you seperate the two? If there were only translations and no rotations then the down vector wouldn't change it could just be subtracted out. Up and down hills, leaning on curves, there's rotation though. I looked around and all I found was a article from the iPhone SDK on using the iPhone's accelerometer. They suggested using a low pass filter for seperating out acceleration due to gravity and high pass for acceleration due to motion. I get the idea of filtering out noise, but I don't get the idea of using a filter to seperate components. I assume the basic idea is that acceleration, velocity and position are all contineous functions in the real world. Then that the acceleration due to motion is more likely to change rapidly than the direction of the down vector. One thought is the accelerometer on the iPhone is mainly used, pretty much, stationary, i.e. you're setting at your desk playing with the phone. You likely can't play those motion based games in an SUV on a mountain twistie. Another is they are limited by processing power and mainly focused on immediate feedback. I'm using a log. I can make as many passes as I please. I can combine in gps and even uSGS topological data. At $90 I could add another one of these devices if it had any practical value. Neither computational complexity nor processing time is really an issue for me. So I'm looking for ideas. That would include both how to process these logs as well as basically experiments to get familar with the device. I mounted it in a box and rotated it various ways at roughly 90 degrees to check it's calibration. I compared that to 0g readings dropping it about 12 feet. I have a little rc car to attach it to and thought I would film it buzzing around to accurately timestamp it. So that and then ideas on how to seperate those components.
Keys to success: Ability, ambition and opportunity.
mzeo77
mzeo77
What you need to realize is that an accelerometer only measures three values, but a freely moving object has 6 degrees of freedom. This means that you will need to make three assumptions to make the equations match.

For instance, you can assume no rotations. Or only rotation in on axis and no acceleration up and down. Or no acceleration and only rotation.

By explicitly assuming three variables and measuring three others you can do most calculations assuming the assumptions are valid. There will probably still be some singularities in the formulas.

By adding another accelerometer on the same frame at some distance you can get another two independent variables. By using three placed in a triangle you can get all 6 degrees of freedom needed for analyzing full movement without any assumptions.

You can also get a gyro for measuring rotations separately.
LilBudyWizer
LilBudyWizer
That helped a lot. I had thought about degrees of freedom, but not in any way that was actually useful. Particularly it occurs to me I should approach it from the other direction. Specifically model it to see what it would look like in an ideal, precisely controlled setting and then compare that to the real world rather than trying to make sense of real world measurements starting out.
Keys to success: Ability, ambition and opportunity.
Dmytry
Dmytry
On motorcycle or bicycle, the acceleration vector is always pointing almost exactly "downward" relatively to the frame of motorcycle. Driver is keeping it this way to avoid flipping over.
Absolute value of this downward acceleration is sqrt(u2/r + 9.8) where u is speed and r is turning radius, 9.8 is gravity .

Taking the gravity out: you can subtract average acceleration (over some seconds time) from current acceleration, mostly eliminating gravity and mis-calibration of accelerometer.
bzroom
bzroom
You can imagine the accelerometer as spring loaded mass with a means to measure the displacement. When the frame that the spring is attached to is resting on the ground, a 1 g acceleration is being applied upward to it from the ground, while a 1g acceleration is being applied to both the weight and the frame from gravity. Since only the spring is combating gravitys acceleration, the displacement of the mass will measure 1g. If both the mass and the frame were in freefall then the acceleration would read zero-g as they are both accelerating at the same rate.

So zero-g really means "i'm only affected by gravity and no additional sources". if you read zero-g on your motorcycle, you're probably going to want to call the ambulance (this is a feature.)

You can just calibrate out the 1g value from gravity, just simply subtract it from readings, assuming that your acceleromter is mounted on a gyroscope :) otherwise the 1g will cross axis as i'm sure you've experienced, as the bike leans.

I'm kinda just babbling but i wanted to make that illustration to you.

I wrecked my bike recently and it took me about a week to figure out what i had done wrong. I really wished i had telemetry to look at. If you get a nice data logger setup, you should a potentiometer on your throttle and at least a digital reading of your brake controls.

Current status of "repair," i'm actually making it street fighter so "repair" is use rather loosely.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.