Overview

carla.ActorAttributeType class

Instance Variables

  • Bool
  • Int
  • Float
  • String
  • RGBColor

carla.ActorList class

Class that provides access to actors.

Methods

  • find(self, actor_id)
    • Parameters:
      • actor_id (int)
  • filter(self, wildcard_pattern)
    • Parameters:
      • wildcard_pattern (str)
  • __getitem__(self, pos)
  • __len__(self)
  • __iter__(self)
  • __str__(self)

carla.AttachmentType class

Class that defines the attachment options. See world.spawn_actor.

Instance Variables

  • Rigid
  • SpringArm

carla.BlueprintLibrary class

Class that provides access to blueprints.

Methods

  • find(self)
  • filter(self, wildcard_pattern)
    Filters a list of ActorBlueprint with id or tags matching wildcard_pattern. The pattern is matched against each blueprint's id and tags.
    • Parameters:
      • wildcard_pattern (str)
    • Return: carla.BlueprintLibrary
    • Note: wildcard_pattern follows Unix shell-style wildcards (fnmatch).
  • __getitem__(self, pos)
  • __len__(self)
  • __iter__(self)
  • __str__(self)

carla.ColorConverter class

Class that defines the color converter options.

Instance Variables

  • Raw
  • Depth
  • LogarithmicDepth
  • CityScapesPalette

carla.DebugHelper class

Class that provides drawing debug shapes.

Methods

  • draw_point(self, location, size=0.1f, color=(255,0,0), life_time=-1.0f, persistent_lines=True)
    • Parameters:
      • location (carla.Location)
      • size (float)
      • color (carla.Color)
      • life_time (float)
      • persistent_lines (bool) – Deprecated, use life_time=0 instead.
  • draw_line(self, begin, end, thickness=0.1f, color=(255,0,0), life_time=-1.0f, persistent_lines=True)
  • draw_arrow(self, begin, end, thickness=0.1f, arrow_size=0.1f, color=(255,0,0), life_time=-1.0f, persistent_lines=True)
    • Parameters:
  • draw_box(self, box, rotation, thickness=0.1f, color=(255,0,0), life_time=-1.0f, persistent_lines=True)
  • draw_string(self, location, text, draw_shadow=False, color=(255,0,0), life_time=-1.0f, persistent_lines=True)
    • Parameters:
      • location (carla.Location)
      • text (str)
      • draw_shadow (bool)
      • color (carla.Color)
      • life_time (float)
      • persistent_lines (bool) – Deprecated, set a high life_time instead.

carla.LaneChange class

Class that defines the lane change options.

Instance Variables

  • NONE
    Traffic rules do not allow turning right or left, only going straight.
  • Right
    Traffic rules allow turning right.
  • Left
    Traffic rules allow turning left.
  • Both
    Traffic rules allow turning right or left.

carla.LaneMarking class

Struct that defines a lane marking.

Instance Variables


carla.LaneMarkingColor class

Class that defines the lane marking colors.

Instance Variables

  • Standard
    White by default.
  • Blue
  • Green
  • Red
  • White
  • Yellow
  • Other

carla.LaneMarkingType class

Class that defines the lane marking types that OpenDRIVE accepts.

Instance Variables

  • NONE
  • Other
  • Broken
  • Solid
  • SolidSolid
    For double solid line.
  • SolidBroken
    From inside to outside except for center lane which is from left to right.
  • BrokenSolid
    From inside to outside except for center lane which is from left to right.
  • BrokenBroken
    From inside to outside except for center lane which is from left to right.
  • BottsDots
  • Grass
    Grass edge.
  • Curb

carla.LaneType class

All the possible lane types that OpenDRIVE accepts.

Instance Variables

  • NONE
  • Driving
  • Stop
  • Shoulder
  • Biking
  • Sidewalk
  • Border
  • Restricted
  • Parking
  • Bidirectional
  • Median
  • Special1
  • Special2
  • Special3
  • RoadWorks
  • Tram
  • Rail
  • Entry
  • Exit
  • OffRamp
  • OnRamp
  • Any

carla.SensorData class

Base class for all the objects containing data generated by a sensor.

Instance Variables

  • frame (int)
    Frame count when the data was generated.
  • timestamp (float)
    Simulation-time when the data was generated.
  • transform (carla.Transform)
    Sensor's transform when the data was generated.

carla.TrafficLightState class

All possible states for traffic lights.

Instance Variables

  • Red
  • Yellow
  • Green
  • Off
  • Unknown

carla.Actor class

Base class for all actors. Actor is anything that plays a role in the simulation and can be moved around, examples of actors are vehicles, pedestrians, and sensors.

