normalize an angle such that the angle lies in [0, pi) Args: yaw (Union[float, np.ndarray]): angle in radians Returns: Union[float, np.ndarray]: angle in [0, pi)
(yaw: Union[float, np.ndarray])
| 32 | |
| 33 | |
| 34 | def normalize(yaw: Union[float, np.ndarray]) -> Union[float, np.ndarray]: |
| 35 | """normalize an angle such that the angle lies in [0, pi) |
| 36 | |
| 37 | Args: |
| 38 | yaw (Union[float, np.ndarray]): angle in radians |
| 39 | |
| 40 | Returns: |
| 41 | Union[float, np.ndarray]: angle in [0, pi) |
| 42 | """ |
| 43 | yaw = np.fmod(yaw, np.pi * 2) + np.pi * 2 |
| 44 | yaw = np.fmod(yaw, np.pi) |
| 45 | |
| 46 | return yaw |
no outgoing calls
no test coverage detected