mirror of
https://github.com/AtsushiSakai/PythonRobotics.git
synced 2026-04-22 03:00:22 -04:00
Update the pi_2_pi function to a use of a modulo instead of two while.
This commit is contained in:
@@ -61,13 +61,7 @@ def PIDControl(target, current):
|
||||
|
||||
|
||||
def pi_2_pi(angle):
|
||||
while (angle > math.pi):
|
||||
angle = angle - 2.0 * math.pi
|
||||
|
||||
while (angle < -math.pi):
|
||||
angle = angle + 2.0 * math.pi
|
||||
|
||||
return angle
|
||||
return (angle + math.pi) % (2*math.pi) - math.pi
|
||||
|
||||
|
||||
def solve_DARE(A, B, Q, R):
|
||||
|
||||
Reference in New Issue
Block a user