Instance Variables

  • id (int)
    Unique id identifying this actor. Note ids are unique during a given episode.
  • type_id (str)
    Id of the blueprint that created this actor, e.g. "vehicle.ford.mustang".
  • parent (carla.Actor)
    Parent actor of this instance, None if this instance is not attached to another actor.
  • semantic_tags (list(int))
    List of semantic tags of all components of this actor, see semantic segmentation sensor for the list of available tags. E.g., a traffic light actor could contain "pole" and "traffic light" tags.
  • is_alive (bool)
    Return whether this object was destroyed using this actor handle.
  • attributes (dict)
    Dictionary of attributes of the blueprint that created this actor.

Methods

  • destroy(self)
    Tell the simulator to destroy this Actor, and return whether the actor was successfully destroyed. It has no effect if the Actor was already successfully destroyed.
    • Return: bool
    • Warning: This function blocks until the destruction operation is completed by the simulator.
  • get_world(self)
    Return the world this actor belongs to.
  • get_location(self)
    Return the current location of the actor.
    • Return: carla.Location
    • Note: This function does not call the simulator, it returns the location received in the last tick.
  • get_velocity(self)
    Return the current 3D velocity of the actor.
    • Return: carla.Vector3D
    • Note: This function does not call the simulator, it returns the velocity received in the last tick.
  • get_angular_velocity(self)
    Return the current 3D angular velocity of the actor.
    • Return: carla.Vector3D
    • Note: This function does not call the simulator, it returns the angular velocity received in the last tick.
  • get_acceleration(self)
    Return the current 3D acceleration of the actor.
    • Return: carla.Vector3D
    • Note: This function does not call the simulator, it returns the acceleration received in the last tick.
  • set_location(self, location)
    Teleport the actor to a given location.
  • set_transform(self, transform)
    Teleport the actor to a given transform.
  • set_velocity(self, velocity)
    Set the actor's velocity.
  • set_angular_velocity(self, angular_velocity)
    Set the actor's angular velocity.
  • add_impulse(self, impulse)
    Add impulse to the actor.
  • set_simulate_physics(self, enabled=True)
    Enable or disable physics simulation on this actor.
    • Parameters:
      • enabled (bool)
  • __str__(self)
    • Return: str

carla.ActorAttribute class

Class that defines an attribute of a carla.ActorBlueprint.

Instance Variables

Methods

  • as_bool(self)
  • as_int(self)
  • as_float(self)
  • as_str(self)
  • as_color(self)
  • __eq__(self, other)
    • Parameters:
      • other (bool)
  • __eq__(self, other)
    • Parameters:
      • other (int)
  • __eq__(self, other)
    • Parameters:
      • other (float)
  • __eq__(self, other)
    • Parameters:
      • other (str)
  • __eq__(self, other)
  • __eq__(self, other)
  • __ne__(self, other)
    • Parameters:
      • other (bool)
  • __ne__(self, other)
    • Parameters:
      • other (int)
  • __ne__(self, other)
    • Parameters:
      • other (float)
  • __ne__(self, other)
    • Parameters:
      • other (str)
  • __ne__(self, other)
  • __ne__(self, other)
  • __nonzero__(self)
  • __bool__(self)
  • __int__(self)
  • __float__(self)
  • __str__(self)
  • __str__(self)

carla.ActorBlueprint class

Class that contains all the necessary information for spawning an Actor.

Instance Variables

  • id (str)
  • tags (list(str))

Methods

  • has_tag(self, tag)
    • Parameters:
      • tag (str)
    • Return: bool
  • match_tags(self, wildcard_pattern)
    Test if any of the flags or id matches wildcard_pattern.
    • Parameters:
      • wildcard_pattern (str)
    • Return: bool
    • Note: Wildcard_pattern follows Unix shell-style wildcards.
  • has_attribute(self, id)
    • Parameters:
      • id (str)
    • Return: bool
  • get_attribute(self, id)
  • set_attribute(self, id, value)
    • Parameters:
      • id (str)
      • value (str)
  • __len__(self)
  • __iter__(self)
  • __str__(self)

carla.ActorSnapshot class

Class that provides access to the data of a carla.Actor in a carla.WorldSnapshot.

Instance Variables

  • id (int)

Methods


carla.BoundingBox class

Bounding box helper class.

Instance Variables

  • location (carla.Location)
    The center of the bounding box relative to its parent actor.
  • extent (carla.Vector3D)
    It contains the vector from the center of the bounding box to one of the vertex of the box.
    So, if you want to know the X bounding box size, you can just do extent.x * 2.

Methods


carla.Client class

Client used to connect to a Carla server.

