Quote:
Originally Posted by GuyM142
I'd like to use a sensor to measure [angle, relative to ground]. I don't know whether to use a gyro or an accelerometer to do that.
|
I think the answer is either one, though in different cases. The "best" approach would be to use both and combine the information from both sensors using a filter. This is probably overkill for what you're doing, though.
In general, over short periods of time (seconds to a couple of minutes) gyros are good sensors for measurement of angle. They're differential sensors (they only measure
change in angle), though, so they suffer from two disadvantages: 1. they're susceptible to accumulated error and 2. you have to set the initial angle through some other means.
Accelerometers are somewhat complementary to gyros. As [Ether] says, you can get an absolute measure of angle relative to the local gravity vector, but this only gives a good reading when the sensor is not otherwise accelerating (practically, this means when the sensor is stationary) - under other conditions, the reading has noise introduced into the reading by the other accelerations. If the angle being measured isn't changing too quickly, and the system isn't under a constant acceleration, you can get a better measure by averaging the angle reading over time, and all the transient accelerations will more or less cancel out. This is called low-pass filtering.
Kalman filters and complementary filters work by essentially combining these two sources of data in ways that allow each to counteract the other's short-comings, creating a better estimate of the current angle.
Since you're probably only interested in tracking the angle for a few seconds and you can start with the knowledge that the robot is flat on the floor,
(tl;dr) the gyro is probably the best sensor for your application.
P.S. Another approach would be to use distance sensor(s) (I would probably use infrared) pointed downwards from the bottom of your chassis to measure the distance from the ground, which you could then use to get an estimate of the robot angle.