diff --git a/smarts/env/utils/observation_conversion.py b/smarts/env/utils/observation_conversion.py index 9de20ff3cd..1b8fd68c8e 100644 --- a/smarts/env/utils/observation_conversion.py +++ b/smarts/env/utils/observation_conversion.py @@ -32,6 +32,7 @@ from smarts.core.observations import Observation, SignalObservation, VehicleObservation from smarts.core.plan import NavigationMission from smarts.core.road_map import Waypoint +from smarts.core.configuration import Config _LIDAR_SHP = 300 _NEIGHBOR_SHP = 50 @@ -757,6 +758,24 @@ def active(self, agent_interface: AgentInterface) -> bool: @property def name(self): return "top_down_rgb" + + +class CustomRenderSpaceFormat(Image8BSpaceFormat): + """Formats a specific custom_render""" + + def __init__(self, agent_interface: AgentInterface, index: int) -> None: + self._index = index + super().__init__(dimensions=agent_interface.custom_renders[index], layers=3) + + def format(self, obs: Observation): + return obs.custom_renders[self._index].data.astype(np.uint8) + + def active(self, agent_interface: AgentInterface) -> bool: + return bool(agent_interface.custom_renders[self._index]) + + @property + def name(self): + return str(self._index) waypoint_paths_space_format = StandardSpaceFormat( @@ -1053,6 +1072,14 @@ class ObservationSpacesFormatter: shape=(height, width, 3). dtype=np.uint8. "top_down_rgb": np.ndarray + Occlusion observable area map. + shape=(height, width, 3). dtype=np.uint8. + "top_down_rgb": np.ndarray + + TODO Custom renders. + shape=(max_custom_image_sensors, height, width, 3). dtype=np.uint8. + "top_down_rgb": np.ndarray + Feature array of 20 waypoints ahead or in the mission route, from the nearest 4 lanes. If lanes or waypoints ahead are insufficient, default values are padded.