Make sure that the data type shall be consistent np.float32.
Due to the complexity of the project, the project follows these for now.
- Observation(state) and actions are in float32.
- Rendering/Physics calculation are in float64/float.
Rendering requires np.float64 as pygame.draw.polygon(screen, color, pixel_vertex) causes an error if pixel_vertex is np.float32, not np.float64.
Todo
parking_env.py
Todo later not now
car.py
parking.py
references
NumPy type hints
some examples of numpy data type hints:
def example(
x: np.ndarray[tuple[int], np.dtype[np.bool_]],
y: np.ndarray[tuple[int, int, int], np.dtype[np.uint8]],
) -> np.ndarray[tuple[int], np.dtype[np.float32]]: ...
np.ndarray[tuple[int], np.dtype[np.bool_]]
- A 3D array of unsigned 8-bit integers:
np.ndarray[tuple[int, int, int], np.dtype[np.uint8]]
- A two-dimensional (2D) array of float32:
np.ndarray[tuple[int, int], np.dtype[np.float32]]
- A 1D array of any numeric type:
np.ndarray[tuple[int], np.dtype[np.number]]
Improving Code Quality with Array and DataFrame Type Hints
Make sure that the data type shall be consistent np.float32.
Due to the complexity of the project, the project follows these for now.
Rendering requires np.float64 as pygame.draw.polygon(screen, color, pixel_vertex) causes an error if pixel_vertex is np.float32, not np.float64.
Todo
parking_env.py
Todo later not now
car.py
parking.py
references
NumPy type hints
some examples of numpy data type hints:
Improving Code Quality with Array and DataFrame Type Hints