Some days ago I went to work by motorcycle, and I tested the data logger with the latest software. After exporting the data from Arduino 101 SD card to the PC, I converted it to a CSV file and uploaded on Google Drive using the Google Fusion Tables application. The following is the result.
The data shown in the graphs is taken between 2 points ("start point" and "end point"). GPS position is logged once every second, and it is used to calculate the speed (km/h) and GPS heading angle (North is 0=360 degrees, clockwise positive direction). When GPS position, speed and heading are judged to be reliable, the GPS heading information is used to correct the yaw angle calculated from IMU (Inertial Measurement Unit) acceleration and gyroscope sensors.
Pitch and roll angles are calculated by fusing the data coming from acceleration sensors (3 axis) and gyroscope sensors (3 axis). When acceleration modulus value is close to 1 g (gravity acceleration, 9.81m/s2), it means that the acceleration data is not noisy, therefore it is given maximum priority to it. On opposite, when acceleration signals are noisy, the gyroscope signals have highest priority to calculate instant pitch and roll angles.
In other words, gyroscope signals usually have high priority to calculate yaw, pitch and roll angles. But since they may be affected by an offset error (which leads to an integrated error which is always increasing), it is necessary to correct these information somehow. In my algorithm, I correct the angles long period drift as following:
- Pitch and roll angles are corrected using accelerometer sensors data.
- Yaw angle is corrected using GPS heading angle information.
The latest IMU library can be downloaded here: IMU_library_20160622. The library is about 700 lines of C++ code. It allows to calculate yaw, pitch, angles using acceleration sensors, gyroscope sensors and GPS latitude, longitude and time data. The library contains some calibratable parameters, which should be adapted to each application. I will prepare some documentation (however, the code is already hardly commented).