Reading the gyroscope in Python
In this section, we are going to use the gyroscope in the IMU. We will use it to approximate where the robot is facing in three dimensions.
But before we do that, let's understand it.
Understanding the gyroscope
A gyroscope measures rotation as a rate of change in angle, perhaps in degrees per second. At each measurement, it can determine the speed of rotation around each axis:
A gyroscope is traditionally a mechanical system, as shown in the preceding image. It has a gimbal – a set of concentric rings – connected by pivots so that they can pivot around the X-axis, Y-axis, and Z-axis. The middle has a spinning mass, known as a rotor. When the rotor is spinning, moving the handle (shown as a stand at the bottom of the image) does not affect the spinning mass, which keeps its orientation, with the gimbals allowing it to turn freely.
In the case...