Methods

  • __init__(self, host, port, worker_threads=0)
    Client constructor.
    • Parameters:
      • host (str) – IP address where a CARLA Simulator instance is running.
      • port (int) – TCP port where the CARLA Simulator instance is running.
      • worker_threads (int) – Number of working threads used for background updates. If 0, use all available concurrency.
  • set_timeout(self, seconds)
    Set the timeout in seconds allowed to block when doing networking calls.
    • Parameters:
      • seconds (float) – New timeout value in seconds.
  • get_client_version(self)
    Get the client version as a string.
    • Return: str
  • get_server_version(self)
    Get the server version as a string.
    • Return: str
  • get_world(self)
    Get the world currently active in the simulation.
  • get_available_maps(self)
    Get a list of strings of the maps available on server. The result can be something like:
    '/Game/Carla/Maps/Town01'
    '/Game/Carla/Maps/Town02'
    '/Game/Carla/Maps/Town03'
    '/Game/Carla/Maps/Town04'
    '/Game/Carla/Maps/Town05'
    '/Game/Carla/Maps/Town06'
    '/Game/Carla/Maps/Town07'.
    • Return: list(str)
  • reload_world(self)
    Reload the current world, note that a new world is created with default settings using the same map. All actors present in the world will be destroyed.
    • Raises: RuntimeError
  • load_world(self, map_name)
    Load a new world with default settings using map_name map. All actors present in the current world will be destroyed.
    • Parameters:
      • map_name (str) – Name of the map to load, accepts both full paths and map names, e.g. '/Game/Carla/Maps/Town01' or 'Town01'.
  • start_recorder(self, filename)
    If we use a simple name like 'recording.log' then it will be saved at server folder 'CarlaUE4/Saved/recording.log'. If we use some folder in the name, then it will be considered to be an absolute path, like '/home/carla/recording.log'.
    • Parameters:
      • filename (str) – Name of the file to write the recorded data.
  • stop_recorder(self)
    Stops the recording in progress.
  • show_recorder_file_info(self, filename, show_all)
    Will show info about the recorded file (frames, times, events, state, positions...) We have the option to show all the details per frame, that includes all the traffic light states, position of all actors, and animations data.
    • Parameters:
      • filename (str) – Name of the recorded file to load.
      • show_all (bool) – Show all detailed info, or just a summary.
  • show_recorder_collisions(self, filename, category1, category2)
    This will show which collisions were recorded in the file. We can use a filter for the collisions we want, using two categories. The categories can be:
    'h' = Hero
    'v' = Vehicle
    'w' = Walker
    't' = Traffic light
    'o' = Other
    'a' = Any
    So, if you want to see only collisions about a vehicle and a walker, we would use for category1 'v' and category2 'w'. Or if you want all the collisions (filter off) you can use 'a' as both categories.
    • Parameters:
      • filename (str) – Name of the recorded file to load.
      • category1 (single char) – Character specifying the category of the first actor.
      • category2 (single char) – Character specifying the category of the second actor.
  • show_recorder_actors_blocked(self, filename, min_time, min_distance)
    Shows which actors seem blocked by some reason. The idea is to calculate which actors are not moving as much as 'min_distance' for a period of 'min_time'. By default min_time = 60 seconds (1 min) and min_distance = 100 centimeters (1 m).
    • Parameters:
      • filename (str) – Name of the recorded file to load.
      • min_time (float) – How many seconds has to be stoped an actor to be considered as blocked.
      • min_distance (float) – How many centimeters needs to move the actor in order to be considered as moving, and not blocked.
  • replay_file(self, name, start, duration, follow_id)
    Playback a file.
    • Parameters:
      • name (str) – Name of the file.
      • start (float) – Time in seconds where to start the playback. If it is negative, then it starts from the end.
      • duration (float) – Id of the actor to follow. If this is 0 then camera is disabled.
      • follow_id (int)
  • set_replayer_time_factor(self, time_factor)
    Apply a different playback speed to current playback. Can be used several times while a playback is in curse.
    • Parameters:
      • time_factor (float) – A value of 1.0 means normal time factor. A value < 1.0 means slow motion (for example 0.5 is half speed) A value > 1.0 means fast motion (for example 2.0 is double speed).
  • apply_batch(self, commands)
    This function executes the whole list of commands on a single simulation step. For example, to set autopilot on some actors, we could use: sample_code We don't have control about the response of each command. If we need that, we can use apply_batch_sync().
    • Parameters:
      • commands (list) – A list of commands to execute in batch. Each command has a different number of parameters. Currently, we can use these commands:
        SpawnActor
        DestroyActor
        ApplyVehicleControl
        ApplyWalkerControl
        ApplyTransform
        ApplyVelocity
        AplyAngularVelocity
        ApplyImpulse
        SetSimulatePhysics
        SetAutopilot.
  • apply_batch_sync(self, commands)
    This function executes the whole list of commands on a single simulation step, blocks until the commands are executed, and returns a list of command.Response that can be used to determine whether a single command succeeded or not. sample_code.
    • Parameters:
      • commands (list) – A list of commands to execute in batch. For a list of commands available see function above apply_batch().
    • Return: list

carla.CollisionEvent(carla.SensorData) class

Class that defines a registered collision.

