Computes action components that help move from 1 position to another. Args: from_xyz: The coordinates to move from (usually current position) to_xyz: The coordinates to move to p: constant to scale response Returns: Response that will decrease abs(to_xyz - f
(
from_xyz: npt.NDArray[Any], to_xyz: npt.NDArray[Any], p: float
)
| 31 | |
| 32 | |
| 33 | def move( |
| 34 | from_xyz: npt.NDArray[Any], to_xyz: npt.NDArray[Any], p: float |
| 35 | ) -> npt.NDArray[Any]: |
| 36 | """Computes action components that help move from 1 position to another. |
| 37 | |
| 38 | Args: |
| 39 | from_xyz: The coordinates to move from (usually current position) |
| 40 | to_xyz: The coordinates to move to |
| 41 | p: constant to scale response |
| 42 | |
| 43 | Returns: |
| 44 | Response that will decrease abs(to_xyz - from_xyz) |
| 45 | """ |
| 46 | error = to_xyz - from_xyz |
| 47 | response = p * error |
| 48 | if np.any(np.absolute(response) > 1.0): |
| 49 | warnings.warn( |
| 50 | "Constant(s) may be too high. Environments clip response to [-1, 1]" |
| 51 | ) |
| 52 | |
| 53 | return response |
| 54 | |
| 55 | |
| 56 | class Policy(abc.ABC): |
no outgoing calls
searching dependent graphs…