paralleldomain.data_lab.behaviors.vehicle¶
- class DrivewayCreepBehavior(reference_line, behavior_duration, agent_length=5.5)¶
Controls the behavior of vehicles that perform the driveway creeping behavior
- Parameters:
reference_line (
ndarray
) – The driveway reference line along which the vehicle should perform the creeping behavior. Numpy array should be n x 3 in size containing n points along the reference line where each point is the [x, y, z] location of that pointbehavior_duration (
float
) – Length of time in seconds in which the vehicle should travel from the start to end of the drivewayagent_length (
float
) – Length of the agent (in meters) to which we are assigning the Driveway Creeping Behavior
- class RenderEgoBehavior¶
When used in conjunction with RenderEgoGenerator, allows the Ego Vehicle to be rendered
- class VehicleBehavior(*, proto=None, start_speed=None, target_speed=None, ignore_speed_limit=None, lane_offset=None, lane_drift_scale=None, lane_drift_amplitude=None, lane_change_probability=None, lane_change_cooldown=None, enable_dynamic_lane_selection=None, start_gear=None, start_separation_time=None, target_separation_time=None, vehicle_aggression=None, ignore_obstacle_types=None, parking_scenario_goal=None, parking_scenario_time=None)¶
Parameters which direct a vehicle’s movement behavior (eg. lane change, speed, etc.).
Note that in some cases, the Vehicle Behavior exhibited in the simulation may differ from that which the user has directed. Vehicle Behavior is affected by obstacles near the vehicle, curvature of the road, end-of-lanes the vehicle is approaching and the slope of the road.
- Parameters:
start_speed (
Optional
[ContinousUniformDistribution
]) –start_speed
target_speed (
Optional
[ContinousUniformDistribution
]) –target_speed
ignore_speed_limit (
Optional
[bool
]) –ignore_speed_limit
lane_offset (
Optional
[ContinousUniformDistribution
]) –lane_offset
lane_drift_scale (
Optional
[ContinousUniformDistribution
]) –lane_drift_scale
lane_drift_amplitude (
Optional
[ContinousUniformDistribution
]) –lane_drift_amplitude
lane_change_probability (
Optional
[ContinousUniformDistribution
]) –lane_change_probability
lane_change_cooldown (
Optional
[ContinousUniformDistribution
]) –lane_change_cooldown
enable_dynamic_lane_selection (
Optional
[bool
]) –enable_dynamic_lane_selection
start_gear (
Optional
[Gear
]) –start_gear
start_separation_time (
Optional
[ContinousUniformDistribution
]) –start_separation_time
target_separation_time (
Optional
[ContinousUniformDistribution
]) –target_separation_time
vehicle_aggression (
Optional
[ContinousUniformDistribution
]) –vehicle_aggression
ignore_obstacle_types (
Optional
[List
[ObstacleType
]]) –ignore_obstacle_types
parking_scenario_goal (
Optional
[PositionRequest
]) –parking_scenario_goal
parking_scenario_time (
Optional
[ContinousUniformDistribution
]) –parking_scenario_time
proto (Optional[pd_unified_generator_pb2.VehicleBehavior]) –
- start_speed¶
Specifies the start speed of a vehicle at the beginning of a scenario. Value is specified as a
ContinousUniformDistribution
which is randomly sampled from during scenario generation.
- target_speed¶
Specifies the target speed of the vehicle. Value is specified as a
ContinousUniformDistribution
which is randomly sampled from during scenario generation.Will not cause vehicle to exceed the speed limit of a road unless
ignore_speed_limit
is set to True.
- ignore_speed_limit¶
Flag to control whether vehicle will ignore speed limits in attempting to achieve the
target_speed
. Default: False
- lane_offset¶
Specifies the lateral offset of the vehicle in the vehicle’s motion plan relative to lane center line. Possible values are floats from -1.0 to 1.0, and represent the proportion of the lane’s half width to offset laterally. Positive values offset to the right and negative values offset to the left. Offset distance is capped so vehicle does not protrude laterally out of the lane edges.
If not provided, will default to 0.0. Value is specified as a
ContinousUniformDistribution
which is randomly sampled from during scenario generation.
- lane_drift_scale¶
Controls the frequency of weaving within the vehicle’s lanes during travel. Weaving is modelled as a perlin noise driven wave. If not provided, will default to 0.0. Value is specified as a
ContinousUniformDistribution
which is randomly sampled from during scenario generation.
- lane_drift_amplitude¶
Controls the amplitude of weaving within the vehicle’s lanes during travel. Weaving is modelled as a perlin noise driven wave. If not provided, will default to 0.0. Value is specified as a
ContinousUniformDistribution
which is randomly sampled from during scenario generation.
- lane_change_probability¶
Specifies the probability that a vehicle will make a lane change. Evaluated once every second. If evaluated to true, vehicle will lane change if conditions allow (having lanes to change to, no obstables in those lanes or in lane change path) Values can range from 0.0 to 1.0. If not provided, defaults to zero. Value is specified as a
ContinousUniformDistribution
which is randomly sampled from during scenario generation.
- lane_change_cooldown¶
Specifies the time in seconds during which another lane change cannot occur after the vehicle undergoes a lane change. If not provided, a default value of 10 is used. Value is specified as a ContinousUniformDistribution` which is randomly sampled from during scenario generation.
- enable_dynamic_lane_selection¶
Boolean flag to specify whether lane change decisions are made dynamically while the scenario is being simulated. Default: False
- start_gear¶
Specifies the gear that the vehicle should start in at the beginning of scenario generation. Default:
Gear.DRIVE
- start_separation_time¶
Specifies the spacing, in seconds, that should exist between vehicles in the same lane at the start of the scenario. Value is specified as a
ContinousUniformDistribution
which is randomly sampled from during scenario generation.
- target_separation_time¶
Specifies the spacing, in seconds, that targeted between vehicles in the same lane over the course of the scenario. Value is specified as a
ContinousUniformDistribution
which is randomly sampled from during scenario generation.
- vehicle_aggression¶
Specifies a float measurement of the level of aggression with which the vehicle should drive. Impacts values such as lane change speed, abruptness of turns. Also multiplies the set
target_speed
to define the speed that will be targeted by the vehicle during the scenario.Must be a float greater than 0.0 if specified. If not specified, a default value is used.
- ignore_obstacle_types¶
Specifies a list of
ObstacleType
that the vehicle should ignore in driving.
- parking_scenario_goal¶
Specifies the goal position for the vehicle to target in a parking/unparking scenario. Only
AbsolutePositionRequest
andLaneSpawnPolicy
position request types are supported.Must be provided if a parking/unparking scenario is desired. Will result in a scenario with standard vehicle driving behavior if not provided.
To specify a parking scenario, set a lane_spawn_policy that specifies a ParkingSpace as the goal. To control whether the parking occurs in a parking lot or on the street, specify a road_type within the lane_spawn_policy as appropriate.
To specify an unparking scenario, set a
position_request
in the generator to a LaneSpawnPolicy that specifies a parking space, and use thisparking_scenario_goal
to specify only a road_type that corresponds to the type of road the vehicle should exit onto. Unparking is not supported on streets.Examples:
>>> # Parking in Parking Lot >>> { >>> lane_spawn_policy: { >>> lane_type: { >>> probabilities: { >>> "ParkingSpace": 1.0 >>> } >>> }, >>> road_type: { >>> probabilities: { >>> "Parking_Aisle": 1.0 >>> } >>> } >>> } >>> } >>> >>> # Parking on street >>> { >>> lane_spawn_policy: { >>> lane_type: { >>> probabilities: { >>> "ParkingSpace": 1.0 >>> } >>> }, >>> road_type: { >>> probabilities: { >>> "Primary": 1.0 >>> } >>> } >>> } >>> } >>> >>> # Unparking in Parking Lot >>> { >>> lane_spawn_policy: { >>> lane_type: { >>> probabilities: { >>> "ParkingSpace": 1.0 >>> } >>> }, >>> road_type: { >>> probabilities: { >>> "ParkingAisle": 1.0 >>> } >>> } >>> } >>> }
- parking_scenario_time¶
Specifies the time (in seconds) it takes to reach the end of the parking maneuver assuming constant acceleration from the initial speed to the targe speed. Does not account for vehicle slow downs due to obstacles etc. If not provided, will use a value 5s.