smarts.core.vehicle module

class smarts.core.vehicle.Vehicle(id: str, chassis: Chassis, visual_model_filepath: str | None, vehicle_config_type: str = 'sedan', vehicle_class: str = 'generic_sedan', color: SceneColors | None = None, action_space=None)[source]

Represents a single vehicle.

property action_space

The action space this vehicle uses.

static agent_vehicle_dims(mission: plan.NavigationMission, default: str | None = None) Dimensions[source]

Get the vehicle dimensions from the mission requirements. :param A mission for the agent.:

Returns:

The mission vehicle spec dimensions XOR the default “passenger” vehicle dimensions.

attach_sensor(sensor: Sensor, sensor_name: str)[source]

replace previously-attached sensor with this one (to allow updating its parameters). Sensors might have been attached to a non-agent vehicle (for example, for observation collection from history vehicles), but if that vehicle gets hijacked, we want to use the sensors specified by the hijacking agent’s interface.

classmethod attach_sensors_to_vehicle(sensor_manager: SensorManager, sim: SMARTS, vehicle: Vehicle, agent_interface: AgentInterface, replace=True, reset_sensors=False)[source]

Attach sensors as required to satisfy the agent interface’s requirements

property bounding_box: List[ndarray]

The minimum fitting heading aligned bounding box. Four 2D points representing the minimum fitting box.

property chassis: Chassis

The underlying chassis of this vehicle.

control(*args, **kwargs)[source]

Apply control values to this vehicle.

Forwards control to the chassis.

create_renderer_node(renderer: RendererBase)[source]

Create the vehicle’s rendering node in the renderer.

detach_sensor(sensor_name: str)[source]

Detach a sensor by name.

property heading: Heading

The heading of this vehicle.

Note: Heading rotates counterclockwise with north as 0.

property height: float

The height of this vehicle.

property id

The id of this vehicle.

property length: float

The length of this vehicle.

property max_steering_wheel: float | None

The max steering value the chassis steering wheel can turn to.

Some chassis types do not support this.

property pose: Pose

The pose of this vehicle. Pose is defined as position and orientation.

property position: ndarray

The position of this vehicle.

property sensor_names: Tuple[str]

The names of the sensors that are potentially available to this vehicle.

sensor_property(sensor_name: str, default: Sensor | ellipsis | None = Ellipsis)[source]

Call a sensor by name.

property sensors: Dict[str, Sensor]

The sensors attached to this vehicle.

set_pose(pose: Pose)[source]

Use with caution. This will directly set the pose of the chassis.

This may disrupt physics simulation of the chassis physics body for a few steps after use.

property speed: float

The current speed of this vehicle.

property state: VehicleState

The current state of this vehicle.

step(current_simulation_time: float)[source]

Update internal state.

subscribed_to(sensor_name: str)[source]

Confirm if the sensor is subscribed.

swap_chassis(chassis: Chassis)[source]

Swap the current chassis with the given chassis. Apply the GCD of the previous chassis to the new chassis (“greatest common denominator state” from front-end to back-end)

teardown(renderer: RendererBase, exclude_chassis: bool = False)[source]

Clean up internal resources

update_state(state: VehicleState, dt: float)[source]

Update the vehicle’s state

property valid: bool

Check if the vehicle still exists and is still operable.

property vehicle_class: str

Get the custom class of vehicle this is. (e.g. ‘ford_f150’)

property vehicle_color: SceneColors | None

The color of this vehicle (generally used for rendering purposes.)

property vehicle_config_type: str

Get the vehicle type identifier. (e.g. ‘sedan’)

property vehicle_type: str

Get the vehicle type name as recognized by SMARTS. (e.g. ‘car’)

property width: float

The width of this vehicle.