smarts.p3d.renderer module

class smarts.p3d.renderer.P3DOffscreenCamera(renderer: RendererBase, camera_np: NodePath, buffer: GraphicsOutput, tex: Texture)[source]

A camera used for rendering images to a graphics buffer.

buffer: GraphicsOutput
camera_np: NodePath
property position: Tuple[float, float, float]

The position of the camera.

tex: Texture
update(pose: Pose, height: float, *args, **kwargs)[source]

Update the location of the camera. :param pose: The pose of the camera target. :param height: The height of the camera above the camera target.

class smarts.p3d.renderer.P3DShaderStep(renderer: RendererBase, shader_file: str, camera_dependencies: Collection[OffscreenCamera], buffer_dependencies: Collection[ShaderStepBufferDependency], camera_np: NodePath, buffer: GraphicsOutput, tex: Texture, fullscreen_quad_node: NodePath)[source]

A camera used for rendering images using a shader and a full-screen quad.

fullscreen_quad_node: NodePath
property position: Tuple[float, float, float]

The position of the camera.

update(pose: Pose | None = None, height: float | None = None, observation: Observation | None = None, **kwargs)[source]

Update the location of the shader directional values. :param pose: The pose of the camera target. :param height: The height of the camera above the camera target.

class smarts.p3d.renderer.Renderer(simid: str, debug_mode: DEBUG_MODE = DEBUG_MODE.ERROR, rendering_backend: Literal['pandagl', 'pandadx9', 'pandagles', 'pandagles2', 'p3headlessgl', 'p3tinydisplay'] = 'pandagl')[source]

The utility used to render simulation geometry.

begin_rendering_signal(sig_id: str)[source]

Add the signal node to the scene graph

begin_rendering_vehicle(vid: str, is_agent: bool)[source]

Add the vehicle node to the scene graph

build_offscreen_camera(name: str, mask: int, width: int, height: int, resolution: float) None[source]

Generates a new off-screen camera.

build_shader_step(name: str, fshader_path: str | Path, dependencies: Collection[ShaderStepDependencyBase], priority: int, height: int, width: int) None[source]

Generates a new shader camera.

camera_for_id(camera_id: str) P3DOffscreenCamera | P3DShaderStep[source]

Get a camera by its id.

create_signal_node(sig_id: str, position: Point, color: Colors | SceneColors)[source]

Create a signal node.

create_vehicle_node(glb_model: str | Path, vid: str, color: Colors | SceneColors, pose: Pose)[source]

Create a vehicle node.

destroy()[source]

Destroy the renderer. Cleans up all remaining renderer resources.

property id

The id of the simulation rendered.

property is_setup: bool

If the renderer has been fully initialized.

load_road_map(map_path: str | Path)[source]

Load the road map from its path.

property log: Logger

The rendering logger.

remove_buffer(buffer)[source]

Remove the rendering buffer.

remove_signal_node(sig_id: str)[source]

Remove a signal node

remove_vehicle_node(vid: str)[source]

Remove a vehicle node

render()[source]

Render the scene graph of the simulation.

reset()[source]

Reset the render back to initialized state.

set_interest(interest_filter: Pattern, interest_color: Colors)[source]

Sets the color of all vehicles that have ids that match the given pattern.

Parameters:
  • interest_filter (re.Pattern) – The regular expression pattern to match.

  • interest_color (Colors) – The color that the vehicle should show as.

setup(scenario: Scenario)[source]

Initialize this renderer.

step()[source]

provided for non-SMARTS uses; normally not used by SMARTS.

sync(sim_frame: SimulationFrame)[source]

Update the current state of the vehicles and signals within the renderer.

teardown()[source]

Clean up internal resources.

update_signal_node(sig_id: str, position: Point, color: Colors | SceneColors)[source]

Move the specified signal node.

update_vehicle_node(vid: str, pose: Pose)[source]

Move the specified vehicle node.