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

setLaneChangingPIDControllers

setLaneFollowingPIDControllers

setTurnPIDControllers

Classes

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 PID controller specifically tuned for turning at an intersection.

WalkForwardBehavior

Walk forward behavior for pedestrians.

Member Details

class WalkForwardBehavior(*args, **kwargs)[source]

Bases: scenic.core.dynamics.Behavior

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.

class FollowLaneBehavior(*args, **kwargs)[source]

Bases: scenic.core.dynamics.Behavior

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, and resume initial speed upon exiting the intersection.

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.

class FollowTrajectoryBehavior(*args, **kwargs)[source]

Bases: scenic.core.dynamics.Behavior

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.

class TurnBehavior(*args, **kwargs)[source]

Bases: scenic.core.dynamics.Behavior

This behavior uses a PID 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.

class LaneChangeBehavior(*args, **kwargs)[source]

Bases: scenic.core.dynamics.Behavior

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