Some senses for Rino
A dream for roboticists is to always know exactly where his robots are at any moment and in which direction they are travelling. In whatever competition this is essential to plan the best strategy to get the target in the shortest time. Unfortunately, in the real world, this is not so easy. I have already described a method to estimate position without any external reference by odometry, meaning by reading the space traveled by each wheel. This procedure could also be very precise when using high-resolution encoders and wheels with a small contact area with the floor. But, even with a small amount of error for each turn, the precision decreases proportionally with the space traveled since the error is cumulative. This increases the uncertainty circle after several dozens of meters, especially with an irregular floor, where wheel slipping and jumping can occur.
To increase precision in dead reckoning many kind of “sensor fusion” methods are experimented in the time. A very sophisticated one is gyrodometry. This uses a combination of sensors that requires some computation capabilities, for both the microcontroller and the programmer that will write the code. Knowing the absolute orientation may be useful to partially compensate for the errors caused by odometry. A simple and cheap way to measure the bearing is by using a digital compass. This kind of sensor is very popular since a long time, becoming easy to find, cheap enough and with a lot of code examples available on the net in every programming language. The most used digital compass for this kind of applications is CMPS03. This sensor can be interfaced in different ways; the best one in our environment is I2C interfacing. This method makes easier to drive the compass for all of its features.
The bearing value can be read in a two byte variable with a theoretical resolution of 0.1 degrees (from 0 to 3599, meaning 359.9 deg) much more higher than the real precision. The calibration procedure can be started with a specific command even with an automatic sequence that turns 90° by 90° the robot in order to perform the routine without operator intervention. The calibration, as described in the manual, is very important and must be executed at least once after the installation to obtain the right precision from this sensor. It compensates some of the close environment static magnetic fields and corrects the reading for the inclination of your own site. Look at this page to understand how the main magnetic field inclination varies in the world. For a correct usage of the values returned by the compass we have to keep in mind that this electronic device uses exactly the same physics of a regular magnetic needle compass, with all the pros and cons. The compass must be kept parallel to the floor to avoid the reading of the vertical axis component of the earth magnetic field too. There are some digital compasses tilt compensated with a three axis magnetic sensor and a three-axis accelerometer to avoid this effect in a given range (a sort of an electronic version of the gimbals used on the shipboard compasses) but they are more expensive. It is affected by surrounding magnetic fields, often very much stronger than earth magnetic field, such iron bodies, magnets and magnetic fields generated by electricity. In a usual apartment it can be tricked by metallic pipes, loudspeakers, motors and other kind of disturbs.