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


Supports gyros/gyroscopes.
Gyros normally come in either 2 axis, or 3 axis versions. Sometimes you can buy a combo board that contains gyro and, say, an accelerometer. I don't directly support these combos so you need to declare the two individual sensors.
So what do they do? Gyros measure rotational velocity in degrees per second. This could be used to monitor whether a robot biped is falling over, so that you can compensate, or if measuring the rotation of an axle then, knowing the wheel circumference, you can work out the current speed of the robot.
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.
All gyros return one value per axis and this value is in 'degrees per second'. Each value may be positive or negative and a two axis device will set the Z value to zero.
Assuming you have called the gyro 'myGyro' in Project Designer then:-
// Read the gyro and save the values
// Retrieve the x,y,z values
GYRO_TYPE x = myGyro.getX();
GYRO_TYPE y = myGyro.getY();
GYRO_TYPE z = myGyro.getZ();
// Print them out
cout << "X=" << x << " Y=" << y << " Z=" << z;
// Or dump it out
cout << myGyro;


Project Designer supports the following devices


Valid XHTML 1.0 Transitional