scenic.domains.driving.behaviors

Library of useful behaviors for dynamic agents in driving scenarios.

These behaviors are automatically imported when using the driving domain.

Summary of Module Members

Functions

concatenateCenterlines

Behaviors

AccelerateForwardBehavior

ConstantThrottleBehavior

DriveAvoidingCollisions

FollowLaneBehavior

Follow's the lane on which the vehicle is at, unless the laneToFollow is specified.

FollowTrajectoryBehavior

Follows the given trajectory.

LaneChangeBehavior

is_oppositeTraffic should be specified as True only if the laneSectionToSwitch to has the opposite traffic direction to the initial lane from which the vehicle started LaneChangeBehavior e.g.

TurnBehavior

This behavior uses a controller specifically tuned for turning at an intersection.

WalkForwardBehavior

Walk forward behavior for pedestrians.

Member Details

behavior FollowLaneBehavior(target_speed=10, laneToFollow=None, is_oppositeTraffic=False)[source]

Follow’s the lane on which the vehicle is at, unless the laneToFollow is specified. Once the vehicle reaches an intersection, by default, the vehicle will take the straight route. If straight route is not available, then any availble turn route will be taken, uniformly randomly. If turning at the intersection, the vehicle will slow down to make the turn, safely.

This behavior does not terminate. A recommended use of the behavior is to accompany it with condition, e.g. do FollowLaneBehavior() until …

Parameters:
  • target_speed – Its unit is in m/s. By default, it is set to 10 m/s

  • laneToFollow – If the lane to follow is different from the lane that the vehicle is on, this parameter can be used to specify that lane. By default, this variable will be set to None, which means that the vehicle will follow the lane that it is currently on.

behavior FollowTrajectoryBehavior(target_speed=10, trajectory=None, turn_speed=None)[source]

Follows the given trajectory. The behavior terminates once the end of the trajectory is reached.

Parameters:
  • target_speed – Its unit is in m/s. By default, it is set to 10 m/s

  • trajectory – It is a list of sequential lanes to track, from the lane that the vehicle is initially on to the lane it should end up on.

behavior LaneChangeBehavior(laneSectionToSwitch, is_oppositeTraffic=False, target_speed=10)[source]

is_oppositeTraffic should be specified as True only if the laneSectionToSwitch to has the opposite traffic direction to the initial lane from which the vehicle started LaneChangeBehavior e.g. refer to the use of this flag in examples/carla/Carla_Challenge/carlaChallenge6.scenic

behavior TurnBehavior(trajectory, target_speed=6)[source]

This behavior uses a controller specifically tuned for turning at an intersection. This behavior is only operational within an intersection, it will terminate if the vehicle is outside of an intersection.

behavior WalkForwardBehavior()[source]

Walk forward behavior for pedestrians.

It will uniformly randomly choose either end of the sidewalk that the pedestrian is on, and have the pedestrian walk towards the endpoint.