Instance Variables

  • actor (carla.Actor)
    Get "self" actor. Actor that measured the collision.
  • other_actor (carla.Actor)
    Get the actor to which we collided.
  • normal_impulse (carla.Vector3D)
    Normal impulse result of the collision.

carla.Color class

Class that defines a 32-bit BGRA color.

Instance Variables

  • r
  • g
  • b
  • a

Methods

  • __init__(self, r=0, g=0, b=0, a=255)
    Client constructor.
    • Parameters:
      • r (int)
      • g (int)
      • b (int)
      • a (int)
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.GearPhysicsControl class

Class that provides access to vehicle transmission details.

Instance Variables

  • ratio (float)
  • down_ratio (float)
  • up_ratio (float)

Methods

  • __init__(self, ratio=1.0, down_ratio=0.5, up_ratio=0.65)
    • Parameters:
      • ratio (float)
      • down_ratio (float)
      • up_ratio (float)
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.GeoLocation class

Class that contains geolocation simulated data.

Instance Variables

  • latitude (float)
  • longitude (float)
  • altitude (float)

Methods

  • __init__(self, latitude=0.0, longitude=0.0, altitude=0.0)
    • Parameters:
      • latitude (float)
      • longitude (float)
      • altitude (float)
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.Map class

Map description that provides a Waypoint query system, that extracts the information from the OpenDRIVE file.

Instance Variables

  • name
    Map name. Comes from the Unreal's UMap name if loaded from a Carla server.

Methods

  • __init__(self, name, xodr_content)
    Constructor for this class useful if you want to use a XODR (OpenDRIVE) file without importing it from any Carla server running.
    • Parameters:
      • name (str) – Name of the current map.
      • xodr_content (str) – XODR content as string.
    • Return: list(carla.Transform)
  • get_spawn_points(self)
    Returns a list of transformations corresponding to the recommended spawn points over the map.
  • get_waypoint(self, location, project_to_road=True, lane_type=carla.LaneType.Driving)
    • Parameters:
      • location (carla.Location) – Location where you want to get the carla.Waypoint.
      • project_to_road (bool) – If True, the waypoint will be at the center of the nearest lane.
        If False, the waypoint will be at the given location. Also, in this second case, the result may be None if the waypoint is not found.
      • lane_type (carla.LaneType) – This parameter is used to limit the search on a certain lane type. This can be used like a flag: LaneType.Driving & LaneType.Shoulder.
    • Return: carla.Waypoint
  • get_topology(self)
    It provides a minimal graph of the topology of the current OpenDRIVE file. It is constituted by a list of pairs of waypoints, where the first waypoint is the origin and the second one is the destination. It can be loaded into NetworkX. A valid output could be: [ (w0, w1), (w0, w2), (w1, w3), (w2, w3), (w0, w4) ].
  • generate_waypoints(self, distance)
    Returns a list of waypoints positioned on the center of the lanes all over the map with an approximate distance between them.
    • Parameters:
      • distance (float) – Approximate distance between the waypoints.
    • Return: list(carla.Waypoint)
  • transform_to_geolocation(self, location)
    Converts a given carla.Location (x, y, z) to a carla.GeoLocation (lat, lon, alt).
  • to_opendrive(self)
    Returns the OpenDRIVE of the current map as string.
    • Return: str
  • save_to_disk(self, path)
    Save the OpenDRIVE of the current map to disk.
    • Parameters:
      • path – Path where it will be saved.
  • __str__(self)

carla.Rotation class

Class that represents a 3D rotation. All rotation angles are stored in degrees.

UE4_Rotation Unreal Engine's standard (from UE4 docs).

Instance Variables

  • pitch (float)
  • yaw (float)
  • roll (float)

Methods

  • __init__(self, pitch=0.0, yaw=0.0, roll=0.0)
    • Parameters:
      • pitch (float)
      • yaw (float)
      • roll (float)
  • get_forward_vector(self)
    Computes a forward vector using the current rotation.
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.Timestamp class

Instance Variables

  • frame (int)
    The number of frames elapsed since the simulator was launched.
  • elapsed_seconds (float)
    Simulated seconds elapsed since the beginning of the current episode.
  • delta_seconds (float)
    Simulated seconds elapsed since the previous frame.
  • platform_timestamp (float)
    Time-stamp of the frame at which this measurement was taken, in seconds as given by the OS.

Methods

  • __init__(self, frame, elapsed_seconds, delta_seconds, platform_timestamp)
    • Parameters:
      • frame (int)
      • elapsed_seconds (float)
      • delta_seconds (float)
      • platform_timestamp (float)
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.TrafficSign(carla.Actor) class

Instance Variables

  • trigger_volume

carla.Transform class

Class that defines a transformation without scaling.

Instance Variables

