Wrap robot angle between -180 and 180
This commit is contained in:
parent
d964cdf9cf
commit
4505d68705
|
@ -59,4 +59,7 @@ void get_inputs(void)
|
|||
|
||||
if(controller.inputs_buffer.buttons_states[BUTTON_R])
|
||||
controller.inputs_buffer.robot_angle -= controller.delta_time_ms / 1000.0f * ANGLE_PER_SECOND;
|
||||
|
||||
if(controller.inputs_buffer.robot_angle > 180) controller.inputs_buffer.robot_angle -= 360;
|
||||
if(controller.inputs_buffer.robot_angle < -180) controller.inputs_buffer.robot_angle += 360;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue