From 239c4c5acdaaa1a968f64f024a738f6a623e3476 Mon Sep 17 00:00:00 2001 From: "sergi.e" <59253112+sergi-e@users.noreply.github.com> Date: Mon, 30 Mar 2020 11:18:13 +0200 Subject: [PATCH] sergi-e/p098-api (#2638) * Python API iteration p098 * New order enum * Fixed order getters setters * New python api md * New iteration, dunder coded * PythonAPI/docs/doc_gen.py * fix method_name --- Docs/python_api.md | 877 ++++++++++++++++----------------- PythonAPI/docs/actor.yml | 76 ++- PythonAPI/docs/blueprint.yml | 106 ++-- PythonAPI/docs/client.yml | 305 ++++++------ PythonAPI/docs/commands.yml | 2 +- PythonAPI/docs/control.yml | 9 +- PythonAPI/docs/doc_gen.py | 82 ++- PythonAPI/docs/geom.yml | 139 +++--- PythonAPI/docs/map.yml | 155 +++--- PythonAPI/docs/sensor.yml | 22 +- PythonAPI/docs/sensor_data.yml | 48 +- PythonAPI/docs/snapshot.yml | 53 +- PythonAPI/docs/weather.yml | 18 +- PythonAPI/docs/world.yml | 342 +++++++------ 14 files changed, 1113 insertions(+), 1121 deletions(-) diff --git a/Docs/python_api.md b/Docs/python_api.md index 4da4e8899..a3f568c13 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -15,9 +15,6 @@ A list of semantic tags provided by the blueprint listing components for this ac The identifier of the blueprint this actor was based on, e.g. "vehicle.ford.mustang".

Methods

-- **\__str__**(**self**) -Parses a summary of this actor's information to string. - - **Return:** _str_ - **add_impulse**(**self**, **impulse**) Adds an impulse to the actor. - **Parameters:** @@ -66,6 +63,9 @@ Sets the actor's velocity vector. - **Parameters:** - `velocity` (_[carla.Vector3D](#carla.Vector3D)_) +

Dunder methods

+- **\__str__**(**self**) + --- ## carla.ActorAttribute @@ -74,41 +74,35 @@ CARLA provides a library of blueprints for actors that can be accessed as [carla

Instance Variables

- **id** (_str_) The attribute's name and identifier in the library. -- **type** (_[carla.ActorAttributeType](#carla.ActorAttributeType)_) -The attribute's parameter type. -- **recommended_values** (_list(str)_) -A list of values suggested by those who designed the blueprint. - **is_modifiable** (_bool_) It is True if the attribute's value can be modified. +- **recommended_values** (_list(str)_) +A list of values suggested by those who designed the blueprint. +- **type** (_[carla.ActorAttributeType](#carla.ActorAttributeType)_) +The attribute's parameter type.

Methods

- **as_bool**(**self**) Reads the attribute as boolean value. - **as_color**(**self**) Reads the attribute as [carla.Color](#carla.Color). -- **as_int**(**self**) -Reads the attribute as int. - **as_float**(**self**) Reads the attribute as float. +- **as_int**(**self**) +Reads the attribute as int. - **as_str**(**self**) Reads the attribute as string. + +

Dunder methods

- **\__bool__**(**self**) -Internal method to manage the attribute as bool. -- **\__int__**(**self**) -Internal method to manage the attribute as int. - **\__float__**(**self**) -Internal method to manage the attribute as float. +- **\__int__**(**self**) - **\__str__**(**self**) -Parses the attribute ID and its value to string. -- **\__eq__**(**self**, **other**) +- **\__eq__**(**self**, **other**=bool / int / float / str / [carla.Color](#carla.Color) / [carla.ActorAttribute](#carla.ActorAttribute)) Returns true if this actor's attribute and `other` are the same. - - **Parameters:** - - `other` (_bool / int / float / str / [carla.Color](#carla.Color) / [carla.ActorAttribute](#carla.ActorAttribute)_) - **Return:** _bool_ -- **\__ne__**(**self**, **other**) +- **\__ne__**(**self**, **other**=bool / int / float / str / [carla.Color](#carla.Color) / [carla.ActorAttribute](#carla.ActorAttribute)) Returns true if this actor's attribute and `other` are different. - - **Parameters:** - - `other` (_bool / int / float / str / [carla.Color](#carla.Color) / [carla.ActorAttribute](#carla.ActorAttribute)_) - **Return:** _bool_ - **\__nonzero__**(**self**) Returns true if this actor's attribute is not zero or null. @@ -123,8 +117,8 @@ CARLA provides a library of blueprints for actors in [carla.BlueprintLibrary](#c - **Bool** - **Int** - **Float** -- **RGBColor** - **String** +- **RGBColor** --- @@ -138,12 +132,6 @@ The identifier of said blueprint inside the library. E.g. `walker.pedestrian.000 A list of tags each blueprint has that helps describing them. E.g. `['0001', 'pedestrian', 'walker']`.

Methods

-- **\__iter__**(**self**) -Allows iteration within this class. -- **\__len__**(**self**) -Returns the amount of attributes for this blueprint. -- **\__str__**(**self**) -Parses the information of this blueprint to string. - **has_attribute**(**self**, **id**) Returns True if the blueprint contains the attribute `id`. - **Parameters:** @@ -170,25 +158,19 @@ If the `id` attribute is modifiable, changes its value to `value`. - `id` (_str_) – The identifier for the attribute that is intended to be changed. - `value` (_str_) – The new value for said attribute. +

Dunder methods

+- **\__iter__**(**self**) +Allows iteration within this class' attributes. +- **\__len__**(**self**) +Returns the amount of attributes for this blueprint. +- **\__str__**(**self**) + --- ## carla.ActorList A class that contains every actor present on the scene and provides access to them. The list is automatically created and updated by the server and it can be returned using [carla.World](#carla.World).

Methods

-- **\__getitem__**(**self**, **pos**) -Returns the actor corresponding to `pos` position in the list. - - **Parameters:** - - `pos` (_int_) - - **Return:** _[carla.Actor](#carla.Actor)_ -- **\__iter__**(**self**) -Allows the iteration for this object. -- **\__len__**(**self**) -Returns the amount of actors listed. - - **Return:** _int_ -- **\__str__**(**self**) -Parses to the ID for every actor listed. - - **Return:** _str_ - **filter**(**self**, **wildcard_pattern**) Filters a list of Actors matching `wildcard_pattern` against their variable **type_id** (which identifies the blueprint used to spawn them). Matching follows [fnmatch](https://docs.python.org/2/library/fnmatch.html) standard. - **Parameters:** @@ -200,6 +182,19 @@ Finds an actor using its identifier and returns it or None if it is not p - `actor_id` (_int_) - **Return:** _[carla.Actor](#carla.Actor)_ +

Dunder methods

+- **\__getitem__**(**self**, **pos**=int) +Returns the actor corresponding to `pos` position in the list. + - **Return:** _[carla.Actor](#carla.Actor)_ +- **\__iter__**(**self**) +Allows the iteration for the actors in this object. +- **\__len__**(**self**) +Returns the amount of actors listed. + - **Return:** _int_ +- **\__str__**(**self**) +Parses to the ID for every actor listed. + - **Return:** _str_ + --- ## carla.ActorSnapshot @@ -242,19 +237,6 @@ A class that contains the blueprints provided for actor spawning. Its main appli [Here](bp_library.md) is a reference containing every available blueprint and its specifics.

Methods

-- **\__getitem__**(**self**, **pos**) -Returns the blueprint stored in `pos` position inside the data structure containing them. - - **Parameters:** - - `pos` (_int_) - - **Return:** _[carla.ActorBlueprint](#carla.ActorBlueprint)_ -- **\__iter__**(**self**) -Method that allows iteration of this class. -- **\__len__**(**self**) -Returns the amount of blueprints comprising the library. - - **Return:** _int_ -- **\__str__**(**self**) -Parses the identifiers for every blueprint to string. - - **Return:** _string_ - **filter**(**self**, **wildcard_pattern**) Filters a list of blueprints matching the `wildcard_pattern` against the id and tags of every blueprint contained in this library and returns the result as a new one. Matching follows [fnmatch](https://docs.python.org/2/library/fnmatch.html) standard. - **Parameters:** @@ -266,17 +248,30 @@ Returns the blueprint corresponding to that identifier. - `id` (_str_) - **Return:** _[carla.ActorBlueprint](#carla.ActorBlueprint)_ +

Dunder methods

+- **\__getitem__**(**self**, **pos**=int) +Returns the blueprint stored in `pos` position inside the data structure containing them. + - **Return:** _[carla.ActorBlueprint](#carla.ActorBlueprint)_ +- **\__iter__**(**self**) +Method that allows iteration within the blueprints provided. +- **\__len__**(**self**) +Returns the amount of blueprints comprising the library. + - **Return:** _int_ +- **\__str__**(**self**) +Parses the identifiers for every blueprint to string. + - **Return:** _string_ + --- ## carla.BoundingBox Helper class defining a box location and its dimensions that will later be used by [carla.DebugHelper](#carla.DebugHelper) or a [carla.Client](#carla.Client) to draw shapes and detect collisions. Bounding boxes normally act for object colliders. Check out this [recipe](ref_code_recipes.md#debug-bounding-box-recipe) where the user takes a snapshot of the world and then proceeds to draw bounding boxes for traffic lights.

Instance Variables

-- **location** (_[carla.Location](#carla.Location)_) -The center of the bounding box relative to its parent actor. - **extent** (_[carla.Vector3D](#carla.Vector3D)_) Vector from the center of the box to one vertex. The value in each axis equals half the size of the box for that axis. `extent.x * 2` would return the size of the box in the X-axis. +- **location** (_[carla.Location](#carla.Location)_) +The center of the bounding box relative to its parent actor.

Methods

- **\__init__**(**self**, **location**, **extent**) @@ -297,15 +292,13 @@ Returns a list containing the locations of this object's vertices in world space - **Parameters:** - `transform` (_[carla.Transform](#carla.Transform)_) – Contains location and rotation needed to convert this object's local space to world space. - **Return:** _list([carla.Location](#carla.Location))_ -- **\__eq__**(**self**, **other**) + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.BoundingBox](#carla.BoundingBox)) Returns true if both location and extent are equal for this and `other`. - - **Parameters:** - - `other` (_[carla.BoundingBox](#carla.BoundingBox)_) - **Return:** _bool_ -- **\__ne__**(**self**, **other**) +- **\__ne__**(**self**, **other**=[carla.BoundingBox](#carla.BoundingBox)) Returns true if either location or extent are different for this and `other`. - - **Parameters:** - - `other` (_[carla.BoundingBox](#carla.BoundingBox)_) - **Return:** _bool_ - **\__str__**(**self**) Parses the location and extent of the bounding box to string. @@ -328,51 +321,21 @@ Client constructor. - **apply_batch**(**self**, **commands**) Executes a list of commands on a single simulation step and retrieves no information. If you need information about the response of each command, use the **apply_batch_sync()** function right below this one. [Here](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L126) is an example on how to delete the actors that appear in [carla.ActorList](#carla.ActorList) all at once. - **Parameters:** - - `commands` (_list_) – A list of commands to execute in batch. Each command is different and has its own parameters. These are supported so far: - [SpawnActor](#command.SpawnActor) - [DestroyActor](#command.DestroyActor) - [ApplyVehicleControl](#command.ApplyVehicleControl) - [ApplyWalkerControl](#command.ApplyWalkerControl) - [ApplyTransform](#command.ApplyTransform) - [ApplyVelocity](#command.ApplyVelocity) - [ApplyAngularVelocity](#command.ApplyAngularVelocity) - [ApplyImpulse](#command.ApplyImpulse) - [SetSimulatePhysics](#command.SetSimulatePhysics) - [SetAutopilot](#command.SetAutopilot). + - `commands` (_list_) – A list of commands to execute in batch. Each command is different and has its own parameters. They appear listed at the bottom of this page. - **apply_batch_sync**(**self**, **commands**, **due_tick_cue**=False) Executes a list of commands on a single simulation step, blocks until the commands are linked, and returns a list of command.Response that can be used to determine whether a single command succeeded or not. [Here](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L112-L116) is an example of it being used to spawn actors. - **Parameters:** - `commands` (_list_) – A list of commands to execute in batch. The commands available are listed right above, in the function **apply_batch()**. - `due_tick_cue` (_bool_) – A boolean parameter to specify whether or not to perform a [carla.World.tick](#carla.World.tick) after applying the batch in _synchronous mode_. It is __False__ by default. - **Return:** _list(command.Response)_ -- **get_available_maps**(**self**) -Returns a list of strings containing the paths of the maps available on server. These paths are dynamic, they will be created during the simulation and so you will not find them when looking up in your files. One of the possible returns for this method would be: - ['/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)_ -- **get_client_version**(**self**) -Returns the client libcarla version by consulting it in the "Version.h" file. Both client and server can use different libcarla versions but some issues may arise regarding unexpected incompatibilities. - - **Return:** _str_ -- **get_server_version**(**self**) -Returns the server libcarla version by consulting it in the "Version.h" file. Both client and server should use the same libcarla version. - - **Return:** _str_ -- **get_world**(**self**) -Returns the world object currently active in the simulation. This world will be later used for example to load maps. - - **Return:** _[carla.World](#carla.World)_ +- **generate_opendrive_world**(**self**, **opendrive**) +Loads a new world with a basic 3D topology generated from the content of an OpenDRIVE file. This content is passed as a `string` parameter. It is similar to `client.load_world(map_name)` but allows for custom OpenDRIVE maps in server side. Cars can drive around the map, but there are no graphics besides the road and sidewalks. + - **Parameters:** + - `opendrive` (_str_) – Content of an OpenDRIVE file as `string`. - **load_world**(**self**, **map_name**) Creates a new world with default settings using `map_name` map. All actors in the current world will be destroyed. - **Parameters:** - `map_name` (_str_) – Name of the map to be used in this world. Accepts both full paths and map names, e.g. '/Game/Carla/Maps/Town01' or 'Town01'. Remember that these paths are dynamic. -- **get_trafficmanager**(**self**, **client_connection**=8000) -Returns an instance of the traffic manager related to the specified port. If it does not exist, this will be created. - - **Parameters:** - - `client_connection` (_int_) – Port that will be used by the traffic manager. Default is `8000`. - - **Return:** _[carla.TrafficManager](#carla.TrafficManager)_ - **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, __but__ traffic manager instances will stay alive. - **Raises:** RuntimeError when corresponding. @@ -383,18 +346,6 @@ Load a new world with default settings using `map_name` map. All actors present - `start` (_float_) – Time in seconds where to start playing the simulation. Negative is read as beginning from the end, being -10 just 10 seconds before the recording finished. - `duration` (_float_) – Time in seconds that will be reenacted using the information `name` file. If the end is reached, the simulation will continue. - `follow_id` (_int_) – ID of the actor to follow. If this is 0 then camera is disabled. -- **generate_opendrive_world**(**self**, **opendrive**) -Loads a new world with a basic 3D topology generated from the content of an OpenDRIVE file. This content is passed as a `string` parameter. It is similar to `client.load_world(map_name)` but allows for custom OpenDRIVE maps in server side. Cars can drive around the map, but there are no graphics besides the road and sidewalks. - - **Parameters:** - - `opendrive` (_str_) – Content of an OpenDRIVE file as `string`. -- **set_replayer_time_factor**(**self**, **time_factor**=1.0) -When used, the time speed of the reenacted simulation is modified at will. It can be used several times while a playback is in curse. - - **Parameters:** - - `time_factor` (_float_) – 1.0 means normal time speed. Greater than 1.0 means fast motion (2.0 would be double speed) and lesser means slow motion (0.5 would be half speed). -- **set_timeout**(**self**, **seconds**) -Sets in seconds the maxixum time a network call is allowed before blocking it and raising a timeout exceeded error. - - **Parameters:** - - `seconds` (_float_) – New timeout value in seconds. Default is 5 seconds. - **show_recorder_actors_blocked**(**self**, **filename**, **min_time**, **min_distance**) The terminal will show the information registered for actors considered blocked. An actor is considered blocked when it does not move a minimum distance in a period of time, being these `min_distance` and `min_time`. - **Parameters:** @@ -428,11 +379,43 @@ Enables the recording feature, which will start saving every information possibl - `filename` (_str_) – Name of the file to write the recorded data. A simple name will save the recording in 'CarlaUE4/Saved/recording.log'. Otherwise, if some folder appears in the name, it will be considered an absolute path. - **stop_recorder**(**self**) Stops the recording in progress. If you specified a path in `filename`, the recording will be there. If not, look inside `CarlaUE4/Saved/`. +- **get_available_maps**(**self**) +Returns a list of strings containing the paths of the maps available on server. These paths are dynamic, they will be created during the simulation and so you will not find them when looking up in your files. One of the possible returns for this method would be: + ['/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)_ +- **get_client_version**(**self**) +Returns the client libcarla version by consulting it in the "Version.h" file. Both client and server can use different libcarla versions but some issues may arise regarding unexpected incompatibilities. + - **Return:** _str_ +- **get_server_version**(**self**) +Returns the server libcarla version by consulting it in the "Version.h" file. Both client and server should use the same libcarla version. + - **Return:** _str_ +- **get_trafficmanager**(**self**, **client_connection**=8000) +Returns an instance of the traffic manager related to the specified port. If it does not exist, this will be created. + - **Parameters:** + - `client_connection` (_int_) – Port that will be used by the traffic manager. Default is `8000`. + - **Return:** _[carla.TrafficManager](#carla.TrafficManager)_ +- **get_world**(**self**) +Returns the world object currently active in the simulation. This world will be later used for example to load maps. + - **Return:** _[carla.World](#carla.World)_ +- **set_replayer_time_factor**(**self**, **time_factor**=1.0) +When used, the time speed of the reenacted simulation is modified at will. It can be used several times while a playback is in curse. + - **Parameters:** + - `time_factor` (_float_) – 1.0 means normal time speed. Greater than 1.0 means fast motion (2.0 would be double speed) and lesser means slow motion (0.5 would be half speed). +- **set_timeout**(**self**, **seconds**) +Sets in seconds the maxixum time a network call is allowed before blocking it and raising a timeout exceeded error. + - **Parameters:** + - `seconds` (_float_) – New timeout value in seconds. Default is 5 seconds. --- ## carla.CollisionEvent -
Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines a collision data for sensor.other.collision. The sensor creates one of this for every collision detected which may be many for one simulation step. Learn more about this [here](/cameras_and_sensors/#sensorothercollision). +

Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines a collision data for sensor.other.collision. The sensor creates one of this for every collision detected which may be many for one simulation step. Learn more about this [here](ref_sensors.md#collision-detector).

Instance Variables

- **actor** (_[carla.Actor](#carla.Actor)_) @@ -465,12 +448,10 @@ Initializes a color, black by default. - `g` (_int_) - `b` (_int_) - `a` (_int_) -- **\__eq__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.Color](#carla.Color)_) -- **\__ne__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.Color](#carla.Color)_) + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.Color](#carla.Color)) +- **\__ne__**(**self**, **other**=[carla.Color](#carla.Color)) - **\__str__**(**self**) --- @@ -494,21 +475,6 @@ No changes applied to the image. Helper class part of [carla.World](#carla.World) that defines methods for creating debug shapes. By default, shapes last one second. They can be permanent, but take into account the resources needed to do so. Check out this [recipe](ref_code_recipes.md#debug-bounding-box-recipe) where the user takes a snapshot of the world and then proceeds to draw bounding boxes for traffic lights.

Methods

-- **draw_point**(**self**, **location**, **size**=0.1f, **color**=(255,0,0), **life_time**=-1.0f) -Draws a point `location`. - - **Parameters:** - - `location` (_[carla.Location](#carla.Location)_) – Spot in the coordinate system to center the object. - - `size` (_float_) – Density of the point. - - `color` (_[carla.Color](#carla.Color)_) – RGB code to color the object. Red by default. - - `life_time` (_float_) – Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. -- **draw_line**(**self**, **begin**, **end**, **thickness**=0.1f, **color**=(255,0,0), **life_time**=-1.0f) -Draws a line in between `begin` and `end`. - - **Parameters:** - - `begin` (_[carla.Location](#carla.Location)_) – Point in the coordinate system where the line starts. - - `end` (_[carla.Location](#carla.Location)_) – Spot in the coordinate system where the line ends. - - `thickness` (_float_) – Density of the line. - - `color` (_[carla.Color](#carla.Color)_) – RGB code to color the object. Red by default. - - `life_time` (_float_) – Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. - **draw_arrow**(**self**, **begin**, **end**, **thickness**=0.1f, **arrow_size**=0.1f, **color**=(255,0,0), **life_time**=-1.0f) Draws an arrow from `begin` to `end` pointing in that direction. - **Parameters:** @@ -526,6 +492,21 @@ Draws a box, ussually to act for object colliders. - `thickness` (_float_) – Density of the lines that define the box. - `color` (_[carla.Color](#carla.Color)_) – RGB code to color the object. Red by default. - `life_time` (_float_) – Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. +- **draw_line**(**self**, **begin**, **end**, **thickness**=0.1f, **color**=(255,0,0), **life_time**=-1.0f) +Draws a line in between `begin` and `end`. + - **Parameters:** + - `begin` (_[carla.Location](#carla.Location)_) – Point in the coordinate system where the line starts. + - `end` (_[carla.Location](#carla.Location)_) – Spot in the coordinate system where the line ends. + - `thickness` (_float_) – Density of the line. + - `color` (_[carla.Color](#carla.Color)_) – RGB code to color the object. Red by default. + - `life_time` (_float_) – Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. +- **draw_point**(**self**, **location**, **size**=0.1f, **color**=(255,0,0), **life_time**=-1.0f) +Draws a point `location`. + - **Parameters:** + - `location` (_[carla.Location](#carla.Location)_) – Spot in the coordinate system to center the object. + - `size` (_float_) – Density of the point. + - `color` (_[carla.Color](#carla.Color)_) – RGB code to color the object. Red by default. + - `life_time` (_float_) – Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. - **draw_string**(**self**, **location**, **text**, **draw_shadow**=False, **color**=(255,0,0), **life_time**=-1.0f) Draws a string in a given location of the simulation which can only be seen server-side. - **Parameters:** @@ -554,12 +535,10 @@ Quotient between current RPM and MaxRPM where the autonomous gear box should shi - `ratio` (_float_) - `down_ratio` (_float_) - `up_ratio` (_float_) -- **\__eq__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.GearPhysicsControl](#carla.GearPhysicsControl)_) -- **\__ne__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.GearPhysicsControl](#carla.GearPhysicsControl)_) + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.GearPhysicsControl](#carla.GearPhysicsControl)) +- **\__ne__**(**self**, **other**=[carla.GearPhysicsControl](#carla.GearPhysicsControl)) - **\__str__**(**self**) --- @@ -581,12 +560,10 @@ Height regarding ground level. - `latitude` (_float_) - `longitude` (_float_) - `altitude` (_float_) -- **\__eq__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.GeoLocation](#carla.GeoLocation)_) -- **\__ne__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.GeoLocation](#carla.GeoLocation)_) + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.GeoLocation](#carla.GeoLocation)) +- **\__ne__**(**self**, **other**=[carla.GeoLocation](#carla.GeoLocation)) - **\__str__**(**self**) --- @@ -603,6 +580,8 @@ North/South value of a point on the map. West/East value of a point on the map.

Methods

+ +

Dunder methods

- **\__str__**(**self**) --- @@ -619,12 +598,14 @@ Orientation with regard to the North ((0.0, -1.0, 0.0) in Unreal Engine) in radi Angular velocity in rad/sec.

Methods

+ +

Dunder methods

- **\__str__**(**self**) --- ## carla.Image -
Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines an image of 32-bit BGRA colors that will be used as initial data retrieved by camera sensors. There are different camera sensors (currently three, RGB, depth and semantic segmentation) and each of these makes different use for the images. Learn more about them [here](/cameras_and_sensors/). +

Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines an image of 32-bit BGRA colors that will be used as initial data retrieved by camera sensors. There are different camera sensors (currently three, RGB, depth and semantic segmentation) and each of these makes different use for the images. Learn more about them [here](ref_sensors.md).

Instance Variables

- **fov** (_float_) @@ -645,15 +626,12 @@ Saves the image to disk using a converter pattern stated as `color_converter`. T - **Parameters:** - `path` (_str_) – Path that will contain the image. - `color_converter` (_[carla.ColorConverter](#carla.ColorConverter)_) – Default Raw will make no changes. -- **\__len__**(**self**) + +

Dunder methods

+- **\__getitem__**(**self**, **pos**=int) - **\__iter__**(**self**) -- **\__getitem__**(**self**, **pos**) - - **Parameters:** - - `pos` (_int_) -- **\__setitem__**(**self**, **pos**, **color**) - - **Parameters:** - - `pos` (_int_) - - `color` (_[carla.Color](#carla.Color)_) +- **\__len__**(**self**) +- **\__setitem__**(**self**, **pos**=int, **color**=[carla.Color](#carla.Color)) - **\__str__**(**self**) --- @@ -830,17 +808,17 @@ Class that defines the permission to turn either left, right, both or none (mean

Instance Variables

- **NONE** Traffic rules do not allow turning right or left, only going straight. -- **Both** -Traffic rules allow turning either right or left. -- **Left** -Traffic rules allow turning left. - **Right** Traffic rules allow turning right. +- **Left** +Traffic rules allow turning left. +- **Both** +Traffic rules allow turning either right or left. --- ## carla.LaneInvasionEvent -
Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines lanes invasion for sensor.other.lane_invasion. It works only client-side and is dependant on OpenDRIVE to provide reliable information. The sensor creates one of this every time there is a lane invasion, which may be more than once per simulation step. Learn more about this [here](/cameras_and_sensors/#sensorotherlane_invasion). +

Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines lanes invasion for sensor.other.lane_invasion. It works only client-side and is dependant on OpenDRIVE to provide reliable information. The sensor creates one of this every time there is a lane invasion, which may be more than once per simulation step. Learn more about this [here](ref_sensors.md#lane-invasion-detector).

Instance Variables

- **actor** (_[carla.Actor](#carla.Actor)_) @@ -849,6 +827,8 @@ Gets the actor the sensor is attached to, the one that invaded another lane. List of lane markings that have been crossed and detected by the sensor.

Methods

+ +

Dunder methods

- **\__str__**(**self**) --- @@ -889,16 +869,16 @@ __Note on double types:__ Lane markings are defined under the OpenDRIVE standard

Instance Variables

- **NONE** -- **BottsDots** -- **Broken** -- **BrokenBroken** -- **BrokenSolid** -- **Curb** -- **Grass** -- **Solid** -- **SolidBroken** -- **SolidSolid** - **Other** +- **Broken** +- **Solid** +- **SolidSolid** +- **SolidBroken** +- **BrokenSolid** +- **BrokenBroken** +- **BottsDots** +- **Grass** +- **Curb** --- @@ -907,33 +887,33 @@ Class that defines the possible lane types accepted by OpenDRIVE 1.4. This stand

Instance Variables

- **NONE** -- **Bidirectional** -- **Biking** -- **Border** - **Driving** -- **Entry** -- **Exit** -- **Median** -- **OffRamp** -- **OnRamp** -- **Parking** -- **Rail** -- **Restricted** -- **RoadWorks** +- **Stop** - **Shoulder** +- **Biking** - **Sidewalk** +- **Border** +- **Restricted** +- **Parking** +- **Bidirectional** +- **Median** - **Special1** - **Special2** - **Special3** -- **Stop** +- **RoadWorks** - **Tram** +- **Rail** +- **Entry** +- **Exit** +- **OffRamp** +- **OnRamp** - **Any** Every type except for NONE. --- ## carla.LidarMeasurement -
Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines the lidar data retrieved by a sensor.lidar.ray_cast. This essentially simulates a rotating lidar using ray-casting. Learn more about this [here](/cameras_and_sensors/#sensorlidarray_cast). +

Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines the lidar data retrieved by a sensor.lidar.ray_cast. This essentially simulates a rotating lidar using ray-casting. Learn more about this [here](ref_sensors.md#lidar-raycast-sensor).

Instance Variables

- **channels** (_int_) @@ -944,23 +924,20 @@ Horizontal angle the Lidar is rotated at the time of the measurement (in radians List of 3D points received as data.

Methods

-- **get_point_count**(**self**, **channel**) -Retrieves the number of points sorted by channel that are generated by this measure. Sorting by channel allows to identify the original channel for every point. - - **Parameters:** - - `channel` (_int_) - **save_to_disk**(**self**, **path**) Saves the point cloud to disk as a .ply file describing data from 3D scanners. The files generated are ready to be used within [MeshLab](http://www.meshlab.net/), an open source system for processing said files. Just take into account that axis may differ from Unreal Engine and so, need to be reallocated. - **Parameters:** - `path` (_str_) -- **\__len__**(**self**) +- **get_point_count**(**self**, **channel**) +Retrieves the number of points sorted by channel that are generated by this measure. Sorting by channel allows to identify the original channel for every point. + - **Parameters:** + - `channel` (_int_) + +

Dunder methods

+- **\__getitem__**(**self**, **pos**=int) - **\__iter__**(**self**) -- **\__getitem__**(**self**, **pos**) - - **Parameters:** - - `pos` (_int_) -- **\__setitem__**(**self**, **pos**, **location**) - - **Parameters:** - - `pos` (_int_) - - `location` (_[carla.Location](#carla.Location)_) +- **\__len__**(**self**) +- **\__setitem__**(**self**, **pos**=int, **location**=[carla.Location](#carla.Location)) - **\__str__**(**self**) --- @@ -982,25 +959,23 @@ Distance in meters from origin to spot on Z axis. - `x` (_float_) - `y` (_float_) - `z` (_float_) -- **\__eq__**(**self**, **other**) -Returns true if both locations are the same point in space. - - **Parameters:** - - `other` (_[carla.Location](#carla.Location)_) – The other point to be compared with. - - **Return:** _bool_ -- **\__ne__**(**self**, **other**) -Returns true if both locations are different points in space. - - **Parameters:** - - `other` (_[carla.Location](#carla.Location)_) – The other point to be compared with. - - **Return:** _bool_ -- **\__str__**(**self**) -Parses the axis' values to string. - - **Return:** _str_ - **distance**(**self**, **location**) Returns Euclidean distance in meters from this location to another one. - **Parameters:** - `location` (_[carla.Location](#carla.Location)_) – The other point to compute the distance with. - **Return:** _float_ +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.Location](#carla.Location)) +Returns __True__ if both locations are the same point in space. + - **Return:** _bool_ +- **\__ne__**(**self**, **other**=[carla.Location](#carla.Location)) +Returns __True__ if both locations are different points in space. + - **Return:** _bool_ +- **\__str__**(**self**) +Parses the axis' values to string. + - **Return:** _str_ + --- ## carla.Map @@ -1022,6 +997,18 @@ Returns a list of waypoints with a certain distance between them for every lane - **Parameters:** - `distance` (_float_) – Approximate distance between waypoints. - **Return:** _list([carla.Waypoint](#carla.Waypoint))_ +- **save_to_disk**(**self**, **path**) +Saves the .xodr OpenDRIVE file of the current map to disk. + - **Parameters:** + - `path` – Path where the file will be saved. +- **to_opendrive**(**self**) +Returns the .xodr OpenDRIVe file of the current map as string. + - **Return:** _str_ +- **transform_to_geolocation**(**self**, **location**) +Converts a given `location`, a point in the simulation, to a [carla.GeoLocation](#carla.GeoLocation), which represents world coordinates. The geographical location of the map is defined inside OpenDRIVE within the tag . + - **Parameters:** + - `location` (_[carla.Location](#carla.Location)_) + - **Return:** _[carla.GeoLocation](#carla.GeoLocation)_ - **get_spawn_points**(**self**) Returns a list of recommendations made by the creators of the map to be used as spawning points for the vehicles. The list includes [carla.Transform](#carla.Transform) objects with certain location and orientation. Said locations are slightly on-air in order to avoid Z-collisions, so vehicles fall for a bit before starting their way. - **Return:** _list([carla.Transform](#carla.Transform))_ @@ -1043,24 +1030,14 @@ Get a waypoint if all the parameters passed are correct, otherwise return None. - `lane_id` (_int_) – Id of the lane to get the waypoint. - `s` (_float_) – Specify the length from the road start. - **Return:** _[carla.Waypoint](#carla.Waypoint)_ -- **save_to_disk**(**self**, **path**) -Saves the .xodr OpenDRIVE file of the current map to disk. - - **Parameters:** - - `path` – Path where the file will be saved. -- **to_opendrive**(**self**) -Returns the .xodr OpenDRIVe file of the current map as string. - - **Return:** _str_ -- **transform_to_geolocation**(**self**, **location**) -Converts a given `location`, a point in the simulation, to a [carla.GeoLocation](#carla.GeoLocation), which represents world coordinates. The geographical location of the map is defined inside OpenDRIVE within the tag . - - **Parameters:** - - `location` (_[carla.Location](#carla.Location)_) - - **Return:** _[carla.GeoLocation](#carla.GeoLocation)_ + +

Dunder methods

- **\__str__**(**self**) --- ## carla.ObstacleDetectionEvent -
Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines the obstacle data for sensor.other.obstacle. Learn more about this [here](/cameras_and_sensors/#sensorotherobstacle). +

Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines the obstacle data for sensor.other.obstacle. Learn more about this [here](ref_sensors.md#obstacle-detector).

Instance Variables

- **actor** (_[carla.Actor](#carla.Actor)_) @@ -1071,6 +1048,8 @@ The actor or object considered to be an obstacle. Distance between `actor` and `other`.

Methods

+ +

Dunder methods

- **\__str__**(**self**) --- @@ -1089,12 +1068,14 @@ Distance in meters from the sensor to the detection position. The velocity of the detected object towards the sensor in m/s.

Methods

+ +

Dunder methods

- **\__str__**(**self**) --- ## carla.RadarMeasurement -
Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines and gathers the measures registered by a sensor.other.radar, representing a wall of points in front of the sensor with a distance, angle and velocity in relation to it. The data consists of a [carla.RadarDetection](#carla.RadarDetection) array. +

Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines and gathers the measures registered by a sensor.other.radar, representing a wall of points in front of the sensor with a distance, angle and velocity in relation to it. The data consists of a [carla.RadarDetection](#carla.RadarDetection) array. Learn more about this [here](ref_sensors.md#radar-sensor).

Instance Variables

- **raw_data** (_bytes_) @@ -1103,15 +1084,12 @@ The complete information of the [carla.RadarDetection](#carla.RadarDetection) th

Methods

- **get_detection_count**(**self**) Retrieves the number of entries generated, same as **\__str__()**. -- **\__len__**(**self**) + +

Dunder methods

+- **\__getitem__**(**self**, **pos**=int) - **\__iter__**(**self**) -- **\__getitem__**(**self**, **pos**) - - **Parameters:** - - `pos` (_int_) -- **\__setitem__**(**self**, **pos**, **detection**) - - **Parameters:** - - `pos` (_int_) - - `detection` (_[carla.RadarDetection](#carla.RadarDetection)_) +- **\__len__**(**self**) +- **\__setitem__**(**self**, **pos**=int, **detection**=[carla.RadarDetection](#carla.RadarDetection)) - **\__str__**(**self**) --- @@ -1138,15 +1116,13 @@ Degrees around the X-axis. - **get_forward_vector**(**self**) Computes the vector pointing forward according to the orientation of each axis. - **Return:** _[carla.Vector3D](#carla.Vector3D)_ -- **\__eq__**(**self**, **other**) -Returns true if both rotations represent the same orientation of each axis. - - **Parameters:** - - `other` (_[carla.Rotation](#carla.Rotation)_) – The other rotation to be compared with. + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.Rotation](#carla.Rotation)) +Returns __True__ if both rotations represent the same orientation of each axis. - **Return:** _bool_ -- **\__ne__**(**self**, **other**) -Returns true if both rotations represent the same orientation of each axis. - - **Parameters:** - - `other` (_[carla.Rotation](#carla.Rotation)_) – The other rotation to be compared with. +- **\__ne__**(**self**, **other**=[carla.Rotation](#carla.Rotation)) +Returns __True__ if both rotations represent the same orientation for every axis. - **Return:** _bool_ - **\__str__**(**self**) Parses the axis' orientations to string. @@ -1156,19 +1132,19 @@ Parses the axis' orientations to string. ## carla.Sensor
Inherited from _[carla.Actor](#carla.Actor)_

Sensors compound a specific family of actors quite diverse and unique. They are normally spawned as attachment/sons of a vehicle (take a look at [carla.World](#carla.World) to learn about actor spawning). Sensors are thoroughly designed to retrieve different types of data that they are listening to. The data they receive is shaped as different subclasses inherited from [carla.SensorData](#carla.SensorData) (depending on the sensor). - Most sensors can be divided in two groups: those receiving data on every tick (cameras, point clouds and some specific sensors) and those who only receive under certain circumstances (trigger detectors). CARLA provides a specific set of sensors and their blueprint can be found in [carla.BlueprintLibrary](#carla.BlueprintLibrary). All the information on their preferences and settlement can be found [here](/cameras_and_sensors/), but the list of those available in CARLA so far goes as follow: + Most sensors can be divided in two groups: those receiving data on every tick (cameras, point clouds and some specific sensors) and those who only receive under certain circumstances (trigger detectors). CARLA provides a specific set of sensors and their blueprint can be found in [carla.BlueprintLibrary](#carla.BlueprintLibrary). All the information on their preferences and settlement can be found [here](ref_sensors.md), but the list of those available in CARLA so far goes as follow: Receive data on every tick: - - Gnss sensor. - - IMU sensor. - - Radar. - - [Depth camera](/cameras_and_sensors/#sensorcameradepth). - - [Lidar raycast](/cameras_and_sensors/#sensorlidarray_cast). - - [RGB camera](/cameras_and_sensors/#sensorcamerargb). - - [Semantic Segmentation camera](/cameras_and_sensors/#sensorcamerasemantic_segmentation). + - [Gnss sensor](ref_sensors.md#gnss-sensor). + - [IMU sensor](ref_sensors.md#imu-sensor). + - [Radar](ref_sensors.md#radar-sensor). + - [Depth camera](ref_sensors.md#depth-camera). + - [Lidar raycast](ref_sensors.md#lidar-raycast-sensor). + - [RGB camera](ref_sensors.md#rgb-camera). + - [Semantic Segmentation camera](ref_sensors.md#semantic-segmentation-camera). Only receive data when triggered: - - [Collision detector](/cameras_and_sensors/#sensorothercollision). - - [Lane invasion detector](/cameras_and_sensors/#sensorotherlane_invasion). - - [Obstacle detector](/cameras_and_sensors/#sensorotherobstacle). + - [Collision detector](ref_sensors.md#collision-detector). + - [Lane invasion detector](ref_sensors.md#lane-invasion-detector). + - [Obstacle detector](ref_sensors.md#obstacle-detector).

Instance Variables

- **is_listening** (_boolean_) @@ -1181,6 +1157,8 @@ The function the sensor will be calling to every time a new measurement is recei - `callback` (_function_) – The called function with one argument containing the sensor data. - **stop**(**self**) Commands the sensor to stop listening for data. + +

Dunder methods

- **\__str__**(**self**) --- @@ -1226,12 +1204,10 @@ Time register of the frame at which this measurement was taken given by the OS i - `elapsed_seconds` (_float_) - `delta_seconds` (_float_) - `platform_timestamp` (_float_) -- **\__eq__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.Timestamp](#carla.Timestamp)_) -- **\__ne__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.Timestamp](#carla.Timestamp)_) + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.Timestamp](#carla.Timestamp)) +- **\__ne__**(**self**, **other**=[carla.Timestamp](#carla.Timestamp)) - **\__str__**(**self**) --- @@ -1253,17 +1229,17 @@ Stops the traffic light at its current state. - **is_frozen**(**self**) The client returns True if a traffic light is frozen according to last tick. The method does not call the simulator. - **Return:** _bool_ -- **get_pole_index**(**self**) -Returns the index of the pole that identifies it as part of the traffic light group of a junction. - - **Return:** _int_ +- **get_elapsed_time**(**self**) +The client returns the time in seconds since current light state started according to last tick. The method does not call the simulator. + - **Return:** _float_ - **get_group_traffic_lights**(**self**) Returns all traffic lights in the group this one belongs to. - **Return:** _list([carla.TrafficLight](#carla.TrafficLight))_ - **Note:** _This function calls the simulator. _ -- **get_elapsed_time**(**self**) -The client returns the time in seconds since current light state started according to last tick. The method does not call the simulator. - - **Return:** _float_ +- **get_pole_index**(**self**) +Returns the index of the pole that identifies it as part of the traffic light group of a junction. + - **Return:** _int_ - **get_state**(**self**) The client returns the state of the traffic light according to last tick. The method does not call the simulator. - **Return:** _[carla.TrafficLightState](#carla.TrafficLightState)_ @@ -1291,6 +1267,8 @@ Sets a given time (in seconds) for the red state to be active. Sets a given time (in seconds) for the yellow light to be active. - **Parameters:** - `yellow_time` (_float_) + +

Dunder methods

- **\__str__**(**self**) --- @@ -1299,9 +1277,9 @@ Sets a given time (in seconds) for the yellow light to be active. All possible states for traffic lights. These can either change at a specific time step or be changed manually. Take a look at this [recipe](ref_code_recipes.md#traffic-lights-recipe) to see an example.

Instance Variables

-- **Green** - **Red** - **Yellow** +- **Green** - **Off** - **Unknown** @@ -1309,14 +1287,44 @@ All possible states for traffic lights. These can either change at a specific ti ## carla.TrafficManager The traffic manager is a module built on top of the CARLA API in C++. It handles any group of vehicles set to autopilot mode to populate the simulation with realistic urban traffic conditions and give the chance to user to customize some behaviours. The architecture of the traffic manager is divided in five different goal-oriented stages and a PID controller where the information flows until eventually, a [carla.VehicleControl](#carla.VehicleControl) is applied to every vehicle registered in a traffic manager. -In order to learn more, visit the [documentation](../traffic_manager) regarding this module. +In order to learn more, visit the [documentation](adv_traffic_manager.md) regarding this module.

Methods

+- **auto_lane_change**(**self**, **actor**, **enable**) +Turns on or off lane changing behaviour for a vehicle. + - **Parameters:** + - `actor` (_[carla.Actor](#carla.Actor)_) – The vehicle whose settings are changed. + - `enable` (_bool_) – __True__ is default and enables lane changes. __False__ will disable them. +- **collision_detection**(**self**, **reference_actor**, **other_actor**, **detect_collision**) +Tunes on/off collisions between a vehicle and another specific actor. In order to ignore all other vehicles, traffic lights or walkers, use the specific __ignore__ methods described in this same section. + - **Parameters:** + - `reference_actor` (_[carla.Actor](#carla.Actor)_) – Vehicle that is going to ignore collisions. + - `other_actor` (_[carla.Actor](#carla.Actor)_) – The actor that `reference_actor` is going to ignore collisions with. + - `detect_collision` (_bool_) – __True__ is default and enables collisions. __False will disable them. +- **distance_to_leading_vehicle**(**self**, **actor**, **distance**) +Sets the minimum distance in meters that a vehicle has to keep with the others. The distance is in meters and will affect the minimum moving distance. It is computed from front to back of the vehicle objects. + - **Parameters:** + - `actor` (_[carla.Actor](#carla.Actor)_) – Vehicle whose minimum distance is being changed. + - `distance` (_float_) – Meters between both vehicles. - **force_lane_change**(**self**, **actor**, **direction**) Forces a vehicle to change either to the lane on its left or right, if existing, as indicated in `direction`. This method applies the lane change no matter what, disregarding possible collisions. - **Parameters:** - `actor` (_[carla.Actor](#carla.Actor)_) – Vehicle being forced to change lanes. - `direction` (_bool_) – Destination lane. __True__ is the one on the left and __False__ is the right one. +- **global_distance_to_leading_vehicle**(**self**, **distance**) +Sets the minimum distance in meters that vehicles have to keep with the rest. The distance is in meters and will affect the minimum moving distance. It is computed from center to center of the vehicle objects. + - **Parameters:** + - `distance` (_float_) – Meters between vehicles. +- **global_percentage_speed_difference**(**self**, **percentage**) +Sets the difference the vehicle's intended speed and its current speed limit. Speed limits can be exceeded by setting the `perc` to a negative value. +Default is 30. Exceeding a speed limit can be done using negative percentages. + - **Parameters:** + - `percentage` (_float_) – Percentage difference between intended speed and the current limit. +- **ignore_lights_percentage**(**self**, **actor**, **perc**) +During the traffic light stage, which runs every frame, this method sets the percent chance that traffic lights will be ignored for a vehicle. + - **Parameters:** + - `actor` (_[carla.Actor](#carla.Actor)_) – The actor that is going to ignore traffic lights. + - `perc` (_float_) – Between 0 and 100. Amount of times traffic lights will be ignored. - **ignore_vehicles_percentage**(**self**, **actor**, **perc**) During the collision detection stage, which runs every frame, this method sets a percent chance that collisions with another vehicle will be ignored for a vehicle. - **Parameters:** @@ -1327,38 +1335,8 @@ During the collision detection stage, which runs every frame, this method sets a - **Parameters:** - `actor` (_[carla.Actor](#carla.Actor)_) – The vehicle that is going to ignore walkers on scene. - `perc` (_float_) – Between 0 and 100. Amount of times collisions will be ignored. -- **ignore_lights_percentage**(**self**, **actor**, **perc**) -During the traffic light stage, which runs every frame, this method sets the percent chance that traffic lights will be ignored for a vehicle. - - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor)_) – The actor that is going to ignore traffic lights. - - `perc` (_float_) – Between 0 and 100. Amount of times traffic lights will be ignored. - **reset_traffic_lights**(**self**) Resets every traffic light in the map to its initial state. -- **auto_lane_change**(**self**, **actor**, **enable**) -Turns on or off lane changing behaviour for a vehicle. - - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor)_) – The vehicle whose settings are changed. - - `enable` (_bool_) – __True__ is default and enables lane changes. __False__ will disable them. -- **distance_to_leading_vehicle**(**self**, **actor**, **distance**) -Sets the minimum distance in meters that a vehicle has to keep with the others. The distance is in meters and will affect the minimum moving distance. It is computed from front to back of the vehicle objects. - - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor)_) – Vehicle whose minimum distance is being changed. - - `distance` (_float_) – Meters between both vehicles. -- **collision_detection**(**self**, **reference_actor**, **other_actor**, **detect_collision**) -Tunes on/off collisions between a vehicle and another specific actor. In order to ignore all other vehicles, traffic lights or walkers, use the specific __ignore__ methods described in this same section. - - **Parameters:** - - `reference_actor` (_[carla.Actor](#carla.Actor)_) – Vehicle that is going to ignore collisions. - - `other_actor` (_[carla.Actor](#carla.Actor)_) – The actor that `reference_actor` is going to ignore collisions with. - - `detect_collision` (_bool_) – __True__ is default and enables collisions. __False will disable them. -- **global_percentage_speed_difference**(**self**, **percentage**) -Sets the difference the vehicle's intended speed and its current speed limit. Speed limits can be exceeded by setting the `perc` to a negative value. -Default is 30. Exceeding a speed limit can be done using negative percentages. - - **Parameters:** - - `percentage` (_float_) – Percentage difference between intended speed and the current limit. -- **global_distance_to_leading_vehicle**(**self**, **distance**) -Sets the minimum distance in meters that vehicles have to keep with the rest. The distance is in meters and will affect the minimum moving distance. It is computed from center to center of the vehicle objects. - - **Parameters:** - - `distance` (_float_) – Meters between vehicles. - **vehicle_percentage_speed_difference**(**self**, **actor**, **percentage**) Sets the difference the vehicle's intended speed and its current speed limit. Speed limits can be exceeded by setting the `perc` to a negative value. Default is 30. Exceeding a speed limit can be done using negative percentages. @@ -1391,26 +1369,24 @@ Describes a rotation for an object according to Unreal Engine's axis system. - **Parameters:** - `location` (_[carla.Location](#carla.Location)_) - `rotation` (_[carla.Rotation](#carla.Rotation)_) -- **\__eq__**(**self**, **other**) -Returns true if both location and rotation are equal for this and `other`. - - **Parameters:** - - `other` (_[carla.Transform](#carla.Transform)_) - - **Return:** _bool_ -- **\__ne__**(**self**, **other**) -Returns true if any location and rotation are not equal for this and `other`. - - **Parameters:** - - `other` (_[carla.Transform](#carla.Transform)_) - - **Return:** _bool_ -- **\__str__**(**self**) -Parses both location and rotation to string. - - **Return:** _str_ -- **get_forward_vector**(**self**) -Computes a forward vector using its rotation. - - **Return:** _[carla.Vector3D](#carla.Vector3D)_ - **transform**(**self**, **in_point**) Translates a 3D point from global to local coordinates using the current transformation as frame of reference. - **Parameters:** - `in_point` (_[carla.Location](#carla.Location)_) – Location in the space to which the transformation will be applied. +- **get_forward_vector**(**self**) +Computes a forward vector using its rotation. + - **Return:** _[carla.Vector3D](#carla.Vector3D)_ + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.Transform](#carla.Transform)) +Returns __True__ if both location and rotation are equal for this and `other`. + - **Return:** _bool_ +- **\__ne__**(**self**, **other**=[carla.Transform](#carla.Transform)) +Returns __True__ if any location and rotation are not equal for this and `other`. + - **Return:** _bool_ +- **\__str__**(**self**) +Parses both location and rotation to string. + - **Return:** _str_ --- @@ -1428,31 +1404,17 @@ Y-axis value. - **Parameters:** - `x` (_float_) - `y` (_float_) -- **\__add__**(**self**, **other**) -Defines addition between 2D vectors and applies it to this. - - **Parameters:** - - `other` (_[carla.Vector2D](#carla.Vector2D)_) -- **\__sub__**(**self**, **other**) -Defines substraction between 2D vectors and applies it to this. - - **Parameters:** - - `other` (_[carla.Vector2D](#carla.Vector2D)_) -- **\__mul__**(**self**, **other**) -Defines multiplication between 2D vectors and applies it to this. - - **Parameters:** - - `other` (_[carla.Vector2D](#carla.Vector2D)_) -- **\__truediv__**(**self**, **other**) -Defines division between 2D vectors and applies it to this. - - **Parameters:** - - `other` (_[carla.Vector2D](#carla.Vector2D)_) -- **\__eq__**(**self**, **other**) -Returns true if values for every axis are equal. - - **Parameters:** - - `other` (_[carla.Vector2D](#carla.Vector2D)_) + +

Dunder methods

+- **\__add__**(**self**, **other**=[carla.Vector2D](#carla.Vector2D)) +- **\__sub__**(**self**, **other**=[carla.Vector2D](#carla.Vector2D)) +- **\__mul__**(**self**, **other**=[carla.Vector2D](#carla.Vector2D)) +- **\__truediv__**(**self**, **other**=[carla.Vector2D](#carla.Vector2D)) +- **\__eq__**(**self**, **other**=[carla.Vector2D](#carla.Vector2D)) +Returns __True__ if values for every axis are equal. - **Return:** _bool_ -- **\__ne__**(**self**, **bool**) -Returns true if the value for any axis is different. - - **Parameters:** - - `bool` (_[carla.Vector2D](#carla.Vector2D)_) +- **\__ne__**(**self**, **bool**=[carla.Vector2D](#carla.Vector2D)) +Returns __True__ if the value for any axis is different. - **Return:** _bool_ - **\__str__**(**self**) Returns the axis values for the vector parsed as string. @@ -1477,31 +1439,17 @@ Z-axis value. - `x` (_float_) - `y` (_float_) - `z` (_float_) -- **\__add__**(**self**, **other**) -Defines addition between 3D vectors and applies it to this. - - **Parameters:** - - `other` (_[carla.Vector3D](#carla.Vector3D)_) -- **\__sub__**(**self**, **other**) -Defines substraction between 3D vectors and applies it to this. - - **Parameters:** - - `other` (_[carla.Vector3D](#carla.Vector3D)_) -- **\__mul__**(**self**, **other**) -Defines multiplication between 3D vectors and applies it to this. - - **Parameters:** - - `other` (_[carla.Vector3D](#carla.Vector3D)_) -- **\__truediv__**(**self**, **other**) -Defines division between 3D vectors and applies it to this. - - **Parameters:** - - `other` (_[carla.Vector3D](#carla.Vector3D)_) -- **\__eq__**(**self**, **other**) -Returns true if values for every axis are equal. - - **Parameters:** - - `other` (_[carla.Vector3D](#carla.Vector3D)_) + +

Dunder methods

+- **\__add__**(**self**, **other**=[carla.Vector3D](#carla.Vector3D)) +- **\__sub__**(**self**, **other**=[carla.Vector3D](#carla.Vector3D)) +- **\__mul__**(**self**, **other**=[carla.Vector3D](#carla.Vector3D)) +- **\__truediv__**(**self**, **other**=[carla.Vector3D](#carla.Vector3D)) +- **\__eq__**(**self**, **other**=[carla.Vector3D](#carla.Vector3D)) +Returns __True__ if values for every axis are equal. - **Return:** _bool_ -- **\__ne__**(**self**, **other**) -Returns true if the value for any axis is different. - - **Parameters:** - - `other` (_[carla.Vector3D](#carla.Vector3D)_) +- **\__ne__**(**self**, **other**=[carla.Vector3D](#carla.Vector3D)) +Returns __True__ if the value for any axis is different. - **Return:** _bool_ - **\__str__**(**self**) Returns the axis values for the vector parsed as string. @@ -1517,13 +1465,6 @@ Returns the axis values for the vector parsed as string. The vehicle's collider volume.

Methods

-- **get_light_state**(**self**) -Returns a flag representing the vehicle light state, this represents which lights are active or not. - - **Return:** _[carla.VehicleLightState](#carla.VehicleLightState)_ -- **set_light_state**(**self**, **light_state**) -Sets the light state of a vehicle using a VehicleLightState flag, this represents which lights are active or not. - - **Parameters:** - - `light_state` (_[carla.VehicleLightState](#carla.VehicleLightState)_) - **apply_control**(**self**, **control**) Applies a control object on the next tick, containing driving parameters such as throttle, steering or gear shifting. - **Parameters:** @@ -1532,9 +1473,15 @@ Applies a control object on the next tick, containing driving parameters such as Applies a physics control object in the next tick containing the parameters that define the vehicle as a corporeal body. E.g.: moment of inertia, mass, drag coefficient and many more. - **Parameters:** - `physics_control` (_[carla.VehiclePhysicsControl](#carla.VehiclePhysicsControl)_) +- **is_at_traffic_light**(**self**) +Vehicles will be affected by a traffic light when the light is red and the vehicle is inside its bounding box. The client returns whether a traffic light is affecting this vehicle according to last tick (it does not call the simulator). + - **Return:** _bool_ - **get_control**(**self**) The client returns the control applied in the last tick. The method does not call the simulator. - **Return:** _[carla.VehicleControl](#carla.VehicleControl)_ +- **get_light_state**(**self**) +Returns a flag representing the vehicle light state, this represents which lights are active or not. + - **Return:** _[carla.VehicleLightState](#carla.VehicleLightState)_ - **get_physics_control**(**self**) The simulator returns the last physics control applied to this vehicle. - **Return:** _[carla.VehiclePhysicsControl](#carla.VehiclePhysicsControl)_ @@ -1548,15 +1495,17 @@ Retrieves the traffic light actor affecting this vehicle (if any) according to l - **get_traffic_light_state**(**self**) The client returns the state of the traffic light affecting this vehicle according to last tick. The method does not call the simulator. If no traffic light is currently affecting the vehicle, returns green. - **Return:** _[carla.TrafficLightState](#carla.TrafficLightState)_ -- **is_at_traffic_light**(**self**) -Vehicles will be affected by a traffic light when the light is red and the vehicle is inside its bounding box. The client returns whether a traffic light is affecting this vehicle according to last tick (it does not call the simulator). - - **Return:** _bool_ - **set_autopilot**(**self**, **enabled**=True) Turns on/off this vehicle's server-side autopilot. When autopilot mode is on, the vehicle will be conducted by the traffic manager client-side. - **Parameters:** - `enabled` (_bool_) +- **set_light_state**(**self**, **light_state**) +Sets the light state of a vehicle using a VehicleLightState flag, this represents which lights are active or not. + - **Parameters:** + - `light_state` (_[carla.VehicleLightState](#carla.VehicleLightState)_) + +

Dunder methods

- **\__str__**(**self**) - - **Return:** _str_ --- @@ -1580,7 +1529,7 @@ Determines whether the vehicle will be controlled by changing gears manually. De States which gear is the vehicle running on.

Methods

-- **\__init__**(**self**, **throttle**=0.0, **steer**=0.0, **brake**=0.0, **hand_brake**=True, **reverse**=True, **manual_gear_shift**=True, **gear**=0) +- **\__init__**(**self**, **throttle**=0.0, **steer**=0.0, **brake**=0.0, **hand_brake**=False, **reverse**=False, **manual_gear_shift**=False, **gear**=0) - **Parameters:** - `throttle` (_float_) - `steer` (_float_) @@ -1589,12 +1538,10 @@ States which gear is the vehicle running on. - `reverse` (_bool_) - `manual_gear_shift` (_bool_) - `gear` (_int_) -- **\__eq__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.VehicleControl](#carla.VehicleControl)_) -- **\__ne__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.VehicleControl](#carla.VehicleControl)_) + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.VehicleControl](#carla.VehicleControl)) +- **\__ne__**(**self**, **other**=[carla.VehicleControl](#carla.VehicleControl)) - **\__str__**(**self**) --- @@ -1679,12 +1626,10 @@ VehiclePhysicsControl constructor. - `center_of_mass` (_[carla.Vector3D](#carla.Vector3D)_) - `steering_curve` (_[carla.Vector2D](#carla.Vector2D)_) - `wheels` (_list([carla.WheelPhysicsControl](#carla.WheelPhysicsControl))_) -- **\__eq__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.VehiclePhysicsControl](#carla.VehiclePhysicsControl)_) -- **\__ne__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.VehiclePhysicsControl](#carla.VehiclePhysicsControl)_) + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.VehiclePhysicsControl](#carla.VehiclePhysicsControl)) +- **\__ne__**(**self**, **other**=[carla.VehiclePhysicsControl](#carla.VehiclePhysicsControl)) - **\__str__**(**self**) --- @@ -1708,8 +1653,9 @@ On the next tick, the control defines a list of bone transformations that will b - **get_control**(**self**) The client returns the control applied to this walker during last tick. The method does not call the simulator. - **Return:** _[carla.WalkerControl](#carla.WalkerControl)_ + +

Dunder methods

- **\__str__**(**self**) - - **Return:** _str_ --- @@ -1717,18 +1663,20 @@ The client returns the control applied to this walker during last tick. The meth
Inherited from _[carla.Actor](#carla.Actor)_

Class that conducts AI control for a walker. The controllers are defined as actors, but they are quite different from the rest. They need to be attached to a parent actor during their creation, which is the walker they will be controlling (take a look at [carla.World](#carla.World) if you are yet to learn on how to spawn actors). They also need for a special blueprint (already defined in [carla.BlueprintLibrary](#carla.BlueprintLibrary) as "controller.ai.walker"). This is an empty blueprint, as the AI controller will be invisible in the simulation but will follow its parent around to dictate every step of the way.

Methods

-- **start**(**self**) -Enables AI control for its parent walker. -- **stop**(**self**) -Disables AI control for its parent walker. - **go_to_location**(**self**, **destination**) Sets the destination that the pedestrian will reach. - **Parameters:** - `destination` (_[carla.Location](#carla.Location)_) +- **start**(**self**) +Enables AI control for its parent walker. +- **stop**(**self**) +Disables AI control for its parent walker. - **set_max_speed**(**self**, **speed**=1.4) Sets a speed for the walker in meters per second. - **Parameters:** - `speed` (_float_) – speed in m/s. An easy walking speed is set by default. + +

Dunder methods

- **\__str__**(**self**) --- @@ -1745,6 +1693,8 @@ List of tuples where the first value is the bone's name and the second value sto Intializes an object containing moves to be applied on tick. These are listed with the name of the bone and the transform that will be applied to it. - **Parameters:** - `list(name,transform)` (_tuple_) + +

Dunder methods

- **\__str__**(**self**) --- @@ -1768,14 +1718,12 @@ If True, the walker will perform a jump. - `direction` (_[carla.Vector3D](#carla.Vector3D)_) - `speed` (_float_) - `jump` (_bool_) -- **\__eq__**(**self**, **other**) + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.WalkerControl](#carla.WalkerControl)) Compares every variable with `other` and returns True if these are all the same. - - **Parameters:** - - `other` (_[carla.WalkerControl](#carla.WalkerControl)_) -- **\__ne__**(**self**, **other**) +- **\__ne__**(**self**, **other**=[carla.WalkerControl](#carla.WalkerControl)) Compares every variable with `other` and returns True if any of these differ. - - **Parameters:** - - `other` (_[carla.WalkerControl](#carla.WalkerControl)_) - **\__str__**(**self**) --- @@ -1810,14 +1758,6 @@ The right lane marking information based on the direction of the Waypoint. The left lane marking information based on the direction of the Waypoint.

Methods

-- **get_left_lane**(**self**) -Generates a Waypoint at the center of the left lane based on the direction of the current Waypoint, taking into account if the lane change is allowed in this location. -Will return None if the lane does not exist. - - **Return:** _[carla.Waypoint](#carla.Waypoint)_ -- **get_right_lane**(**self**) -Generates a waypoint at the center of the right lane based on the direction of the current waypoint, taking into account if the lane change is allowed in this location. -Will return None if the lane does not exist. - - **Return:** _[carla.Waypoint](#carla.Waypoint)_ - **next**(**self**, **distance**) Returns a list of waypoints at a certain approximate `distance` from the current one. It takes into account the road and its possible deviations without performing any lane change and returns one waypoint per option. The list may be empty if the lane is not connected to any other at the specified distance. @@ -1853,6 +1793,16 @@ Returns a list of landmarks in the road of a specified type from the current way - `type` (_str_) – The type of landmarks to search. - `stop_at_junction` (_bool_) – Enables or disables the landmark search through junctions. - **Return:** _list([carla.Landmark](#carla.Landmark))_ +- **get_left_lane**(**self**) +Generates a Waypoint at the center of the left lane based on the direction of the current Waypoint, taking into account if the lane change is allowed in this location. +Will return None if the lane does not exist. + - **Return:** _[carla.Waypoint](#carla.Waypoint)_ +- **get_right_lane**(**self**) +Generates a waypoint at the center of the right lane based on the direction of the current waypoint, taking into account if the lane change is allowed in this location. +Will return None if the lane does not exist. + - **Return:** _[carla.Waypoint](#carla.Waypoint)_ + +

Dunder methods

- **\__str__**(**self**) --- @@ -1882,7 +1832,7 @@ The azimuth angle of the sun in degrees. Values range from 0 to 360. Zero is an Altitude angle of the sun in degrees. Values range from -90 to 90 corresponding to midnight and midday each.

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) +- **\__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, **fog_density**=0.0, **fog_distance**=0.0, **wetness**=0.0) Method to initialize an object defining weather conditions. This class has some presets for different noon and sunset conditions listed in a note below. - **Parameters:** - `cloudiness` (_float_) – 0 is a clear sky, 100 complete overcast. @@ -1891,8 +1841,13 @@ Method to initialize an object defining weather conditions. This class has some - `wind_intensity` (_float_) – 0 is calm, 100 a strong wind. - `sun_azimuth_angle` (_float_) – 90 is midday, -90 is midnight. - `sun_altitude_angle` (_float_) – 0 is an arbitrary North, 180 its corresponding South. + - `fog_density` (_float_) – Density of the fog, from 0 to 100. + - `fog_distance` (_float_) – Distance where the fog starts in meters. + - `wetness` (_float_) – Humidity percentages of the road, from 0 to 100. - **Note:** _ClearNoon, CloudyNoon, WetNoon, WetCloudyNoon, SoftRainNoon, MidRainyNoon, HardRainNoon, ClearSunset, CloudySunset, WetSunset, WetCloudySunset, SoftRainSunset, MidRainSunset, HardRainSunset. _ + +

Dunder methods

- **\__eq__**(**self**, **other**) Returns True if both objects' variables are the same. - **Return:** _bool_ @@ -1932,12 +1887,10 @@ World position of the wheel. This is a read-only parameter. - `max_brake_torque` (_float_) - `max_handbrake_torque` (_float_) - `position` (_[carla.Vector3D](#carla.Vector3D)_) -- **\__eq__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.WheelPhysicsControl](#carla.WheelPhysicsControl)_) -- **\__ne__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.WheelPhysicsControl](#carla.WheelPhysicsControl)_) + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.WheelPhysicsControl](#carla.WheelPhysicsControl)) +- **\__ne__**(**self**, **other**=[carla.WheelPhysicsControl](#carla.WheelPhysicsControl)) - **\__str__**(**self**) --- @@ -1952,14 +1905,44 @@ The ID of the episode associated with this world. Episodes are different session Responsible for creating different shapes for debugging. Take a look at its class to learn more about it.

Methods

-- **\__str__**(**self**) -The content of the world is parsed and printed as a brief report of its current state. - - **Return:** _string_ - **apply_settings**(**self**, **world_settings**) This method applies settings contained in an object to the simulation running and returns the ID of the frame they were implemented. - **Parameters:** - `world_settings` (_[carla.WorldSettings](#carla.WorldSettings)_) - **Return:** _int_ +- **on_tick**(**self**, **callback**) +The method will start callbacks for a defined function `callback`. It will return the ID for this callback so it can be removed with **remove_on_tick()**. + - **Parameters:** + - `callback` (_[carla.WorldSnapshot](#carla.WorldSnapshot)_) – A defined function with a snapshot as compulsory parameter that will be called every tick. + - **Return:** _int_ +- **remove_on_tick**(**self**, **callback_id**) +Stops the callback for `callback_id` started with **on_tick()**. + - **Parameters:** + - `callback_id` (_callback_) – The callback to be removed. +- **tick**(**self**) +This only has effect on synchronous mode, when both client and server move together. The method tells the server when to step to the next frame and returns the id of the newly started frame. + - **Return:** _int_ +- **wait_for_tick**(**self**, **seconds**=10.0) +The client tells the server to block calling thread until a **world_tick()** is received. + - **Parameters:** + - `seconds` (_float_) – Maximum time in seconds the server should wait for a tick. It is set to 10.0 by default. + - **Return:** _[carla.WorldSnapshot](#carla.WorldSnapshot)_ +- **spawn_actor**(**self**, **blueprint**, **transform**, **attach_to**=None, **attachment**=Rigid) +The method will create, return and spawn an actor into the world. The actor will need an available blueprint to be created and a transform (location and rotation). It can also be attached to a parent with a certain attachment type. + - **Parameters:** + - `blueprint` (_[carla.ActorBlueprint](#carla.ActorBlueprint)_) – The reference from which the actor will be created. + - `transform` (_[carla.Transform](#carla.Transform)_) – Contains the location and orientation the actor will be spawned with. + - `attach_to` (_[carla.Actor](#carla.Actor)_) – The parent object that the spawned actor will follow around. + - `attachment` (_[carla.AttachmentType](#carla.AttachmentType)_) – Determines how fixed and rigorous should be the changes in position according to its parent object. + - **Return:** _[carla.Actor](#carla.Actor)_ +- **try_spawn_actor**(**self**, **blueprint**, **transform**, **attach_to**=None, **attachment**=Rigid) +Same as **spawn_actor()** but returns None on failure instead of throwing an exception. + - **Parameters:** + - `blueprint` (_[carla.ActorBlueprint](#carla.ActorBlueprint)_) – The reference from which the actor will be created. + - `transform` (_[carla.Transform](#carla.Transform)_) – Contains the location and orientation the actor will be spawned with. + - `attach_to` (_[carla.Actor](#carla.Actor)_) – The parent object that the spawned actor will follow around. + - `attachment` (_[carla.AttachmentType](#carla.AttachmentType)_) – Determines how fixed and rigorous should be the changes in position according to its parent object. + - **Return:** _[carla.Actor](#carla.Actor)_ - **get_actor**(**self**, **actor_id**) Looks up for an actor by ID and returns None if not found. - **Parameters:** @@ -1979,55 +1962,27 @@ Returns the object containing the navigation map used to describe this world. - **get_random_location_from_navigation**(**self**) This can only be used with walkers. It retrieves a random location to be used as a destination using the **go_to_location()** method in [carla.WalkerAIController](#carla.WalkerAIController). This location will be part of a sidewalk. Roads, crosswalks and grass zones are excluded. The method does not take into consideration locations of existing actors so if a collision happens when trying to spawn an actor, it will return an error. Take a look at [`spawn_npc.py`](https://github.com/carla-simulator/carla/blob/e73ad54d182e743b50690ca00f1709b08b16528c/PythonAPI/examples/spawn_npc.py#L179) for an example. - **Return:** _[carla.Location](#carla.Location)_ +- **get_settings**(**self**) +Returns an object containing some data about the simulation such as synchrony between client and server or rendering mode. + - **Return:** _[carla.WorldSettings](#carla.WorldSettings)_ - **get_snapshot**(**self**) Returns a snapshot of the world at a certain moment comprising all the information about the actors. - **Return:** _[carla.WorldSnapshot](#carla.WorldSnapshot)_ - **get_spectator**(**self**) Returns the spectator actor. The spectator is a special type of actor created by Unreal Engine, usually with ID=0, that acts as a camera and controls the view in the simulator window. - **Return:** _[carla.Actor](#carla.Actor)_ -- **get_settings**(**self**) -Returns an object containing some data about the simulation such as synchrony between client and server or rendering mode. - - **Return:** _[carla.WorldSettings](#carla.WorldSettings)_ - **get_weather**(**self**) Retrieves an object containing weather parameters currently active in the simulation, mainly cloudiness, precipitation, wind and sun position. - **Return:** _[carla.WeatherParameters](#carla.WeatherParameters)_ -- **on_tick**(**self**, **callback**) -The method will start callbacks for a defined function `callback`. It will return the ID for this callback so it can be removed with **remove_on_tick()**. - - **Parameters:** - - `callback` (_[carla.WorldSnapshot](#carla.WorldSnapshot)_) – A defined function with a snapshot as compulsory parameter that will be called every tick. - - **Return:** _int_ -- **remove_on_tick**(**self**, **callback_id**) -Stops the callback for `callback_id` started with **on_tick()**. - - **Parameters:** - - `callback_id` (_callback_) – The callback to be removed. - **set_weather**(**self**, **weather**) Changes the weather parameteres ruling the simulation to another ones defined in an object. - **Parameters:** - `weather` (_[carla.WeatherParameters](#carla.WeatherParameters)_) – New conditions to be applied. -- **spawn_actor**(**self**, **blueprint**, **transform**, **attach_to**=None, **attachment**=Rigid) -The method will create, return and spawn an actor into the world. The actor will need an available blueprint to be created and a transform (location and rotation). It can also be attached to a parent with a certain attachment type. - - **Parameters:** - - `blueprint` (_[carla.ActorBlueprint](#carla.ActorBlueprint)_) – The reference from which the actor will be created. - - `transform` (_[carla.Transform](#carla.Transform)_) – Contains the location and orientation the actor will be spawned with. - - `attach_to` (_[carla.Actor](#carla.Actor)_) – The parent object that the spawned actor will follow around. - - `attachment` (_[carla.AttachmentType](#carla.AttachmentType)_) – Determines how fixed and rigorous should be the changes in position according to its parent object. - - **Return:** _[carla.Actor](#carla.Actor)_ -- **tick**(**self**) -This only has effect on synchronous mode, when both client and server move together. The method tells the server when to step to the next frame and returns the id of the newly started frame. - - **Return:** _int_ -- **try_spawn_actor**(**self**, **blueprint**, **transform**, **attach_to**=None, **attachment**=Rigid) -Same as **spawn_actor()** but returns None on failure instead of throwing an exception. - - **Parameters:** - - `blueprint` (_[carla.ActorBlueprint](#carla.ActorBlueprint)_) – The reference from which the actor will be created. - - `transform` (_[carla.Transform](#carla.Transform)_) – Contains the location and orientation the actor will be spawned with. - - `attach_to` (_[carla.Actor](#carla.Actor)_) – The parent object that the spawned actor will follow around. - - `attachment` (_[carla.AttachmentType](#carla.AttachmentType)_) – Determines how fixed and rigorous should be the changes in position according to its parent object. - - **Return:** _[carla.Actor](#carla.Actor)_ -- **wait_for_tick**(**self**, **seconds**=10.0) -The client tells the server to block calling thread until a **world_tick()** is received. - - **Parameters:** - - `seconds` (_float_) – Maximum time in seconds the server should wait for a tick. It is set to 10.0 by default. - - **Return:** _[carla.WorldSnapshot](#carla.WorldSnapshot)_ + +

Dunder methods

+- **\__str__**(**self**) +The content of the world is parsed and printed as a brief report of its current state. + - **Return:** _string_ --- @@ -2049,15 +2004,13 @@ Creates an object containing desired settings that could later be applied throug - `synchronous_mode` (_bool_) – Set this to true to enable client-server synchrony. - `no_rendering_mode` (_bool_) – Set this to true to completely disable rendering in the simulation. - `fixed_delta_seconds` (_float_) – Set this time in seconds to get a fixed time-step in between frames. 0.0 means variable time-step and it is the default mode. -- **\__eq__**(**self**, **other**) + +

Dunder methods

+- **\__eq__**(**self**, **other**=[carla.WorldSettings](#carla.WorldSettings)) Returns True if both objects' variables are the same. - - **Parameters:** - - `other` (_[carla.WorldSettings](#carla.WorldSettings)_) – Settings to be compared with. - **Return:** _bool_ -- **\__ne__**(**self**, **other**) +- **\__ne__**(**self**, **other**=[carla.WorldSettings](#carla.WorldSettings)) Returns True if both objects' variables are different. - - **Parameters:** - - `other` (_[carla.WorldSettings](#carla.WorldSettings)_) – Settings to be compared with. - **Return:** _bool_ - **\__str__**(**self**) Parses the established settings to a string and shows them in command line. @@ -2077,21 +2030,6 @@ Simulation frame in which the snapshot was taken. Precise moment in time when snapshot was taken. This class works in seconds as given by the operative system.

Methods

-- **\__eq__**(**self**, **other**) -Returns True if both **timestamp** are the same. - - **Parameters:** - - `other` (_[carla.WorldSnapshot](#carla.WorldSnapshot)_) - - **Return:** _bool_ -- **\__iter__**(**self**) -Method that enables iteration for this class using **timestamp** as reference value. -- **\__ne__**(**self**, **other**) -Returns True if both **timestamp** are different. - - **Parameters:** - - `other` (_[carla.WorldSnapshot](#carla.WorldSnapshot)_) - - **Return:** _bool_ -- **\__len__**(**self**) -Returns the amount of [carla.ActorSnapshot](#carla.ActorSnapshot) present in this snapshot. - - **Return:** _int_ - **find**(**self**, **actor_id**) Given a certain actor ID, returns its corresponding snapshot or None if it is not found. - **Parameters:** @@ -2103,6 +2041,19 @@ Given a certain actor ID, checks if there is a snapshot corresponding it and so, - `actor_id` (_int_) - **Return:** _bool_ +

Dunder methods

+- **\__iter__**(**self**) +Method that enables iteration for this class using **timestamp** as reference value. +- **\__len__**(**self**) +Returns the amount of [carla.ActorSnapshot](#carla.ActorSnapshot) present in this snapshot. + - **Return:** _int_ +- **\__eq__**(**self**, **other**=[carla.WorldSnapshot](#carla.WorldSnapshot)) +Returns __True__ if both **timestamp** are the same. + - **Return:** _bool_ +- **\__ne__**(**self**, **other**=[carla.WorldSnapshot](#carla.WorldSnapshot)) +Returns True if both **timestamp** are different. + - **Return:** _bool_ + --- ## command.ApplyAngularVelocity diff --git a/PythonAPI/docs/actor.yml b/PythonAPI/docs/actor.yml index 5a8298129..2f53a8afa 100644 --- a/PythonAPI/docs/actor.yml +++ b/PythonAPI/docs/actor.yml @@ -31,11 +31,6 @@ # - METHODS ---------------------------- methods: - - def_name: __str__ - return: str - doc: > - Parses a summary of this actor's information to string. - # -------------------------------------- - def_name: add_impulse params: - param_name: impulse @@ -116,6 +111,8 @@ doc: > Sets the actor's velocity vector. # -------------------------------------- + - def_name: __str__ + # -------------------------------------- - class_name: VehicleLightState # - DESCRIPTION ------------------------ doc: > @@ -148,6 +145,7 @@ - var_name: All doc: > All lights on + - class_name: Vehicle parent: carla.Actor # - DESCRIPTION ------------------------ @@ -161,20 +159,6 @@ The vehicle's collider volume. # - METHODS ---------------------------- methods: - - def_name: get_light_state - return: carla.VehicleLightState - doc: > - Returns a flag representing the vehicle light state, - this represents which lights are active or not - # -------------------------------------- - - def_name: set_light_state - params: - - param_name: light_state - type: carla.VehicleLightState - doc: > - Sets the light state of a vehicle using a VehicleLightState flag, - this represents which lights are active or not - # -------------------------------------- - def_name: apply_control params: - param_name: control @@ -189,11 +173,22 @@ doc: > Applies a physics control object in the next tick containing the parameters that define the vehicle as a corporeal body. E.g.: moment of inertia, mass, drag coefficient and many more. # -------------------------------------- + - def_name: is_at_traffic_light + return: bool + doc: > + Vehicles will be affected by a traffic light when the light is red and the vehicle is inside its bounding box. The client returns whether a traffic light is affecting this vehicle according to last tick (it does not call the simulator). + # -------------------------------------- - def_name: get_control return: carla.VehicleControl doc: > The client returns the control applied in the last tick. The method does not call the simulator. # -------------------------------------- + - def_name: get_light_state + return: carla.VehicleLightState + doc: > + Returns a flag representing the vehicle light state, + this represents which lights are active or not + # -------------------------------------- - def_name: get_physics_control return: carla.VehiclePhysicsControl doc: > @@ -216,11 +211,6 @@ The client returns the state of the traffic light affecting this vehicle according to last tick. The method does not call the simulator. If no traffic light is currently affecting the vehicle, returns green. # -------------------------------------- - - def_name: is_at_traffic_light - return: bool - doc: > - Vehicles will be affected by a traffic light when the light is red and the vehicle is inside its bounding box. The client returns whether a traffic light is affecting this vehicle according to last tick (it does not call the simulator). - # -------------------------------------- - def_name: set_autopilot params: - param_name: enabled @@ -229,8 +219,15 @@ doc: > Turns on/off this vehicle's server-side autopilot. When autopilot mode is on, the vehicle will be conducted by the traffic manager client-side. # -------------------------------------- + - def_name: set_light_state + params: + - param_name: light_state + type: carla.VehicleLightState + doc: > + Sets the light state of a vehicle using a VehicleLightState flag, + this represents which lights are active or not + # -------------------------------------- - def_name: __str__ - return: str # -------------------------------------- - class_name: Walker @@ -266,7 +263,6 @@ The client returns the control applied to this walker during last tick. The method does not call the simulator. # -------------------------------------- - def_name: __str__ - return: str # -------------------------------------- - class_name: WalkerAIController @@ -276,6 +272,13 @@ Class that conducts AI control for a walker. The controllers are defined as actors, but they are quite different from the rest. They need to be attached to a parent actor during their creation, which is the walker they will be controlling (take a look at carla.World if you are yet to learn on how to spawn actors). They also need for a special blueprint (already defined in carla.BlueprintLibrary as "controller.ai.walker"). This is an empty blueprint, as the AI controller will be invisible in the simulation but will follow its parent around to dictate every step of the way. # - METHODS ---------------------------- methods: + - def_name: go_to_location + params: + - param_name: destination + type: carla.Location + doc: > + Sets the destination that the pedestrian will reach. + # -------------------------------------- - def_name: start doc: > Enables AI control for its parent walker. @@ -284,13 +287,6 @@ doc: > Disables AI control for its parent walker. # -------------------------------------- - - def_name: go_to_location - params: - - param_name: destination - type: carla.Location - doc: > - Sets the destination that the pedestrian will reach. - # -------------------------------------- - def_name: set_max_speed params: - param_name: speed @@ -322,9 +318,9 @@ All possible states for traffic lights. These can either change at a specific time step or be changed manually. Take a look at this [recipe](ref_code_recipes.md#traffic-lights-recipe) to see an example. # - PROPERTIES ------------------------- instance_variables: - - var_name: Green - var_name: Red - var_name: Yellow + - var_name: Green - var_name: 'Off' - var_name: Unknown # -------------------------------------- @@ -356,10 +352,10 @@ doc: > The client returns True if a traffic light is frozen according to last tick. The method does not call the simulator. # -------------------------------------- - - def_name: get_pole_index - return: int + - def_name: get_elapsed_time + return: float doc: > - Returns the index of the pole that identifies it as part of the traffic light group of a junction. + The client returns the time in seconds since current light state started according to last tick. The method does not call the simulator. # -------------------------------------- - def_name: get_group_traffic_lights return: list(carla.TrafficLight) @@ -368,10 +364,10 @@ note: > This function calls the simulator. # -------------------------------------- - - def_name: get_elapsed_time - return: float + - def_name: get_pole_index + return: int doc: > - The client returns the time in seconds since current light state started according to last tick. The method does not call the simulator. + Returns the index of the pole that identifies it as part of the traffic light group of a junction. # -------------------------------------- - def_name: get_state return: carla.TrafficLightState diff --git a/PythonAPI/docs/blueprint.yml b/PythonAPI/docs/blueprint.yml index 4e7c2b4a0..ebfaab848 100644 --- a/PythonAPI/docs/blueprint.yml +++ b/PythonAPI/docs/blueprint.yml @@ -1,6 +1,6 @@ --- - module_name: carla - doc: > + # - CLASSES ------------------------------ classes: - class_name: ActorAttributeType @@ -12,8 +12,8 @@ - var_name: Bool - var_name: Int - var_name: Float - - var_name: RGBColor - var_name: String + - var_name: RGBColor - class_name: Color # - DESCRIPTION ------------------------ @@ -79,18 +79,18 @@ type: str doc: > The attribute's name and identifier in the library. - - var_name: type - type: carla.ActorAttributeType - doc: > - The attribute's parameter type. - - var_name: recommended_values - type: list(str) - doc: > - A list of values suggested by those who designed the blueprint. - var_name: is_modifiable type: bool doc: > It is True if the attribute's value can be modified. + - var_name: recommended_values + type: list(str) + doc: > + A list of values suggested by those who designed the blueprint. + - var_name: type + type: carla.ActorAttributeType + doc: > + The attribute's parameter type. # - METHODS ---------------------------- methods: - def_name: as_bool @@ -101,33 +101,25 @@ doc: > Reads the attribute as carla.Color. # -------------------------------------- - - def_name: as_int - doc: > - Reads the attribute as int. - # -------------------------------------- - def_name: as_float doc: > Reads the attribute as float. # -------------------------------------- + - def_name: as_int + doc: > + Reads the attribute as int. + # -------------------------------------- - def_name: as_str doc: > Reads the attribute as string. # -------------------------------------- - def_name: __bool__ - doc: > - Internal method to manage the attribute as bool. - # -------------------------------------- - - def_name: __int__ - doc: > - Internal method to manage the attribute as int. # -------------------------------------- - def_name: __float__ - doc: > - Internal method to manage the attribute as float. + # -------------------------------------- + - def_name: __int__ # -------------------------------------- - def_name: __str__ - doc: > - Parses the attribute ID and its value to string. # -------------------------------------- - def_name: __eq__ return: bool @@ -167,18 +159,6 @@ A list of tags each blueprint has that helps describing them. E.g. `['0001', 'pedestrian', 'walker']`. # - METHODS ---------------------------- methods: - - def_name: __iter__ - doc: > - Allows iteration within this class. - # -------------------------------------- - - def_name: __len__ - doc: > - Returns the amount of attributes for this blueprint. - # -------------------------------------- - - def_name: __str__ - doc: > - Parses the information of this blueprint to string. - # -------------------------------------- - def_name: has_attribute return: bool params: @@ -229,6 +209,16 @@ doc: > If the `id` attribute is modifiable, changes its value to `value`. # -------------------------------------- + - def_name: __iter__ + doc: > + Allows iteration within this class' attributes. + # -------------------------------------- + - def_name: __len__ + doc: > + Returns the amount of attributes for this blueprint. + # -------------------------------------- + - def_name: __str__ + # -------------------------------------- - class_name: BlueprintLibrary # - DESCRIPTION ------------------------ @@ -238,28 +228,6 @@ [Here](bp_library.md) is a reference containing every available blueprint and its specifics. # - METHODS ---------------------------- methods: - - def_name: __getitem__ - params: - - param_name: pos - type: int - return: carla.ActorBlueprint - doc: > - Returns the blueprint stored in `pos` position inside the data structure containing them. - # -------------------------------------- - - def_name: __iter__ - doc: > - Method that allows iteration of this class. - # -------------------------------------- - - def_name: __len__ - return: int - doc: > - Returns the amount of blueprints comprising the library. - # -------------------------------------- - - def_name: __str__ - return: string - doc: > - Parses the identifiers for every blueprint to string. - # -------------------------------------- - def_name: filter params: - param_name: wildcard_pattern @@ -276,4 +244,26 @@ doc: > Returns the blueprint corresponding to that identifier. # -------------------------------------- + - def_name: __getitem__ + params: + - param_name: pos + type: int + return: carla.ActorBlueprint + doc: > + Returns the blueprint stored in `pos` position inside the data structure containing them. + # -------------------------------------- + - def_name: __iter__ + doc: > + Method that allows iteration within the blueprints provided. + # -------------------------------------- + - def_name: __len__ + return: int + doc: > + Returns the amount of blueprints comprising the library. + # -------------------------------------- + - def_name: __str__ + return: string + doc: > + Parses the identifiers for every blueprint to string. + # -------------------------------------- ... diff --git a/PythonAPI/docs/client.yml b/PythonAPI/docs/client.yml index 1cb64b595..00b5f8d64 100644 --- a/PythonAPI/docs/client.yml +++ b/PythonAPI/docs/client.yml @@ -40,17 +40,7 @@ - param_name: commands type: list doc: > - A list of commands to execute in batch. Each command is different and has its own parameters. These are supported so far: - [SpawnActor](#command.SpawnActor) - [DestroyActor](#command.DestroyActor) - [ApplyVehicleControl](#command.ApplyVehicleControl) - [ApplyWalkerControl](#command.ApplyWalkerControl) - [ApplyTransform](#command.ApplyTransform) - [ApplyVelocity](#command.ApplyVelocity) - [ApplyAngularVelocity](#command.ApplyAngularVelocity) - [ApplyImpulse](#command.ApplyImpulse) - [SetSimulatePhysics](#command.SetSimulatePhysics) - [SetAutopilot](#command.SetAutopilot) + A list of commands to execute in batch. Each command is different and has its own parameters. They appear listed at the bottom of this page. doc: > Executes a list of commands on a single simulation step and retrieves no information. If you need information about the response of each command, use the **apply_batch_sync()** function right below this one. [Here](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L126) is an example on how to delete the actors that appear in carla.ActorList all at once. @@ -70,36 +60,16 @@ doc: > Executes a list of commands on a single simulation step, blocks until the commands are linked, and returns a list of command.Response that can be used to determine whether a single command succeeded or not. [Here](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L112-L116) is an example of it being used to spawn actors. # -------------------------------------- - - def_name: get_available_maps + - def_name: generate_opendrive_world params: - return: list(str) + - param_name: opendrive + type: str + doc: > + Content of an OpenDRIVE file as `string`. doc: > - Returns a list of strings containing the paths of the maps available on server. These paths are dynamic, they will be created during the simulation and so you will not find them when looking up in your files. One of the possible returns for this method would be: - ['/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'] - # -------------------------------------- - - def_name: get_client_version - params: - return: str - doc: > - Returns the client libcarla version by consulting it in the "Version.h" file. Both client and server can use different libcarla versions but some issues may arise regarding unexpected incompatibilities. - # -------------------------------------- - - def_name: get_server_version - params: - return: str - doc: > - Returns the server libcarla version by consulting it in the "Version.h" file. Both client and server should use the same libcarla version. - # -------------------------------------- - - def_name: get_world - params: - return: carla.World - doc: > - Returns the world object currently active in the simulation. This world will be later used for example to load maps. + Loads a new world with a basic 3D topology generated from the content of an OpenDRIVE file. This content is passed as a `string` parameter. + It is similar to `client.load_world(map_name)` but allows for custom OpenDRIVE maps in server side. + Cars can drive around the map, but there are no graphics besides the road and sidewalks. # -------------------------------------- - def_name: load_world params: @@ -111,17 +81,6 @@ doc: > Creates a new world with default settings using `map_name` map. All actors in the current world will be destroyed. # -------------------------------------- - - def_name: get_trafficmanager - params: - - param_name: client_connection - type: int - default: 8000 - doc: > - Port that will be used by the traffic manager. Default is `8000`. - return: carla.TrafficManager - doc: > - Returns an instance of the traffic manager related to the specified port. If it does not exist, this will be created. - # -------------------------------------- - def_name: reload_world params: raises: RuntimeError when corresponding. @@ -152,36 +111,6 @@ Load a new world with default settings using `map_name` map. All actors present in the current world will be destroyed, __but__ traffic manager instances will stay alive. # -------------------------------------- - - def_name: generate_opendrive_world - params: - - param_name: opendrive - type: str - doc: > - Content of an OpenDRIVE file as `string`. - doc: > - Loads a new world with a basic 3D topology generated from the content of an OpenDRIVE file. This content is passed as a `string` parameter. - It is similar to `client.load_world(map_name)` but allows for custom OpenDRIVE maps in server side. - Cars can drive around the map, but there are no graphics besides the road and sidewalks. - # -------------------------------------- - - def_name: set_replayer_time_factor - params: - - param_name: time_factor - type: float - default: 1.0 - doc: > - 1.0 means normal time speed. Greater than 1.0 means fast motion (2.0 would be double speed) and lesser means slow motion (0.5 would be half speed). - doc: > - When used, the time speed of the reenacted simulation is modified at will. It can be used several times while a playback is in curse. - # -------------------------------------- - - def_name: set_timeout - params: - - param_name: seconds - type: float - doc: > - New timeout value in seconds. Default is 5 seconds. - doc: > - Sets in seconds the maxixum time a network call is allowed before blocking it and raising a timeout exceeded error. - # -------------------------------------- - def_name: show_recorder_actors_blocked params: - param_name: filename @@ -256,16 +185,121 @@ doc: > Stops the recording in progress. If you specified a path in `filename`, the recording will be there. If not, look inside `CarlaUE4/Saved/`. # -------------------------------------- + - def_name: get_available_maps + params: + return: list(str) + doc: > + Returns a list of strings containing the paths of the maps available on server. These paths are dynamic, they will be created during the simulation and so you will not find them when looking up in your files. One of the possible returns for this method would be: + ['/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'] + # -------------------------------------- + - def_name: get_client_version + params: + return: str + doc: > + Returns the client libcarla version by consulting it in the "Version.h" file. Both client and server can use different libcarla versions but some issues may arise regarding unexpected incompatibilities. + # -------------------------------------- + - def_name: get_server_version + params: + return: str + doc: > + Returns the server libcarla version by consulting it in the "Version.h" file. Both client and server should use the same libcarla version. + # -------------------------------------- + - def_name: get_trafficmanager + params: + - param_name: client_connection + type: int + default: 8000 + doc: > + Port that will be used by the traffic manager. Default is `8000`. + return: carla.TrafficManager + doc: > + Returns an instance of the traffic manager related to the specified port. If it does not exist, this will be created. + # -------------------------------------- + - def_name: get_world + params: + return: carla.World + doc: > + Returns the world object currently active in the simulation. This world will be later used for example to load maps. + # -------------------------------------- + - def_name: set_replayer_time_factor + params: + - param_name: time_factor + type: float + default: 1.0 + doc: > + 1.0 means normal time speed. Greater than 1.0 means fast motion (2.0 would be double speed) and lesser means slow motion (0.5 would be half speed). + doc: > + When used, the time speed of the reenacted simulation is modified at will. It can be used several times while a playback is in curse. + # -------------------------------------- + - def_name: set_timeout + params: + - param_name: seconds + type: float + doc: > + New timeout value in seconds. Default is 5 seconds. + doc: > + Sets in seconds the maxixum time a network call is allowed before blocking it and raising a timeout exceeded error. + # -------------------------------------- + - class_name: TrafficManager # - DESCRIPTION ------------------------ doc: > The traffic manager is a module built on top of the CARLA API in C++. It handles any group of vehicles set to autopilot mode to populate the simulation with realistic urban traffic conditions and give the chance to user to customize some behaviours. The architecture of the traffic manager is divided in five different goal-oriented stages and a PID controller where the information flows until eventually, a carla.VehicleControl is applied to every vehicle registered in a traffic manager. - In order to learn more, visit the [documentation](../traffic_manager) regarding this module. + In order to learn more, visit the [documentation](adv_traffic_manager.md) regarding this module. # - PROPERTIES ------------------------- instance_variables: # - METHODS ---------------------------- methods: + - def_name: auto_lane_change + params: + - param_name: actor + type: carla.Actor + doc: > + The vehicle whose settings are changed. + - param_name: enable + type: bool + doc: > + __True__ is default and enables lane changes. __False__ will disable them. + doc: > + Turns on or off lane changing behaviour for a vehicle. + # -------------------------------------- + - def_name: collision_detection + params: + - param_name: reference_actor + type: carla.Actor + doc: > + Vehicle that is going to ignore collisions. + - param_name: other_actor + type: carla.Actor + doc: > + The actor that `reference_actor` is going to ignore collisions with. + - param_name: detect_collision + type: bool + doc: > + __True__ is default and enables collisions. __False will disable them. + doc: > + Tunes on/off collisions between a vehicle and another specific actor. In order to ignore all other vehicles, traffic lights or walkers, use the specific __ignore__ methods described in this same section. + # -------------------------------------- + - def_name: distance_to_leading_vehicle + params: + - param_name: actor + type: carla.Actor + doc: > + Vehicle whose minimum distance is being changed. + - param_name: distance + type: float + doc: > + Meters between both vehicles. + doc: > + Sets the minimum distance in meters that a vehicle has to keep with the others. The distance is in meters and will affect the minimum moving distance. It is computed from front to back of the vehicle objects. + # -------------------------------------- - def_name: force_lane_change params: - param_name: actor @@ -279,6 +313,39 @@ doc: > Forces a vehicle to change either to the lane on its left or right, if existing, as indicated in `direction`. This method applies the lane change no matter what, disregarding possible collisions. # -------------------------------------- + - def_name: global_distance_to_leading_vehicle + params: + - param_name: distance + type: float + doc: > + Meters between vehicles. + doc: > + Sets the minimum distance in meters that vehicles have to keep with the rest. The distance is in meters and will affect the minimum moving distance. It is computed from center to center of the vehicle objects. + # -------------------------------------- + - def_name: global_percentage_speed_difference + params: + - param_name: percentage + type: float + doc: > + Percentage difference between intended speed and the current limit. + doc: > + Sets the difference the vehicle's intended speed and its current speed limit. Speed limits can be exceeded by setting the `perc` to a negative value. + + Default is 30. Exceeding a speed limit can be done using negative percentages. + # -------------------------------------- + - def_name: ignore_lights_percentage + params: + - param_name: actor + type: carla.Actor + doc: > + The actor that is going to ignore traffic lights. + - param_name: perc + type: float + doc: > + Between 0 and 100. Amount of times traffic lights will be ignored. + doc: > + During the traffic light stage, which runs every frame, this method sets the percent chance that traffic lights will be ignored for a vehicle. + # -------------------------------------- - def_name: ignore_vehicles_percentage params: - param_name: actor @@ -305,86 +372,10 @@ doc: > During the collision detection stage, which runs every frame, this method sets a percent chance that collisions with walkers will be ignored for a vehicle. # -------------------------------------- - - def_name: ignore_lights_percentage - params: - - param_name: actor - type: carla.Actor - doc: > - The actor that is going to ignore traffic lights. - - param_name: perc - type: float - doc: > - Between 0 and 100. Amount of times traffic lights will be ignored. - doc: > - During the traffic light stage, which runs every frame, this method sets the percent chance that traffic lights will be ignored for a vehicle. - # -------------------------------------- - def_name: reset_traffic_lights doc: > Resets every traffic light in the map to its initial state. # -------------------------------------- - - def_name: auto_lane_change - params: - - param_name: actor - type: carla.Actor - doc: > - The vehicle whose settings are changed. - - param_name: enable - type: bool - doc: > - __True__ is default and enables lane changes. __False__ will disable them. - doc: > - Turns on or off lane changing behaviour for a vehicle. - # -------------------------------------- - - def_name: distance_to_leading_vehicle - params: - - param_name: actor - type: carla.Actor - doc: > - Vehicle whose minimum distance is being changed. - - param_name: distance - type: float - doc: > - Meters between both vehicles. - doc: > - Sets the minimum distance in meters that a vehicle has to keep with the others. The distance is in meters and will affect the minimum moving distance. It is computed from front to back of the vehicle objects. - # -------------------------------------- - - def_name: collision_detection - params: - - param_name: reference_actor - type: carla.Actor - doc: > - Vehicle that is going to ignore collisions. - - param_name: other_actor - type: carla.Actor - doc: > - The actor that `reference_actor` is going to ignore collisions with. - - param_name: detect_collision - type: bool - doc: > - __True__ is default and enables collisions. __False will disable them. - doc: > - Tunes on/off collisions between a vehicle and another specific actor. In order to ignore all other vehicles, traffic lights or walkers, use the specific __ignore__ methods described in this same section. - # -------------------------------------- - - def_name: global_percentage_speed_difference - params: - - param_name: percentage - type: float - doc: > - Percentage difference between intended speed and the current limit. - doc: > - Sets the difference the vehicle's intended speed and its current speed limit. Speed limits can be exceeded by setting the `perc` to a negative value. - - Default is 30. Exceeding a speed limit can be done using negative percentages. - # -------------------------------------- - - def_name: global_distance_to_leading_vehicle - params: - - param_name: distance - type: float - doc: > - Meters between vehicles. - doc: > - Sets the minimum distance in meters that vehicles have to keep with the rest. The distance is in meters and will affect the minimum moving distance. It is computed from center to center of the vehicle objects. - # -------------------------------------- - def_name: vehicle_percentage_speed_difference params: - param_name: actor diff --git a/PythonAPI/docs/commands.yml b/PythonAPI/docs/commands.yml index 0441f3869..1b1e56d1f 100644 --- a/PythonAPI/docs/commands.yml +++ b/PythonAPI/docs/commands.yml @@ -1,6 +1,6 @@ --- - module_name: command - doc: > + classes: - class_name: Response # - DESCRIPTION ------------------------ diff --git a/PythonAPI/docs/control.yml b/PythonAPI/docs/control.yml index ea5b3a90b..4385d213a 100644 --- a/PythonAPI/docs/control.yml +++ b/PythonAPI/docs/control.yml @@ -1,6 +1,6 @@ --- - module_name: carla - doc: > + # - CLASSES ------------------------------ classes: - class_name: VehicleControl @@ -59,13 +59,13 @@ default: 0.0 - param_name: hand_brake type: bool - default: True + default: False - param_name: reverse type: bool - default: True + default: False - param_name: manual_gear_shift type: bool - default: True + default: False - param_name: gear type: int default: 0 @@ -74,6 +74,7 @@ params: - param_name: other type: carla.VehicleControl + # -------------------------------------- - def_name: __ne__ params: - param_name: other diff --git a/PythonAPI/docs/doc_gen.py b/PythonAPI/docs/doc_gen.py index be9a0a77c..ac42fcc72 100755 --- a/PythonAPI/docs/doc_gen.py +++ b/PythonAPI/docs/doc_gen.py @@ -257,6 +257,42 @@ def gen_doc_method_def(method, is_indx=False, with_self=True): param = param[:-2] # delete the last ', ' return join([method_name, parentheses(param)]) +def gen_doc_dunder_def(dunder, is_indx=False, with_self=True): + """Return python def as it should be written in docs""" + param = '' + dunder_name = dunder['def_name'] + if valid_dic_val(dunder, 'static'): + with_self = False + + # to correclty render methods like __init__ in md + if dunder_name[0] == '_': + dunder_name = '\\' + dunder_name + if is_indx: + dunder_name = bold(dunder_name) + else: + dunder_name = bold(color(COLOR_METHOD, dunder_name)) + + if with_self: + if not 'params' in dunder or dunder['params'] is None: + dunder['params'] = [] + dunder['params'].insert(0, {'param_name': 'self'}) + + if valid_dic_val(dunder, 'params'): + for p in dunder['params']: + default = join(['=', str(p['type'])]) if 'type' in p else '' + if is_indx: + param = join([param, bold(p['param_name']), default, ', ']) + else: + param = join([param, color(COLOR_PARAM, bold(p['param_name']) + create_hyperlinks(default)), ', ']) + + if with_self: + dunder['params'] = dunder['params'][1:] + if not dunder['params']: # if is empty delete it + del dunder['params'] + + param = param[:-2] # delete the last ', ' + return join([dunder_name, parentheses(param)]) + def gen_inst_var_indx(inst_var, class_key): inst_var_name = inst_var['var_name'] @@ -347,6 +383,38 @@ def add_doc_method(md, method, class_key): md.list_pop() +def add_doc_dunder(md, dunder, class_key): + dunder_name = dunder['def_name'] + dunder_key = join([class_key, dunder_name], '.') + dunder_def = gen_doc_dunder_def(dunder, False) + md.list_pushn(join([html_key(dunder_key), dunder_def])) + + # Dunder doc + if valid_dic_val(dunder, 'doc'): + md.textn(create_hyperlinks(md.prettify_doc(dunder['doc']))) + + # Return doc + if valid_dic_val(dunder, 'return'): + md.list_push(bold('Return:') + ' ') + md.textn(italic(create_hyperlinks(dunder['return']))) + md.list_pop() + + md.list_pop() + +def add_doc_dunder_param(md, param): + param_name = param['param_name'] + param_type = '' + if valid_dic_val(param, 'type'): + param_type = create_hyperlinks(param['type']) + param_type = '' if not param_type else parentheses(italic(param_type)) + md.list_push(code(param_name)) + if param_type: + md.text(' ' + param_type) + md.new_line() + else: + md.new_line() + md.list_pop() + def add_doc_inst_var(md, inst_var, class_key): var_name = inst_var['var_name'] @@ -466,9 +534,21 @@ class Documentation: add_doc_inst_var(md, inst_var, class_key) # Generate method doc (if any) if valid_dic_val(cl, 'methods'): - md.title_html(3, 'Methods') + method_list = list() + dunder_list = list() for method in cl['methods']: + method_name = method['def_name'] + if method_name[0] == '_' and method_name != '__init__': + dunder_list.append(method) + else: + method_list.append(method) + md.title_html(3, 'Methods') + for method in method_list: add_doc_method(md, method, class_key) + if len(dunder_list)>0: + md.title_html(3, 'Dunder methods') + for method in dunder_list: + add_doc_dunder(md, method, class_key) md.separator() return md.data().strip() diff --git a/PythonAPI/docs/geom.yml b/PythonAPI/docs/geom.yml index f559058ad..96c2d283c 100644 --- a/PythonAPI/docs/geom.yml +++ b/PythonAPI/docs/geom.yml @@ -30,29 +30,21 @@ params: - param_name: other type: carla.Vector2D - doc: > - Defines addition between 2D vectors and applies it to this. # -------------------------------------- - def_name: __sub__ params: - param_name: other type: carla.Vector2D - doc: > - Defines substraction between 2D vectors and applies it to this. # -------------------------------------- - def_name: __mul__ params: - param_name: other type: carla.Vector2D - doc: > - Defines multiplication between 2D vectors and applies it to this. # -------------------------------------- - def_name: __truediv__ params: - param_name: other type: carla.Vector2D - doc: > - Defines division between 2D vectors and applies it to this. # -------------------------------------- - def_name: __eq__ return: bool @@ -60,7 +52,7 @@ - param_name: other type: carla.Vector2D doc: > - Returns true if values for every axis are equal. + Returns __True__ if values for every axis are equal. # -------------------------------------- - def_name: __ne__ return: bool @@ -68,7 +60,7 @@ - param_name: bool type: carla.Vector2D doc: > - Returns true if the value for any axis is different. + Returns __True__ if the value for any axis is different. # -------------------------------------- - def_name: __str__ return: str @@ -112,29 +104,21 @@ params: - param_name: other type: carla.Vector3D - doc: > - Defines addition between 3D vectors and applies it to this. # -------------------------------------- - def_name: __sub__ params: - param_name: other type: carla.Vector3D - doc: > - Defines substraction between 3D vectors and applies it to this. # -------------------------------------- - def_name: __mul__ params: - param_name: other type: carla.Vector3D - doc: > - Defines multiplication between 3D vectors and applies it to this. # -------------------------------------- - def_name: __truediv__ params: - param_name: other type: carla.Vector3D - doc: > - Defines division between 3D vectors and applies it to this. # -------------------------------------- - def_name: __eq__ params: @@ -142,7 +126,7 @@ type: carla.Vector3D return: bool doc: > - Returns true if values for every axis are equal. + Returns __True__ if values for every axis are equal. # -------------------------------------- - def_name: __ne__ params: @@ -150,7 +134,7 @@ type: carla.Vector3D return: bool doc: > - Returns true if the value for any axis is different. + Returns __True__ if the value for any axis is different. # -------------------------------------- - def_name: __str__ return: str @@ -191,31 +175,6 @@ type: float default: 0.0 # -------------------------------------- - - def_name: __eq__ - return: bool - params: - - param_name: other - type: carla.Location - doc: > - The other point to be compared with. - doc: > - Returns true if both locations are the same point in space. - # -------------------------------------- - - def_name: __ne__ - return: bool - params: - - param_name: other - type: carla.Location - doc: > - The other point to be compared with. - doc: > - Returns true if both locations are different points in space. - # -------------------------------------- - - def_name: __str__ - return: str - doc: > - Parses the axis' values to string. - # -------------------------------------- - def_name: distance params: - param_name: location @@ -226,6 +185,27 @@ doc: > Returns Euclidean distance in meters from this location to another one. # -------------------------------------- + - def_name: __eq__ + return: bool + params: + - param_name: other + type: carla.Location + doc: > + Returns __True__ if both locations are the same point in space. + # -------------------------------------- + - def_name: __ne__ + return: bool + params: + - param_name: other + type: carla.Location + doc: > + Returns __True__ if both locations are different points in space. + # -------------------------------------- + - def_name: __str__ + return: str + doc: > + Parses the axis' values to string. + # -------------------------------------- - class_name: Rotation # - DESCRIPTION ------------------------ @@ -280,20 +260,16 @@ params: - param_name: other type: carla.Rotation - doc: > - The other rotation to be compared with. doc: > - Returns true if both rotations represent the same orientation of each axis. + Returns __True__ if both rotations represent the same orientation of each axis. # -------------------------------------- - def_name: __ne__ params: - param_name: other type: carla.Rotation - doc: > - The other rotation to be compared with. return: bool doc: > - Returns true if both rotations represent the same orientation of each axis. + Returns __True__ if both rotations represent the same orientation for every axis. # -------------------------------------- - def_name: __str__ doc: > @@ -323,32 +299,6 @@ - param_name: rotation type: carla.Rotation # -------------------------------------- - - def_name: __eq__ - return: bool - params: - - param_name: other - type: carla.Transform - doc: > - Returns true if both location and rotation are equal for this and `other`. - # -------------------------------------- - - def_name: __ne__ - return: bool - params: - - param_name: other - type: carla.Transform - doc: > - Returns true if any location and rotation are not equal for this and `other`. - # -------------------------------------- - - def_name: __str__ - return: str - doc: > - Parses both location and rotation to string. - # -------------------------------------- - - def_name: get_forward_vector - return: carla.Vector3D - doc: > - Computes a forward vector using its rotation. - # -------------------------------------- - def_name: transform params: - param_name: in_point @@ -358,6 +308,32 @@ doc: > Translates a 3D point from global to local coordinates using the current transformation as frame of reference. # -------------------------------------- + - def_name: get_forward_vector + return: carla.Vector3D + doc: > + Computes a forward vector using its rotation. + # -------------------------------------- + - def_name: __eq__ + return: bool + params: + - param_name: other + type: carla.Transform + doc: > + Returns __True__ if both location and rotation are equal for this and `other`. + # -------------------------------------- + - def_name: __ne__ + return: bool + params: + - param_name: other + type: carla.Transform + doc: > + Returns __True__ if any location and rotation are not equal for this and `other`. + # -------------------------------------- + - def_name: __str__ + return: str + doc: > + Parses both location and rotation to string. + # -------------------------------------- - class_name: BoundingBox # - DESCRIPTION ------------------------ @@ -365,16 +341,16 @@ Helper class defining a box location and its dimensions that will later be used by carla.DebugHelper or a carla.Client to draw shapes and detect collisions. Bounding boxes normally act for object colliders. Check out this [recipe](ref_code_recipes.md#debug-bounding-box-recipe) where the user takes a snapshot of the world and then proceeds to draw bounding boxes for traffic lights. # - PROPERTIES ------------------------- instance_variables: - - var_name: location - type: carla.Location - doc: > - The center of the bounding box relative to its parent actor. - var_name: extent type: carla.Vector3D doc: > Vector from the center of the box to one vertex. The value in each axis equals half the size of the box for that axis. `extent.x * 2` would return the size of the box in the X-axis. + - var_name: location + type: carla.Location + doc: > + The center of the bounding box relative to its parent actor. # - METHODS ---------------------------- methods: - def_name: __init__ @@ -482,6 +458,5 @@ type: carla.GeoLocation # -------------------------------------- - def_name: __str__ - params: # -------------------------------------- ... diff --git a/PythonAPI/docs/map.yml b/PythonAPI/docs/map.yml index b8dff3982..dd70060a4 100644 --- a/PythonAPI/docs/map.yml +++ b/PythonAPI/docs/map.yml @@ -1,6 +1,5 @@ --- - module_name: carla - doc: > # - CLASSES ------------------------------ classes: - class_name: LaneType @@ -11,46 +10,46 @@ instance_variables: - var_name: NONE doc: > - - var_name: Bidirectional - doc: > - - var_name: Biking - doc: > - - var_name: Border - doc: > - var_name: Driving doc: > - - var_name: Entry - doc: > - - var_name: Exit - doc: > - - var_name: Median - doc: > - - var_name: OffRamp - doc: > - - var_name: OnRamp - doc: > - - var_name: Parking - doc: > - - var_name: Rail - doc: > - - var_name: Restricted - doc: > - - var_name: RoadWorks + - var_name: Stop doc: > - var_name: Shoulder doc: > + - var_name: Biking + doc: > - var_name: Sidewalk doc: > + - var_name: Border + doc: > + - var_name: Restricted + doc: > + - var_name: Parking + doc: > + - var_name: Bidirectional + doc: > + - var_name: Median + doc: > - var_name: Special1 doc: > - var_name: Special2 doc: > - var_name: Special3 doc: > - - var_name: Stop + - var_name: RoadWorks doc: > - var_name: Tram doc: > + - var_name: Rail + doc: > + - var_name: Entry + doc: > + - var_name: Exit + doc: > + - var_name: OffRamp + doc: > + - var_name: OnRamp + doc: > - var_name: Any doc: > Every type except for NONE. @@ -64,15 +63,15 @@ - var_name: NONE doc: > Traffic rules do not allow turning right or left, only going straight. - - var_name: Both - doc: > - Traffic rules allow turning either right or left. - - var_name: Left - doc: > - Traffic rules allow turning left. - var_name: Right doc: > Traffic rules allow turning right. + - var_name: Left + doc: > + Traffic rules allow turning left. + - var_name: Both + doc: > + Traffic rules allow turning either right or left. - class_name: LaneMarkingColor # - DESCRIPTION ------------------------ @@ -106,25 +105,25 @@ instance_variables: - var_name: NONE doc: > - - var_name: BottsDots + - var_name: Other doc: > - var_name: Broken doc: > - - var_name: BrokenBroken - doc: > - - var_name: BrokenSolid - doc: > - - var_name: Curb - doc: > - - var_name: Grass - doc: > - var_name: Solid doc: > - - var_name: SolidBroken - doc: > - var_name: SolidSolid doc: > - - var_name: Other + - var_name: SolidBroken + doc: > + - var_name: BrokenSolid + doc: > + - var_name: BrokenBroken + doc: > + - var_name: BottsDots + doc: > + - var_name: Grass + doc: > + - var_name: Curb doc: > - class_name: Map @@ -163,6 +162,27 @@ doc: > Returns a list of waypoints with a certain distance between them for every lane and centered inside of it. Waypoints are not listed in any particular order. Remember that waypoints closer than 2cm within the same road, section and lane will have the same identificator. # -------------------------------------- + - def_name: save_to_disk + params: + - param_name: path + doc: > + Path where the file will be saved. + doc: > + Saves the .xodr OpenDRIVE file of the current map to disk. + # -------------------------------------- + - def_name: to_opendrive + doc: > + Returns the .xodr OpenDRIVe file of the current map as string. + return: str + # -------------------------------------- + - def_name: transform_to_geolocation + params: + - param_name: location + type: carla.Location + return: carla.GeoLocation + doc: > + Converts a given `location`, a point in the simulation, to a carla.GeoLocation, which represents world coordinates. The geographical location of the map is defined inside OpenDRIVE within the tag . + # -------------------------------------- - def_name: get_spawn_points return: list(carla.Transform) doc: > @@ -212,27 +232,6 @@ Specify the length from the road start return: carla.Waypoint # -------------------------------------- - - def_name: save_to_disk - params: - - param_name: path - doc: > - Path where the file will be saved. - doc: > - Saves the .xodr OpenDRIVE file of the current map to disk. - # -------------------------------------- - - def_name: to_opendrive - doc: > - Returns the .xodr OpenDRIVe file of the current map as string. - return: str - # -------------------------------------- - - def_name: transform_to_geolocation - params: - - param_name: location - type: carla.Location - return: carla.GeoLocation - doc: > - Converts a given `location`, a point in the simulation, to a carla.GeoLocation, which represents world coordinates. The geographical location of the map is defined inside OpenDRIVE within the tag . - # -------------------------------------- - def_name: __str__ # -------------------------------------- @@ -316,20 +315,6 @@ The left lane marking information based on the direction of the Waypoint. # - METHODS ---------------------------- methods: - - def_name: get_left_lane - return: carla.Waypoint - doc: > - Generates a Waypoint at the center of the left lane based on the direction of the current Waypoint, taking into account if the lane change is allowed in this location. - - Will return None if the lane does not exist - # -------------------------------------- - - def_name: get_right_lane - return: carla.Waypoint - doc: > - Generates a waypoint at the center of the right lane based on the direction of the current waypoint, taking into account if the lane change is allowed in this location. - - Will return None if the lane does not exist. - # -------------------------------------- - def_name: next params: - param_name: distance @@ -408,6 +393,20 @@ doc: > Returns a list of landmarks in the road of a specified type from the current waypoint until the specified distance. # -------------------------------------- + - def_name: get_left_lane + return: carla.Waypoint + doc: > + Generates a Waypoint at the center of the left lane based on the direction of the current Waypoint, taking into account if the lane change is allowed in this location. + + Will return None if the lane does not exist + # -------------------------------------- + - def_name: get_right_lane + return: carla.Waypoint + doc: > + Generates a waypoint at the center of the right lane based on the direction of the current waypoint, taking into account if the lane change is allowed in this location. + + Will return None if the lane does not exist. + # -------------------------------------- - def_name: __str__ # -------------------------------------- diff --git a/PythonAPI/docs/sensor.yml b/PythonAPI/docs/sensor.yml index 21166bb4e..8bf6af47b 100644 --- a/PythonAPI/docs/sensor.yml +++ b/PythonAPI/docs/sensor.yml @@ -8,19 +8,19 @@ doc: > Sensors compound a specific family of actors quite diverse and unique. They are normally spawned as attachment/sons of a vehicle (take a look at carla.World to learn about actor spawning). Sensors are thoroughly designed to retrieve different types of data that they are listening to. The data they receive is shaped as different subclasses inherited from carla.SensorData (depending on the sensor). - Most sensors can be divided in two groups: those receiving data on every tick (cameras, point clouds and some specific sensors) and those who only receive under certain circumstances (trigger detectors). CARLA provides a specific set of sensors and their blueprint can be found in carla.BlueprintLibrary. All the information on their preferences and settlement can be found [here](/cameras_and_sensors/), but the list of those available in CARLA so far goes as follow: + Most sensors can be divided in two groups: those receiving data on every tick (cameras, point clouds and some specific sensors) and those who only receive under certain circumstances (trigger detectors). CARLA provides a specific set of sensors and their blueprint can be found in carla.BlueprintLibrary. All the information on their preferences and settlement can be found [here](ref_sensors.md), but the list of those available in CARLA so far goes as follow: Receive data on every tick: - - Gnss sensor. - - IMU sensor. - - Radar. - - [Depth camera](/cameras_and_sensors/#sensorcameradepth). - - [Lidar raycast](/cameras_and_sensors/#sensorlidarray_cast). - - [RGB camera](/cameras_and_sensors/#sensorcamerargb). - - [Semantic Segmentation camera](/cameras_and_sensors/#sensorcamerasemantic_segmentation). + - [Gnss sensor](ref_sensors.md#gnss-sensor). + - [IMU sensor](ref_sensors.md#imu-sensor). + - [Radar](ref_sensors.md#radar-sensor). + - [Depth camera](ref_sensors.md#depth-camera). + - [Lidar raycast](ref_sensors.md#lidar-raycast-sensor). + - [RGB camera](ref_sensors.md#rgb-camera). + - [Semantic Segmentation camera](ref_sensors.md#semantic-segmentation-camera). Only receive data when triggered: - - [Collision detector](/cameras_and_sensors/#sensorothercollision). - - [Lane invasion detector](/cameras_and_sensors/#sensorotherlane_invasion). - - [Obstacle detector](/cameras_and_sensors/#sensorotherobstacle). + - [Collision detector](ref_sensors.md#collision-detector). + - [Lane invasion detector](ref_sensors.md#lane-invasion-detector). + - [Obstacle detector](ref_sensors.md#obstacle-detector). # - PROPERTIES ------------------------- instance_variables: diff --git a/PythonAPI/docs/sensor_data.yml b/PythonAPI/docs/sensor_data.yml index b14a7169d..342a49a2a 100644 --- a/PythonAPI/docs/sensor_data.yml +++ b/PythonAPI/docs/sensor_data.yml @@ -53,7 +53,7 @@ parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Class that defines an image of 32-bit BGRA colors that will be used as initial data retrieved by camera sensors. There are different camera sensors (currently three, RGB, depth and semantic segmentation) and each of these makes different use for the images. Learn more about them [here](/cameras_and_sensors/). + Class that defines an image of 32-bit BGRA colors that will be used as initial data retrieved by camera sensors. There are different camera sensors (currently three, RGB, depth and semantic segmentation) and each of these makes different use for the images. Learn more about them [here](ref_sensors.md). # - PROPERTIES ------------------------- instance_variables: - var_name: fov @@ -93,15 +93,15 @@ doc: > Saves the image to disk using a converter pattern stated as `color_converter`. The default conversion pattern is Raw that will make no changes to the image. # -------------------------------------- - - def_name: __len__ - # -------------------------------------- - - def_name: __iter__ - # -------------------------------------- - def_name: __getitem__ params: - param_name: pos type: int # -------------------------------------- + - def_name: __iter__ + # -------------------------------------- + - def_name: __len__ + # -------------------------------------- - def_name: __setitem__ params: - param_name: pos @@ -116,7 +116,7 @@ parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Class that defines the lidar data retrieved by a sensor.lidar.ray_cast. This essentially simulates a rotating lidar using ray-casting. Learn more about this [here](/cameras_and_sensors/#sensorlidarray_cast). + Class that defines the lidar data retrieved by a sensor.lidar.ray_cast. This essentially simulates a rotating lidar using ray-casting. Learn more about this [here](ref_sensors.md#lidar-raycast-sensor). # - PROPERTIES ------------------------- instance_variables: - var_name: channels @@ -133,13 +133,6 @@ List of 3D points received as data. # - METHODS ---------------------------- methods: - - def_name: get_point_count - params: - - param_name: channel - type: int - doc: > - Retrieves the number of points sorted by channel that are generated by this measure. Sorting by channel allows to identify the original channel for every point. - # -------------------------------------- - def_name: save_to_disk params: - param_name: path @@ -147,15 +140,22 @@ doc: > Saves the point cloud to disk as a .ply file describing data from 3D scanners. The files generated are ready to be used within [MeshLab](http://www.meshlab.net/), an open source system for processing said files. Just take into account that axis may differ from Unreal Engine and so, need to be reallocated. # -------------------------------------- - - def_name: __len__ - # -------------------------------------- - - def_name: __iter__ + - def_name: get_point_count + params: + - param_name: channel + type: int + doc: > + Retrieves the number of points sorted by channel that are generated by this measure. Sorting by channel allows to identify the original channel for every point. # -------------------------------------- - def_name: __getitem__ params: - param_name: pos type: int # -------------------------------------- + - def_name: __iter__ + # -------------------------------------- + - def_name: __len__ + # -------------------------------------- - def_name: __setitem__ params: - param_name: pos @@ -170,7 +170,7 @@ parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Class that defines a collision data for sensor.other.collision. The sensor creates one of this for every collision detected which may be many for one simulation step. Learn more about this [here](/cameras_and_sensors/#sensorothercollision). + Class that defines a collision data for sensor.other.collision. The sensor creates one of this for every collision detected which may be many for one simulation step. Learn more about this [here](ref_sensors.md#collision-detector). # - PROPERTIES ------------------------- instance_variables: - var_name: actor @@ -190,7 +190,7 @@ parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Class that defines the obstacle data for sensor.other.obstacle. Learn more about this [here](/cameras_and_sensors/#sensorotherobstacle). + Class that defines the obstacle data for sensor.other.obstacle. Learn more about this [here](ref_sensors.md#obstacle-detector). # - PROPERTIES ------------------------- instance_variables: - var_name: actor @@ -214,7 +214,7 @@ parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Class that defines lanes invasion for sensor.other.lane_invasion. It works only client-side and is dependant on OpenDRIVE to provide reliable information. The sensor creates one of this every time there is a lane invasion, which may be more than once per simulation step. Learn more about this [here](/cameras_and_sensors/#sensorotherlane_invasion). + Class that defines lanes invasion for sensor.other.lane_invasion. It works only client-side and is dependant on OpenDRIVE to provide reliable information. The sensor creates one of this every time there is a lane invasion, which may be more than once per simulation step. Learn more about this [here](ref_sensors.md#lane-invasion-detector). # - PROPERTIES ------------------------- instance_variables: - var_name: actor @@ -282,7 +282,7 @@ parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Class that defines and gathers the measures registered by a sensor.other.radar, representing a wall of points in front of the sensor with a distance, angle and velocity in relation to it. The data consists of a carla.RadarDetection array. + Class that defines and gathers the measures registered by a sensor.other.radar, representing a wall of points in front of the sensor with a distance, angle and velocity in relation to it. The data consists of a carla.RadarDetection array. Learn more about this [here](ref_sensors.md#radar-sensor). # - PROPERTIES ------------------------- instance_variables: - var_name: raw_data @@ -295,15 +295,15 @@ doc: > Retrieves the number of entries generated, same as **\__str__()**. # -------------------------------------- - - def_name: __len__ - # -------------------------------------- - - def_name: __iter__ - # -------------------------------------- - def_name: __getitem__ params: - param_name: pos type: int # -------------------------------------- + - def_name: __iter__ + # -------------------------------------- + - def_name: __len__ + # -------------------------------------- - def_name: __setitem__ params: - param_name: pos diff --git a/PythonAPI/docs/snapshot.yml b/PythonAPI/docs/snapshot.yml index 938ec8458..e94c5b563 100644 --- a/PythonAPI/docs/snapshot.yml +++ b/PythonAPI/docs/snapshot.yml @@ -1,6 +1,5 @@ --- - module_name: carla - doc: > # - CLASSES ------------------------------ classes: @@ -24,31 +23,6 @@ Precise moment in time when snapshot was taken. This class works in seconds as given by the operative system. # - METHODS ---------------------------- methods: - - def_name: __eq__ - return: bool - params: - - param_name: other - type: carla.WorldSnapshot - doc: > - Returns True if both **timestamp** are the same. - # -------------------------------------- - - def_name: __iter__ - doc: > - Method that enables iteration for this class using **timestamp** as reference value. - # -------------------------------------- - - def_name: __ne__ - return: bool - params: - - param_name: other - type: carla.WorldSnapshot - doc: > - Returns True if both **timestamp** are different. - # -------------------------------------- - - def_name: __len__ - return: int - doc: > - Returns the amount of carla.ActorSnapshot present in this snapshot. - # -------------------------------------- - def_name: find return: carla.ActorSnapshot params: @@ -65,7 +39,32 @@ doc: > Given a certain actor ID, checks if there is a snapshot corresponding it and so, if the actor was present at that moment. # -------------------------------------- - + - def_name: __iter__ + doc: > + Method that enables iteration for this class using **timestamp** as reference value. + # -------------------------------------- + - def_name: __len__ + return: int + doc: > + Returns the amount of carla.ActorSnapshot present in this snapshot. + # -------------------------------------- + - def_name: __eq__ + return: bool + params: + - param_name: other + type: carla.WorldSnapshot + doc: > + Returns __True__ if both **timestamp** are the same. + # -------------------------------------- + - def_name: __ne__ + return: bool + params: + - param_name: other + type: carla.WorldSnapshot + doc: > + Returns True if both **timestamp** are different. + # -------------------------------------- + - class_name: ActorSnapshot # - DESCRIPTION ------------------------ doc: > diff --git a/PythonAPI/docs/weather.yml b/PythonAPI/docs/weather.yml index af5d139d9..ecf60d7dd 100644 --- a/PythonAPI/docs/weather.yml +++ b/PythonAPI/docs/weather.yml @@ -1,6 +1,6 @@ --- - module_name: carla - doc: > + # - CLASSES ------------------------------ classes: - class_name: WeatherParameters @@ -89,6 +89,21 @@ default: 0.0 doc: > 0 is an arbitrary North, 180 its corresponding South. + - param_name: fog_density + type: float + default: 0.0 + doc: > + Density of the fog, from 0 to 100. + - param_name: fog_distance + type: float + default: 0.0 + doc: > + Distance where the fog starts in meters. + - param_name: wetness + type: float + default: 0.0 + doc: > + Humidity percentages of the road, from 0 to 100. note: > ClearNoon, CloudyNoon, WetNoon, WetCloudyNoon, SoftRainNoon, MidRainyNoon, HardRainNoon, ClearSunset, CloudySunset, WetSunset, WetCloudySunset, SoftRainSunset, MidRainSunset, HardRainSunset. doc: > @@ -109,6 +124,5 @@ Returns True if both objects' variables are different. # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- ... diff --git a/PythonAPI/docs/world.yml b/PythonAPI/docs/world.yml index 225424373..dbdeddd5d 100644 --- a/PythonAPI/docs/world.yml +++ b/PythonAPI/docs/world.yml @@ -1,6 +1,6 @@ --- - module_name: carla - doc: > + # - CLASSES ------------------------------ classes: - class_name: Timestamp @@ -37,22 +37,18 @@ type: float - param_name: platform_timestamp type: float - doc: > # -------------------------------------- - def_name: __eq__ params: - param_name: other type: carla.Timestamp - doc: > # -------------------------------------- - def_name: __ne__ params: - param_name: other type: carla.Timestamp - doc: > # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: ActorList @@ -61,29 +57,6 @@ A class that contains every actor present on the scene and provides access to them. The list is automatically created and updated by the server and it can be returned using carla.World. # - METHODS ---------------------------- methods: - - def_name: __getitem__ - return: carla.Actor - params: - - param_name: pos - type: int - doc: > - Returns the actor corresponding to `pos` position in the list. - # -------------------------------------- - - def_name: __iter__ - doc: > - Allows the iteration for this object. - # -------------------------------------- - - def_name: __len__ - return: int - doc: > - Returns the amount of actors listed. - # -------------------------------------- - - def_name: __str__ - return: str - doc: > - Parses to the ID for every actor listed. - # -------------------------------------- - - def_name: filter return: list params: @@ -100,6 +73,28 @@ doc: > Finds an actor using its identifier and returns it or None if it is not present. # -------------------------------------- + - def_name: __getitem__ + return: carla.Actor + params: + - param_name: pos + type: int + doc: > + Returns the actor corresponding to `pos` position in the list. + # -------------------------------------- + - def_name: __iter__ + doc: > + Allows the iteration for the actors in this object. + # -------------------------------------- + - def_name: __len__ + return: int + doc: > + Returns the amount of actors listed. + # -------------------------------------- + - def_name: __str__ + return: str + doc: > + Parses to the ID for every actor listed. + # -------------------------------------- - class_name: WorldSettings # - DESCRIPTION ------------------------ @@ -198,11 +193,6 @@ Responsible for creating different shapes for debugging. Take a look at its class to learn more about it. # - METHODS ---------------------------- methods: - - def_name: __str__ - return: string - doc: > - The content of the world is parsed and printed as a brief report of its current state. - # -------------------------------------- - def_name: apply_settings return: int params: @@ -211,6 +201,89 @@ doc: > This method applies settings contained in an object to the simulation running and returns the ID of the frame they were implemented. # -------------------------------------- + - def_name: on_tick + return: int + params: + - param_name: callback + type: carla.WorldSnapshot + doc: > + A defined function with a snapshot as compulsory parameter that will be called every tick. + doc: > + The method will start callbacks for a defined function `callback`. It will return the ID for this callback so it can be removed with **remove_on_tick()**. + # -------------------------------------- + - def_name: remove_on_tick + params: + - param_name: callback_id + type: callback + doc: > + The callback to be removed. + doc: > + Stops the callback for `callback_id` started with **on_tick()**. + # -------------------------------------- + - def_name: tick + return: int + doc: > + This only has effect on synchronous mode, when both client and server move together. The method tells the server when to step to the next frame and returns the id of the newly started frame. + # -------------------------------------- + - def_name: wait_for_tick + return: carla.WorldSnapshot + params: + - param_name: seconds + type: float + default: 10.0 + doc: > + Maximum time in seconds the server should wait for a tick. It is set to 10.0 by default. + doc: > + The client tells the server to block calling thread until a **world_tick()** is received. + # -------------------------------------- + - def_name: spawn_actor + return: carla.Actor + params: + - param_name: blueprint + type: carla.ActorBlueprint + doc: > + The reference from which the actor will be created. + - param_name: transform + type: carla.Transform + doc: > + Contains the location and orientation the actor will be spawned with. + - param_name: attach_to + type: carla.Actor + default: None + doc: > + The parent object that the spawned actor will follow around. + - param_name: attachment + type: carla.AttachmentType + default: Rigid + doc: > + Determines how fixed and rigorous should be the changes in position according to its parent object. + doc: > + The method will create, return and spawn an actor into the world. The actor will need an available blueprint to be created and a transform (location and rotation). It can also be attached to a parent with a certain attachment type. + # -------------------------------------- + - def_name: try_spawn_actor + return: carla.Actor + params: + - param_name: blueprint + type: carla.ActorBlueprint + doc: > + The reference from which the actor will be created. + - param_name: transform + type: carla.Transform + doc: > + Contains the location and orientation the actor will be spawned with. + - param_name: attach_to + type: carla.Actor + default: None + doc: > + The parent object that the spawned actor will follow around. + - param_name: attachment + type: carla.AttachmentType + default: Rigid + doc: > + Determines how fixed and rigorous should be the changes in position according to its parent object. + doc: > + Same as **spawn_actor()** but returns None on failure instead of throwing an exception. + # -------------------------------------- - def_name: get_actor return: carla.Actor params: @@ -245,6 +318,11 @@ doc: > This can only be used with walkers. It retrieves a random location to be used as a destination using the **go_to_location()** method in carla.WalkerAIController. This location will be part of a sidewalk. Roads, crosswalks and grass zones are excluded. The method does not take into consideration locations of existing actors so if a collision happens when trying to spawn an actor, it will return an error. Take a look at [`spawn_npc.py`](https://github.com/carla-simulator/carla/blob/e73ad54d182e743b50690ca00f1709b08b16528c/PythonAPI/examples/spawn_npc.py#L179) for an example. # -------------------------------------- + - def_name: get_settings + return: carla.WorldSettings + doc: > + Returns an object containing some data about the simulation such as synchrony between client and server or rendering mode. + # -------------------------------------- - def_name: get_snapshot return: carla.WorldSnapshot doc: > @@ -255,35 +333,11 @@ doc: > Returns the spectator actor. The spectator is a special type of actor created by Unreal Engine, usually with ID=0, that acts as a camera and controls the view in the simulator window. # -------------------------------------- - - def_name: get_settings - return: carla.WorldSettings - doc: > - Returns an object containing some data about the simulation such as synchrony between client and server or rendering mode. - # -------------------------------------- - def_name: get_weather return: carla.WeatherParameters doc: > Retrieves an object containing weather parameters currently active in the simulation, mainly cloudiness, precipitation, wind and sun position. # -------------------------------------- - - def_name: on_tick - return: int - params: - - param_name: callback - type: carla.WorldSnapshot - doc: > - A defined function with a snapshot as compulsory parameter that will be called every tick. - doc: > - The method will start callbacks for a defined function `callback`. It will return the ID for this callback so it can be removed with **remove_on_tick()**. - # -------------------------------------- - - def_name: remove_on_tick - params: - - param_name: callback_id - type: callback - doc: > - The callback to be removed. - doc: > - Stops the callback for `callback_id` started with **on_tick()**. - # -------------------------------------- - def_name: set_weather params: - param_name: weather @@ -292,71 +346,13 @@ New conditions to be applied. doc: > Changes the weather parameteres ruling the simulation to another ones defined in an object. - # -------------------------------------- - - def_name: spawn_actor - return: carla.Actor - params: - - param_name: blueprint - type: carla.ActorBlueprint - doc: > - The reference from which the actor will be created. - - param_name: transform - type: carla.Transform - doc: > - Contains the location and orientation the actor will be spawned with. - - param_name: attach_to - type: carla.Actor - default: None - doc: > - The parent object that the spawned actor will follow around. - - param_name: attachment - type: carla.AttachmentType - default: Rigid - doc: > - Determines how fixed and rigorous should be the changes in position according to its parent object. + # -------------------------------------- + - def_name: __str__ + return: + string doc: > - The method will create, return and spawn an actor into the world. The actor will need an available blueprint to be created and a transform (location and rotation). It can also be attached to a parent with a certain attachment type. - # -------------------------------------- - - def_name: tick - return: int - doc: > - This only has effect on synchronous mode, when both client and server move together. The method tells the server when to step to the next frame and returns the id of the newly started frame. - # -------------------------------------- - - def_name: try_spawn_actor - return: carla.Actor - params: - - param_name: blueprint - type: carla.ActorBlueprint - doc: > - The reference from which the actor will be created. - - param_name: transform - type: carla.Transform - doc: > - Contains the location and orientation the actor will be spawned with. - - param_name: attach_to - type: carla.Actor - default: None - doc: > - The parent object that the spawned actor will follow around. - - param_name: attachment - type: carla.AttachmentType - default: Rigid - doc: > - Determines how fixed and rigorous should be the changes in position according to its parent object. - doc: > - Same as **spawn_actor()** but returns None on failure instead of throwing an exception. - # -------------------------------------- - - def_name: wait_for_tick - return: carla.WorldSnapshot - params: - - param_name: seconds - type: float - default: 10.0 - doc: > - Maximum time in seconds the server should wait for a tick. It is set to 10.0 by default. - doc: > - The client tells the server to block calling thread until a **world_tick()** is received. - # -------------------------------------- + The content of the world is parsed and printed as a brief report of its current state. + # -------------------------------------- - class_name: DebugHelper # - DESCRIPTION ------------------------ @@ -364,58 +360,6 @@ Helper class part of carla.World that defines methods for creating debug shapes. By default, shapes last one second. They can be permanent, but take into account the resources needed to do so. Check out this [recipe](ref_code_recipes.md#debug-bounding-box-recipe) where the user takes a snapshot of the world and then proceeds to draw bounding boxes for traffic lights. # - METHODS ---------------------------- methods: - - def_name: draw_point - params: - - param_name: location - type: carla.Location - doc: > - Spot in the coordinate system to center the object. - - param_name: size - type: float - default: 0.1f - doc: > - Density of the point. - - param_name: color - type: carla.Color - default: (255,0,0) - doc: > - RGB code to color the object. Red by default. - - param_name: life_time - type: float - default: -1.0f - doc: > - Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. - doc: > - Draws a point `location`. - # -------------------------------------- - - def_name: draw_line - params: - - param_name: begin - type: carla.Location - doc: > - Point in the coordinate system where the line starts. - - param_name: end - type: carla.Location - doc: > - Spot in the coordinate system where the line ends. - - param_name: thickness - type: float - default: 0.1f - doc: > - Density of the line. - - param_name: color - type: carla.Color - default: (255,0,0) - doc: > - RGB code to color the object. Red by default. - - param_name: life_time - type: float - default: -1.0f - doc: > - Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. - doc: > - Draws a line in between `begin` and `end`. - # -------------------------------------- - def_name: draw_arrow params: - param_name: begin @@ -479,6 +423,58 @@ Draws a box, ussually to act for object colliders. # -------------------------------------- + - def_name: draw_line + params: + - param_name: begin + type: carla.Location + doc: > + Point in the coordinate system where the line starts. + - param_name: end + type: carla.Location + doc: > + Spot in the coordinate system where the line ends. + - param_name: thickness + type: float + default: 0.1f + doc: > + Density of the line. + - param_name: color + type: carla.Color + default: (255,0,0) + doc: > + RGB code to color the object. Red by default. + - param_name: life_time + type: float + default: -1.0f + doc: > + Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. + doc: > + Draws a line in between `begin` and `end`. + # -------------------------------------- + - def_name: draw_point + params: + - param_name: location + type: carla.Location + doc: > + Spot in the coordinate system to center the object. + - param_name: size + type: float + default: 0.1f + doc: > + Density of the point. + - param_name: color + type: carla.Color + default: (255,0,0) + doc: > + RGB code to color the object. Red by default. + - param_name: life_time + type: float + default: -1.0f + doc: > + Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. + doc: > + Draws a point `location`. + # -------------------------------------- - def_name: draw_string params: - param_name: location