Methods

  • __init__(self, location, rotation)
  • transform(self, in_point)
    Transform a 3D point using the current transformation.
    • Parameters:
      • in_point (carla.Location) – Location in the space to which the transformation will be applied.
  • get_forward_vector(self)
    Computes a forward vector using the rotation of the current transformation.
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.Vector2D class

Vector 2D helper class.

Instance Variables

  • x (float)
  • y (float)

Methods


carla.Vector3D class

Vector 3D helper class.

Instance Variables

  • x (float)
  • y (float)
  • z (float)

Methods

  • __init__(self, x=0.0, y=0.0, z=0.0)
    • Parameters:
      • x (float)
      • y (float)
      • z (float)
  • __add__(self, other)
  • __mul__(self, other)
  • __sub__(self, other)
  • __truediv__(self, other)
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.VehicleControl class

VehicleControl is used for controlling the basic movement of a vehicle.

Instance Variables

  • throttle (float)
    A scalar value to control the vehicle throttle [0.0, 1.0].
  • steer (float)
    A scalar value to control the vehicle steering [-1.0, 1.0].
  • brake (float)
    A scalar value to control the vehicle brake [0.0, 1.0].
  • hand_brake (bool)
    If true, hand brake will be used.
  • reverse (bool)
    If true, the vehicle will move reverse.
  • manual_gear_shift (bool)
    If true, the vehicle will be controlled by changing gears manually.
  • gear (int)
    Controls the gear value of the vehicle.

Methods

  • __init__(self, throttle=0.0, steer=0.0, brake=0.0, hand_brake=True, reverse=True, manual_gear_shift=True, gear=0)
    VehicleControl constructor.
    • Parameters:
      • throttle (float)
      • steer (float)
      • brake (float)
      • hand_brake (bool)
      • reverse (bool)
      • manual_gear_shift (bool)
      • gear (int)
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.VehiclePhysicsControl class

VehiclePhysicsControl is used for controlling the physics parameters of a vehicle.

Instance Variables

  • torque_curve (list(carla.Vector2D))
    Curve that indicates the torque measured in Nm for a specific RPM of the vehicle's engine.
  • max_rpm (float)
    The maximum RPM of the vehicle's engine.
  • moi (float)
    The moment of inertia of the vehicle's engine.
  • damping_rate_full_throttle (float)
    Damping rate when the throttle is maximum.
  • damping_rate_zero_throttle_clutch_engaged (float)
    Damping rate when the throttle is zero with clutch engaged.
  • damping_rate_zero_throttle_clutch_disengaged (float)
    Damping rate when the throttle is zero with clutch disengaged.
  • use_gear_autobox (bool)
    If true, the vehicle will have an automatic transmission.
  • gear_switch_time (float)
    Switching time between gears.
  • clutch_strength (float)
    The clutch strength of the vehicle. Measured in Kgm^2/s.
  • final_ratio (float)
    The fixed ratio from transmission to wheels.
  • forward_gears (list(carla.GearPhysicsControl))
    List of GearPhysicsControl objects.
  • mass (float)
    The mass of the vehicle measured in Kg.
  • drag_coefficient (float)
    Drag coefficient of the vehicle's chassis.
  • center_of_mass (carla.Vector3D)
    The center of mass of the vehicle.
  • steering_curve (list(carla.Vector2D))
    Curve that indicates the maximum steering for a specific forward speed.
  • wheels (list(carla.WheelPhysicsControl))
    List of carla.WheelPhysicsControl objects. This list should have 4 elements, where index 0 corresponds to the front left wheel, index 1 corresponds to the front right wheel, index 2 corresponds to the back left wheel and index 3 corresponds to the back right wheel. For 2 wheeled vehicles, set the same values for both front and back wheels.

Methods

  • __init__(self, torque_curve=[[0.0, 500.0], [5000.0, 500.0]], max_rpm=5000.0, moi=1.0, damping_rate_full_throttle=0.15, damping_rate_zero_throttle_clutch_engaged=2.0, damping_rate_zero_throttle_clutch_disengaged=0.35, use_gear_autobox=True, gear_switch_time=0.5, clutch_strength=10.0, mass=1000.0, drag_coefficient=0.3, center_of_mass=[0.0, 0.0, 0.0], steering_curve=[0.0, 0.0, 0.0], wheels=list())
    VehiclePhysicsControl constructor.
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.WalkerAIController(carla.Actor) class

Class used for controlling the automation of a pedestrian.

Methods

  • start(self)
    Initializes walker controller.
  • stop(self)
    Stops walker controller.
  • go_to_location(self, destination)
    Sets the destination that the pedestrian will reach.
  • set_max_speed(self, speed=1.4)
    Sets the speed of the pedestrian.
    • Parameters:
      • speed (float) – Speed is in m/s.
  • __str__(self)

carla.WalkerBoneControl class

Class used for controlling the skeleton of a walker. See walker bone control.

Instance Variables

  • bone_transforms (list([name,transform]))

