Quote:
Originally Posted by Ether
You don't want the (corrected) gyro angle in the range -360 to +360 ... you want the corrected gyro angle in the range -180 to +180, with zero being your starting position.
|
This should do the trick:
Code:
double corrected_angle(double Angle){
return Angle + 360*floor(0.5-Angle/360);
}
Then use setpoint=0 and process_variable = corrected_angle as inputs to a PID controller.