Driving a Motor
We used an IMU to measure the the actual angle of a body connected to the shaft and we compared that to the desired angle that the servo was instructed to rotate to by PWM. It shows that the motor moved about 37 degrees in 0.1 seconds for a speed of ~370°/sec.
Accessing the Digital Motion Processor (DMP)
The DMP balances the noise of accelerator data and the drift of the gyroscope data. Unlike other filters, the DMP is relatively successful in stabilizing the yaw readings. The DMP also performs calculations to convert the raw readings of the accelerator and gyroscope into yaw, pitch and roll angles.
Using a part of the Jeff Rowberg library, we were also able able to calibrate the IMU to its specific offsets for accelerometer and gyroscope data. This enabled faster and more accurate calibration of the IMU.
Testing Motor Control System
Using a breadboard, we initially hooked up the three servos and IMU to the Arduino. We implemented a simple algorithm where the control code would simply drive the servos to whatever angle the IMU output. In the test above, we rotated the IMU a full revolution with respect to yaw. Here, we first noticed problems arising from the yaw values not always stabilizing at zero.