Methods

  • __init__(self, list(name,transform))
    • Parameters:
      • list(name,transform) (tuple)
  • __str__(self)

carla.WalkerControl class

WalkerControl is used for controlling the basic movement of a walker.

Instance Variables

  • direction (carla.Vector3D)
    Vector that controls the direction of the walker.
  • speed (float)
    A scalar value to control the walker speed.
  • jump (bool)
    If true, the walker will perform a jump.

Methods

  • __init__(self, direction=[1.0, 0.0, 0.0], speed=0.0, jump=False)
    VehicleControl constructor.
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.Waypoint class

3D directed point that stores information about the road definition that OpenDRIVE provides.

Instance Variables

  • id (int)
    Waypoint id, it's generated using a hash combination of its road_id, section_id, lane_id and s values, all them come from the OpenDRIVE. The s precision is set to 2 centimeters, so 2 waypoints at a distance s less than 2 centimeters in the same road, section and lane, will have the same id.
  • transform (carla.Transform)
    Transform indicating it's position and orientation according to the current lane information.
  • is_intersection (bool)
    Deprecated, use is_junction instead.
  • is_junction (bool)
    True if the current Waypoint is on a junction.
  • lane_width (float)
    Horizontal size of the road at current s.
  • road_id (int)
    OpenDRIVE road's id.
  • section_id (int)
    OpenDRIVE section's id, based on the order that they are originally defined.
  • lane_id (int)
    OpenDRIVE lane's id, this value can be positive or negative which represents the direction of the current lane with respect to the road. For more information refer to OpenDRIVE documentation.
  • s (float)
    OpenDRIVE s value of the current position.
  • lane_change (carla.LaneChange)
    Lane change definition of the current Waypoint's location, based on the traffic rules defined in the OpenDRIVE file. Basically, it tells you if a lane change can be done and in which direction.
  • lane_type (carla.LaneType)
    The lane type of the current Waypoint, based on OpenDRIVE types.
  • right_lane_marking (carla.LaneMarking)
    The right lane marking information based on the direction of the Waypoint.
  • left_lane_marking (carla.LaneMarking)
    The left lane marking information based on the direction of the Waypoint.

Methods

  • next(self, distance)
    Returns a list of Waypoints at a certain approximate distance from the current Waypoint, taking into account the shape of the road and its possible deviations, without performing any lane change.
    The list may be empty if the road ends before the specified distance, for instance, a lane ending with the only option of incorporating to another road.
    • Parameters:
      • distance (float) – The approximate distance where to get the next Waypoints.
    • Return: list(carla.Waypoint)
  • get_right_lane(self)
    Generates a Waypoint at the center of the right lane based on the direction of the current Waypoint, regardless if the lane change is allowed in this location.
    Can return None if the lane does not exist.
  • get_left_lane(self)
    Generates a Waypoint at the center of the left lane based on the direction of the current Waypoint, regardless if the lane change is allowed in this location.
    Can return None if the lane does not exist.
  • __str__(self)

carla.WeatherParameters class

WeatherParameters class is used for requesting and changing the lighting and weather conditions inside the world.

Instance Variables

  • cloudiness (float)
    Weather cloudiness. Values range from 0 to 100.
  • precipitation (float)
    Precipitation amount for controlling rain intensity. Values range from 0 to 100.
  • precipitation_deposits (float)
    Precipitation deposits for controlling the area of puddles on roads. Values range from 0 to 100.
  • wind_intensity (float)
    Wind intensity. Values range from 0 to 100.
  • sun_azimuth_angle (float)
    The azimuth angle of the sun in degrees. Values range from 0 to 360.
  • sun_altitude_angle (float)
    Altitude angle of the sun in degrees. Values range from -90 to 90.

Methods

  • __init__(self, cloudiness=0.0, precipitation=0.0, precipitation_deposits=0.0, wind_intensity=0.0, sun_azimuth_angle=0.0, sun_altitude_angle=0.0)
    WeatherParameters constructor.
    • Parameters:
      • cloudiness (float)
      • precipitation (float)
      • precipitation_deposits (float)
      • wind_intensity (float)
      • sun_azimuth_angle (float)
      • sun_altitude_angle (float)
  • __eq__(self, other)
    Returns True if self and other are equal.
    • Return: bool
  • __ne__(self, other)
    Returns True if self and other are not equal.
    • Return: bool
  • __str__(self)

carla.WheelPhysicsControl class

WheelPhysicsControl is used for controlling the physics parameters of a vehicle's wheel.

Instance Variables

  • tire_friction (float)
    A scalar value that indicates the friction of the wheel.
  • damping_rate (float)
    The damping rate of the wheel.
  • max_steer_angle (float)
    The maximum angle in degrees that the wheel can steer.
  • radius (float)
    The radius of the wheel in centimeters.
  • max_brake_torque (float)
    The maximum brake torque in Nm.
  • max_handbrake_torque (float)
    The maximum handbrake torque in Nm.
  • position (carla.Vector3D)
    World position of the wheel. Note that it is a read-only parameter.

