I am waiting for a new release of robotc. The current release, 2.01, has a bug with structs and floats that prevent me to further implement the Kalman filter I discussed in earlier posts. This gives me time to concentrate on another aspect of the Kalman filter, sensor accuracy.
One of the inputs for the filter is sensor accuracy. In the filter it is refered to as the covariance of the observation noise. This matrix contains sensor errors, in my case it is a compass and a gyro, and the relation between sensor errors, I assume there is no relation between errors in the gyro and the compass.
I do not have information about the sensors. I asked Hitechnic the specs, but they didn’t give it to me. They responded however and pointed out that sensor error is largely affected by the system it is used in (think of vibrations within the robot) and by its environment (think of iron chairs). So to get useful information about the sensor errors I will have to measure it myself.
A good measurement requires to measure just sensor errors within my system. Other sources of variation should be excluded from the measurements. These other sources include environmental disturbances (iron) and true changes in the system (the robot turning). The measurements have to take place in a stable environment. Also, I will have to keep the robot fixed to be sure it doesn’t turn. At the same time I want the vibrations a running robot is generating and I want the robot to activate its motors to measure the disturbances they inflict. These requirements are difficult to combine into one setup.
For the test I put my robot on a small box that fit between the wheels. The wheels were now free-floating and the robot wouldn’t move when the motors were running. This way I lost the vibrations generated by the wheels but I still got the vibrations generated by the motors and gear train. Also I made sure there was nothing close to the robot to disturb the compass. The compass and gyro were sampled every 10 msec and the measurements were sent straight to excel, NXT2excel came in very handy. Excel has functions to calculate the variance of series of measurements, I used the var function. The test included measurements under four different circumstances. Motors off, motors 50% power, motor -50% power and motors 100% power. The sample size for each of these circumstances was 500. Here is a graph of the measurements.
The Graph shows motor power in blue, compass readings in purple and gyro readings in green. The compass gives quite stable readings when no NXT motors are turning, but once the motors are turning a wave pattern appears in the readings. Also when power levels of the motors change there is a spike in the compass readings. The Gyro has little error, therefore its readings are magnified by 10 in this graph. But also here There is influence of the motors, the mean drops and the noise increases.
From this first measurement I conclude that I have to put the compass further away from the motors. It is now mounted on the top front of the vehicle. The gyro isn’t visible on the picture. But you can see a touch sensor just above the rear wheel. The gyro is mounted at the same place on the other side of the vehicle. And, yes, it is mounted upside down. Maybe this also influences the accuracy of this sensor.