WebbotLib AVR library
WebbotLib It just does it
C++documentationCdocumentation

Accelerometer

Supports accelerometers.
Accelerometers normally come in either 2 axis, or 3 axis versions. Sometimes you can buy a combo board that contains an accelerometer and, say, a compass. I don't directly support these combos so you need to declare the two individual sensors.
What Are They?
So what do they do? Accelerometers measure acceleration along each of their axes. This could be used to monitor vehicle acceleration, vibrations, and any other kind of movement - after all a movement requires an acceleration!
The axes are normally called X, Y and Z. A two axis device normally provides X and Y, whereas a 3 axis device provides X, Y and Z. Most devices have a small circle on the package to indicate the X axis.
However the actual direction of the axes will depend on how you mount the device onto your robot. The convention is that X axis should be the forward direction of travel, the Y axis is to the right of that, and Z is down. (I think thats correct!)
These devices either use one ADC pin for each axis, or provide an I2C interface but you will need to check the individual data sheets to see what power supply they need. Be careful some of them require a 3.3v supply so connecting them to the usual 5v will fry them!
What Do They Return?
All accelerometers return one value per axis and this value is in 'mG' ie thousands-of-a-G where G is the gravitational constant of 9.8m/s/s. Each value may be positive or negative and a two axis device will set the Z value to zero.
If you decide to swap an accelerometer for a different one then, in Project Designer, delete or disable the old one and then add the new one with the same name and then regenerate your code. Your application code should not need changing at all.
Manual Calibration
Please be aware that the manufacturing tolerances of these devices is not very good. This means that two similar devices may output wildly different values. If you want to achieve a more accurate measurement then you must calibrate the software to match your device. For an explanation of how to do this see calibrate.

Project Designer supports the following devices

Valid XHTML 1.0 Transitional