Methods

  • __init__(self, tire_friction=2.0, damping_rate=0.25, max_steer_angle=70.0, radius=30.0, position=(0.0,0.0,0.0))
    WheelPhysicsControl constructor.
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.World class

Instance Variables

  • id (int)
    The id of the episode associated with this world.
  • debug (carla.DebugHelper)

Methods

  • get_blueprint_library(self)
    Return the list of blueprints available in this world. These blueprints can be used to spawn actors into the world.
  • get_map(self)
    Return the map that describes this world.
  • get_spectator(self)
    Return the spectator actor. The spectator controls the view in the simulator window.
  • get_settings(self)
  • apply_settings(self, world_settings)
    Returns the id of the frame when the settings took effect.
  • get_weather(self)
    Retrieve the weather parameters currently active in the world.
  • set_weather(self, weather)
    Change the weather in the simulation.
  • get_snapshot(self)
    Return a snapshot of the world at this moment.
  • get_actor(self, actor_id)
    Find actor by id, return None if not found.
  • get_actors(self)
    By default it returns a list with every actor present in the world. A list of ids can be used as a parameter.
  • spawn_actor(self, blueprint, transform, attach_to=None, attachment=Rigid)
    Spawn an actor into the world based on the blueprint provided at transform. If a parent is provided, the actor is attached to parent.
  • try_spawn_actor(self, blueprint, transform, attach_to=None, attachment=Rigid)
    Same as SpawnActor but return none on failure instead of throwing an exception.
  • wait_for_tick(self, seconds=10.0)
    Block calling thread until a world tick is received.
  • on_tick(self, callback)
    Returns the ID of the callback so it can be removed with remove_on_tick.
  • remove_on_tick(self, callback_id)
    Removes on tick callbacks.
  • tick(self)
    Synchronizes with the simulator and returns the id of the newly started frame (only has effect on synchronous mode).
    • Return: int
  • __str__(self)

carla.WorldSettings class

More information in our section.

Instance Variables

  • synchronous_mode (bool)
  • no_rendering_mode (bool)
  • fixed_delta_seconds (float)

Methods

  • __init__(self, synchronous_mode=False, no_rendering_mode=False, fixed_delta_seconds=0.0)
    • Parameters:
      • synchronous_mode (bool)
      • no_rendering_mode (bool)
      • fixed_delta_seconds (float)
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.WorldSnapshot class

Instance Variables

Methods

  • has_actor(self, actor_id)
    Check if an actor is present in this snapshot.
    • Parameters:
      • actor_id (int)
  • find(self, actor_id)
    Find an ActorSnapshot by id, return None if the actor is not found.
    • Parameters:
      • actor_id (int)
  • __len__(self)
    Return number of ActorSnapshots present in this WorldSnapshot.
  • __iter__(self)
  • __eq__(self, other)
  • __ne__(self, other)
  • __self__(self)

carla.GnssEvent(carla.SensorData) class

Instance Variables

  • latitude (float)
  • longitude (float)
  • altitude (float)

Methods

  • __str__(self)

carla.Image(carla.SensorData) class

Class that defines an image of 32-bit BGRA colors.

Instance Variables

  • width (int)
    Image width in pixels.
  • height (int)
    Image height in pixels.
  • fov (float)
    Horizontal field of view of the image in degrees.
  • raw_data (bytes)

Methods

  • convert(self, color_converter)
  • save_to_disk(self, path, color_converter=Raw)
  • __len__(self)
  • __iter__(self)
  • __getitem__(self, pos)
    • Parameters:
      • pos (int)
  • __setitem__(self, pos, color)
  • __str__(self)

carla.LaneInvasionEvent(carla.SensorData) class

Instance Variables

  • actor (carla.Actor)
    Get "self" actor. Actor that invaded another lane.
  • crossed_lane_markings (list(carla.LaneMarking))
    List of lane markings that have been crossed.

Methods

  • __str__(self)

carla.LidarMeasurement(carla.SensorData) class

Instance Variables

  • horizontal_angle (float)
  • channels (int)
  • raw_data (bytes)

Methods

  • get_point_count(self, channel)
    • Parameters:
      • channel (int)
  • save_to_disk(self, path)
    • Parameters:
      • path (str)
  • __len__(self)
  • __iter__(self)
  • __getitem__(self, pos)
    • Parameters:
      • pos (int)
  • __setitem__(self, pos, location)
  • __str__(self)

carla.Location(carla.Vector3D) class

Represents a location in the world (in meters).

Instance Variables

  • x (float)
  • y (float)
  • z (float)

