Odometry
How to estimate the robot position
Movement
In order to compute the position and the direction of the robot several data must be gatheresd from the sensors. First of all is necessary to get the number of wheel turning form the motors in order to compute the distance that has been covered. With the gyro it is possible to know the relative angle rotation of the robot. These estimations are needed to correct and evaluate the trajectry of the robot.
Gyroscope Enhanced Odometry
The information about the position can deteriorate especially when the robot turns and the angle errors increase, and this is why is necessary to use an accurate gyroscope, to avoid the uncertainty of the turning due to the variations of the terrain or environment conditions.
The variable Heading contains the information about the direction where the head of the robot aims. This variable is updated everytime is called, with the difference of the previous angle the current one. Then this value is used to define the position. $$ heading = previous\_ heading + (previous\_ angle - gyro \rightarrow angle); $$ $$ POS_X = POS_X \cdot cos(HEADING) $$ $$ POS_Y = POS_Y \cdot sin(HEADING) $$