The rotation angle could be derived from the rotation velocity as per formula as,
Angular rotation = Angular Velocity * Time
This angular velocity is useful for short term range. On the other side, the accelerometer is better for long term range. The complementary filter has high pass weight on angular rotation derived from angular velocity, and low pass weight on rotation derived from accelerometer data. Pitch and roll data in the complementary filter are given as,
pitch = (pitch+gyro_x*dt) *0.5+pitch_acc*0.5
roll = (roll+gyro_y*dt) *0.5+roll_acc*0.5
コメント