Methods

  • __init__(self, x=0.0, y=0.0, z=0.0)
    • Parameters:
      • x (float)
      • y (float)
      • z (float)
  • distance(self, location)
    Computes the Euclidean distance in meters from this location to another one.
    • Parameters:
      • location (carla.Location) – The Location from where to compute the distance.
    • Return: float
  • __eq__(self, other)
  • __ne__(self, other)
  • __str__(self)

carla.ObstacleDetectionEvent(carla.SensorData) class

Instance Variables

  • actor (carla.Actor)
    Get "self" actor. Actor that measured the collision.
  • other_actor (carla.Actor)
    Get the actor to which we collided.
  • distance (float)
    Get obstacle distance.

Methods

  • __str__(self)

carla.Sensor(carla.Actor) class

Instance Variables

  • is_listening (boolean)
    Is true if the sensor is listening for data.

Methods

  • listen(self, callback)
    • Parameters:
      • callback (function) – Register a callback to be executed each time a new measurement is received. The callback must accept a single argument containing the sensor data; the type of this object varies depending on the type of sensor, but they all derive from carla.SensorData.
  • stop(self)
    Stops listening for data.
  • __str__(self)

carla.TrafficLight(carla.TrafficSign) class

Instance Variables

Methods

  • set_state(self, state)
  • get_state(self)
    Return the current state of the traffic light.
    • Return: carla.TrafficLightState
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • set_green_time(self, green_time)
    • Parameters:
      • green_time (float)
  • get_green_time(self)
    • Return: float
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • set_yellow_time(self, yellow_time)
    • Parameters:
      • yellow_time (float)
  • get_yellow_time(self)
    • Return: float
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • set_red_time(self, red_time)
    • Parameters:
      • red_time (float)
  • get_red_time(self)
    • Return: float
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • get_elapsed_time(self)
    • Return: float
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • freeze(self, freeze)
    • Parameters:
      • freeze (bool)
  • is_frozen(self)
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • get_pole_index(self)
    • Return: int
  • get_group_traffic_lights(self)
    Return all traffic lights in the group this one belongs to.
    • Note: This function calls the simulator.
  • __str__(self)

carla.Vehicle(carla.Actor) class

A vehicle actor.

Instance Variables

Methods

  • apply_control(self, control)
    Apply control to this vehicle. The control will take effect on next tick.
  • get_control(self)
    Return the control last applied to this vehicle.
    • Return: carla.VehicleControl
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • apply_physics_control(self, physics_control)
    Apply physics control to this vehicle. The control will take effect on the next tick.
  • get_physics_control(self)
    Return the physics control last applied to this vehicle.
  • set_autopilot(self, enabled=True)
    Switch on/off this vehicle's server-side autopilot.
    • Parameters:
      • enabled (bool)
  • get_speed_limit(self)
    Return the speed limit currently affecting this vehicle. Note that the speed limit is only updated when passing by a speed limit signal, right after spawning a vehicle it might not reflect the actual speed limit of the current road.
    • Return: float
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • get_traffic_light_state(self)
    Return the state of the traffic light currently affecting this vehicle. If no traffic light is currently affecting the vehicle, return Green.
    • Return: carla.TrafficLightState
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • is_at_traffic_light(self)
    Return whether a traffic light is affecting this vehicle.
    • Return: bool
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • get_traffic_light(self)
    Retrieve the traffic light actor currently affecting this vehicle.
  • __str__(self)
    • Return: str

carla.Walker(carla.Actor) class

A walking actor, pedestrian.

Instance Variables

Methods

  • apply_control(self, control)
    Apply control to this walker. The control will take effect on the next tick.
  • apply_control(self, control)
  • get_control(self)
    Return the control last applied to this walker.
    • Return: carla.WalkerControl
    • Note: This function does not call the simulator, it returns the data received in the last tick.
  • __str__(self)
    • Return: str

command.ApplyAngularVelocity class

Instance Variables

Methods


command.ApplyImpulse class

Instance Variables

Methods


command.ApplyTransform class

Instance Variables

Methods


command.ApplyVehicleControl class

Instance Variables

Methods


command.ApplyVelocity class

Instance Variables

Methods


command.ApplyWalkerControl class

Instance Variables

Methods


command.ApplyWalkerState class

Instance Variables

Methods


command.DestroyActor class

Instance Variables

  • actor_id (int)

Methods

  • __init__(self, actor)

command.Response class

Execution result of a command, contains either an error string or and actor ID, depending on whether or not the command succeeded. See client.apply_batch_sync().

Instance Variables

  • actor_id (int)
  • error (str)

Methods

  • has_error(self)

command.SetAutopilot class

Instance Variables

  • actor_id (int)
  • enabled (bool)

Methods

  • __init__(self, actor, enabled)
    • Parameters:

command.SetSimulatePhysics class

Instance Variables

  • actor_id (int)
  • enabled (bool)

Methods

  • __init__(self, actor, enabled)
    • Parameters:

command.SpawnActor class

Instance Variables

Methods