Added balancing reacher task and stochastic search task interface

This commit is contained in:
ottofabian
2020-12-07 11:13:27 +01:00
parent 741f1cb636
commit 58131ef470
10 changed files with 236 additions and 67 deletions
View File
+20
View File
@@ -0,0 +1,20 @@
import numpy as np
def angle_normalize(x, type="deg"):
"""
normalize angle x to [-pi,pi].
Args:
x: Angle in either degrees or radians
type: one of "deg" or "rad" for x being in degrees or radians
Returns:
"""
if type == "deg":
return ((x + np.pi) % (2 * np.pi)) - np.pi
elif type == "rad":
two_pi = 2 * np.pi
return x - two_pi * np.floor((x + np.pi) / two_pi)
else:
raise ValueError(f"Invalid type {type}. Choose on of 'deg' or 'rad'.")