Re: Lowpass compass filter and highpass gyro filter
This link was posted by scb in the NXT Segway topic you can find below.http://scb.netsons.org/files/robotcBR.zip
For the lowpass filter of the compass sensor: my proposal is an "intelligent" filter that takes into consideration the physical properties of the NXT robot. The filter shall maintain an internal state that represents the robot's angular momentum, maybe even a second internal state value for the angular acceleration.
You will have two sources for the robot's angular position:
1. you can make a calculation, based on the internal state values and the control outputs your program sent to the motors
2. you have a measured value from the compass sensor.
Before processing the compass sensor value, you can check if the measurement is within a "credibility range." If it was not, you shall throw away the measured value. If it was creadible, you can achieve the next estimation of the robot's angular position (and the internal state values) by a weighted average of the measured and the calculated values.
Such a combination of measured and calculated values are frequently used in automotive industry. E.g. the ABS/ARS follows wheel rotation and maintains an estimated speed of the car. Should a wheel's rotation abruptly change it is considered as a slip that initiates ABS/ARS intervention.
Sophisticated navigation systems achieve an exact position of the car even when GPS reception is weak (e.g. high buildings, tunnels, underground garage etc). They combine GPS signal with acceleration and gyro sensor signals (and also wheel rotation signals).