diff --git a/Docs/python_api.md b/Docs/python_api.md index a2275dca6..04724ebb1 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -1,274 +1,287 @@ ## carla.Actor -Base class for all actors. -Actor is anything that plays a role in the simulation and can be moved around, examples of actors are vehicles, pedestrians, and sensors. +CARLA defines actors as anything that plays a role in the simulation or can be moved around. That includes: pedestrians, vehicles, sensors and traffic signs (considering traffic lights as part of these). Actors are spawned in the simulation by [carla.World](#carla.World) and they need for a [carla.ActorBlueprint](#carla.ActorBlueprint) to be created. These blueprints belong into a library provided by CARLA, find more about them [here](../bp_library/).

Instance Variables

-- **id** (_int_) -Unique id identifying this actor. Note ids are unique during a given episode. -- **type_id** (_str_) -Id of the blueprint that created this actor, e.g. "vehicle.ford.mustang". -- **parent** (_[carla.Actor](#carla.Actor)_) -Parent actor of this instance, None if this instance is not attached to another actor. -- **semantic_tags** (_list(int)_) -List of semantic tags of all components of this actor, see semantic segmentation sensor for the list of available tags. E.g., a traffic light actor could contain "pole" and "traffic light" tags. -- **is_alive** (_bool_) -Returns whether this object was destroyed using this actor handle. - **attributes** (_dict_) -Dictionary of attributes of the blueprint that created this actor. +A dictionary containing the attributes of the blueprint this actor was based on. +- **id** (_int_) +Identifier for this actor. Unique during a given episode. +- **parent** (_[carla.Actor](#carla.Actor)_) +Actors may be attached to a parent actor that they will follow around. This is said actor. +- **semantic_tags** (_list(int)_) +A list of semantic tags provided by the blueprint listing components for this actor. E.g. a traffic light could be tagged with "pole" and "traffic light". These tags are used by the semantic segmentation sensor. Find more about this and other sensors [here](../cameras_and_sensors/#sensor.camera.semantic_segmentation). +- **type_id** (_str_) +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:** + - `impulse` (_[carla.Vector3D](#carla.Vector3D)_) - **destroy**(**self**) -Tell the simulator to destroy this Actor, and return whether the actor was successfully destroyed. It has no effect if the Actor was already successfully destroyed. +Tells the simulator to destroy this actor and returns True if it was successful. It has no effect if it was already destroyed. - **Return:** _bool_ - - **Warning:** _This function blocks until the destruction operation is completed by the simulator. + - **Warning:** _This method blocks the script until the destruction is completed by the simulator. _ +- **get_acceleration**(**self**) +Returns the actor's 3D acceleration vector the client recieved during last tick. The method does not call the simulator. + - **Return:** _[carla.Vector3D](#carla.Vector3D)_ +- **get_angular_velocity**(**self**) +Returns the actor's angular velocity vector the client recieved during last tick. The method does not call the simulator. + - **Return:** _[carla.Vector3D](#carla.Vector3D)_ +- **get_location**(**self**) +Returns the actor's location the client recieved during last tick. The method does not call the simulator. + - **Return:** _[carla.Location](#carla.Location)_ +- **get_transform**(**self**) +Returns the actor's transform (location and rotation) the client recieved during last tick. The method does not call the simulator. + - **Return:** _[carla.Transform](#carla.Transform)_ +- **get_velocity**(**self**) +Returns the actor's velocity vector the client recieved during last tick. The method does not call the simulator. + - **Return:** _[carla.Vector3D](#carla.Vector3D)_ - **get_world**(**self**) Returns the world this actor belongs to. - **Return:** _[carla.World](#carla.World)_ -- **get_location**(**self**) -Returns the actor's current location. - - **Return:** _[carla.Location](#carla.Location)_ - - **Note:** _This function does not call the simulator, it returns the location received in the last tick. -_ -- **get_transform**(**self**) -Returns the actor's current transform. - - **Return:** _[carla.Transform](#carla.Transform)_ - - **Note:** _This function does not call the simulator, it returns the transform received in the last tick. -_ -- **get_velocity**(**self**) -Returns the actor's current 3D velocity. - - **Return:** _[carla.Vector3D](#carla.Vector3D)_ - - **Note:** _This function does not call the simulator, it returns the velocity received in the last tick. -_ -- **get_angular_velocity**(**self**) -Returns the actor's current 3D angular velocity. - - **Return:** _[carla.Vector3D](#carla.Vector3D)_ - - **Note:** _This function does not call the simulator, it returns the angular velocity received in the last tick. -_ -- **get_acceleration**(**self**) -Returns the actor's current 3D acceleration. - - **Return:** _[carla.Vector3D](#carla.Vector3D)_ - - **Note:** _This function does not call the simulator, it returns the acceleration received in the last tick. -_ +- **set_angular_velocity**(**self**, **angular_velocity**) +Changes the actor's angular velocity vector. + - **Parameters:** + - `angular_velocity` (_[carla.Vector3D](#carla.Vector3D)_) - **set_location**(**self**, **location**) -Teleport the actor to a given location. +Teleports the actor to a given location. - **Parameters:** - `location` (_[carla.Location](#carla.Location)_) +- **set_simulate_physics**(**self**, **enabled**=True) +Enables or disables the simulation of physics on this actor. + - **Parameters:** + - `enabled` (_bool_) - **set_transform**(**self**, **transform**) -Teleport the actor to a given transform. +Teleports the actor to a given transform (location and rotation). - **Parameters:** - `transform` (_[carla.Transform](#carla.Transform)_) - **set_velocity**(**self**, **velocity**) -Set the actor's velocity. +Sets the actor's velocity vector. - **Parameters:** - `velocity` (_[carla.Vector3D](#carla.Vector3D)_) -- **set_angular_velocity**(**self**, **angular_velocity**) -Set the actor's angular velocity. - - **Parameters:** - - `angular_velocity` (_[carla.Vector3D](#carla.Vector3D)_) -- **add_impulse**(**self**, **impulse**) -Add impulse to the actor. - - **Parameters:** - - `impulse` (_[carla.Vector3D](#carla.Vector3D)_) -- **set_simulate_physics**(**self**, **enabled**=True) -Enable or disable physics simulation on this actor. - - **Parameters:** - - `enabled` (_bool_) -- **\__str__**(**self**) - - **Return:** _str_ --- ## carla.ActorAttribute -Class that defines an attribute of a [carla.ActorBlueprint](#carla.ActorBlueprint). +CARLA provides a library of blueprints for actors that can be accessed as [carla.BlueprintLibrary](#carla.BlueprintLibrary). Each of these blueprints has a series of attributes defined internally. Some of these are modifiable, others are not. A list of recommended values is provided for those that can be set.

Instance Variables

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

Methods

- **as_bool**(**self**) -- **as_int**(**self**) -- **as_float**(**self**) -- **as_str**(**self**) +Reads the attribute as boolean value. - **as_color**(**self**) -- **\__eq__**(**self**, **other**) - - **Parameters:** - - `other` (_bool / int / float / str / [carla.Color](#carla.Color) / [carla.ActorAttribute](#carla.ActorAttribute)_) -- **\__ne__**(**self**, **other**) - - **Parameters:** - - `other` (_bool / int / float / str / [carla.Color](#carla.Color) / [carla.ActorAttribute](#carla.ActorAttribute)_) -- **\__nonzero__**(**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_str**(**self**) +Reads the attribute as string. - **\__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. - **\__str__**(**self**) -- **\__str__**(**self**) +Parses the attribute ID and its value to string. +- **\__eq__**(**self**, **other**) +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**) +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. + - **Return:** _bool_ --- ## carla.ActorAttributeType -Class that defines the type of attribute of a [carla.ActorAttribute](#carla.ActorAttribute). +CARLA provides a library of blueprints for actors in [carla.BlueprintLibrary](#carla.BlueprintLibrary) with different attributes each. This class defines the types those at [carla.ActorAttribute](#carla.ActorAttribute) can be as a series of enum. All this information is managed internally and listed here for a better comprehension of how CARLA works.

Instance Variables

- **Bool** - **Int** - **Float** -- **String** - **RGBColor** +- **String** --- ## carla.ActorBlueprint -Class that contains all the necessary information for spawning an Actor. +CARLA provides a blueprint library for actors that can be consulted through [carla.BlueprintLibrary](#carla.BlueprintLibrary). Each of these consists of an identifier for the blueprint and a series of attributes that may be modifiable or not. This class is the intermediate step between the library and the actor creation. Actors need an actor blueprint to be spawned. These store the information for said blueprint in an object with its attributes and some tags to categorize them. The user can then customize some attributes and eventually spawn the actors through [carla.World](#carla.World).

Instance Variables

- **id** (_str_) -Actor blueprint identifier, e.g. `walker.pedestrian.0001`. +The identifier of said blueprint inside the library. E.g. `walker.pedestrian.0001`. - **tags** (_list(str)_) -List of tags of an actor blueprint e.g. `['0001', 'pedestrian', 'walker']`. +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:** + - `id` (_str_) – e.g. `gender` would return **True** for pedestrians' blueprints. + - **Return:** _bool_ - **has_tag**(**self**, **tag**) -Returns `true` if an actor blueprint has the tag. +Returns True if the blueprint has the specified `tag` listed. - **Parameters:** - `tag` (_str_) – e.g. 'walker'. - **Return:** _bool_ - **match_tags**(**self**, **wildcard_pattern**) -Test if any of the flags or id matches wildcard_pattern. +Returns True if any of the tags listed for this blueprint matches `wildcard_pattern`. Matching follows [fnmatch](https://docs.python.org/2/library/fnmatch.html) standard. - **Parameters:** - `wildcard_pattern` (_str_) - **Return:** _bool_ - - **Note:** _The wildcard_pattern follows Unix shell-style wildcards. -_ -- **has_attribute**(**self**, **id**) -Returns `true` if the blueprint contains the specified attribute. - - **Parameters:** - - `id` (_str_) – e.g 'gender'. - - **Return:** _bool_ - **get_attribute**(**self**, **id**) -Returns the current actor attribute through its id. +Returns the actor's attribute with `id` as identifier if existing. - **Parameters:** - `id` (_str_) - **Return:** _[carla.ActorAttribute](#carla.ActorAttribute)_ - **set_attribute**(**self**, **id**, **value**) -Sets an existing attribute to the actor's blueprint. +If the `id` attribute is modifiable, changes its value to `value`. - **Parameters:** - - `id` (_str_) - - `value` (_str_) - - **Note:** _Attribute can only be set or changed if it is modifiable -_ -- **\__len__**(**self**) -- **\__iter__**(**self**) -- **\__str__**(**self**) + - `id` (_str_) – The identifier for the attribute that is intended to be changed. + - `value` (_str_) – The new value for said attribute. --- ## carla.ActorList -Class that provides access to actors. +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

-- **find**(**self**, **actor_id**) -Find an actor by ID. - - **Parameters:** - - `actor_id` (_int_) -- **filter**(**self**, **wildcard_pattern**) -Filters a list of Actors with type_id matching wildcard_pattern. - - **Parameters:** - - `wildcard_pattern` (_str_) - - **Note:** _The wildcard_pattern follows Unix shell-style wildcards (fnmatch). -_ - **\__getitem__**(**self**, **pos**) +Returns the actor corresponding to `pos` position in the list. - **Parameters:** - `pos` (_int_) -- **\__len__**(**self**) + - **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:** + - `wildcard_pattern` (_str_) + - **Return:** _list_ +- **find**(**self**, **actor_id**) +Finds an actor using its identifier and returns it or None if it is not present. + - **Parameters:** + - `actor_id` (_int_) + - **Return:** _[carla.Actor](#carla.Actor)_ --- ## carla.ActorSnapshot -Class that provides access to the data of a [carla.Actor](#carla.Actor) in a [carla.WorldSnapshot](#carla.WorldSnapshot). +A class that comprises all the information for an actor at a certain moment in time. These objects are contained in a [carla.WorldSnapshot](#carla.WorldSnapshot) and sent to the client once every tick.

Instance Variables

- **id** (_int_) -The ActorSnapshot's identifier. +An identifier for the snapshot itself.

Methods

-- **get_transform**(**self**) -Returns the actor's current transform. - - **Return:** _[carla.Transform](#carla.Transform)_ -- **get_velocity**(**self**) -Returns the actor's current 3D velocity. +- **get_acceleration**(**self**) +Returns the acceleration vector registered for an actor in that tick. - **Return:** _[carla.Vector3D](#carla.Vector3D)_ - **get_angular_velocity**(**self**) -Returns the actor's current 3D angular velocity. +Returns the angular velocity vector registered for an actor in that tick. - **Return:** _[carla.Vector3D](#carla.Vector3D)_ -- **get_acceleration**(**self**) -Returns the actor's current 3D acceleration. +- **get_transform**(**self**) +Returns the actor's transform (location and rotation) for an actor in that tick. + - **Return:** _[carla.Transform](#carla.Transform)_ +- **get_velocity**(**self**) +Returns the velocity vector registered for an actor in that tick. - **Return:** _[carla.Vector3D](#carla.Vector3D)_ -- **\__self__**(**self**) --- ## carla.AttachmentType -Class that defines the attachment options. See [carla.World.spawn_actor](#carla.World.spawn_actor).
Check out this [`recipe`](../python_cookbook/#attach-sensors-recipe)! +Class that defines attachment options between an actor and its parent. When spawning actors, these can be attached to another actor so their position changes accordingly. This is specially useful for cameras and sensors. [Here](../python_cookbook/#attach-sensors-recipe) is a brief recipe in which we can see how sensors can be attached to a car when spawned. Note that the attachment type is declared as an enum within the class.

Instance Variables

- **Rigid** -Standard fixed attachment. +With this fixed attatchment the object follow its parent position strictly. - **SpringArm** -Attachment that expands or retracts based on camera situation. +An attachment that expands or retracts depending on camera situation. SpringArms are an Unreal Engine component so [check this out](../python_cookbook/#attach-sensors-recipe) to learn some more about them. --- ## carla.BlueprintLibrary -Class that provides access to [blueprints](../bp_library/). +A class that contains the blueprints provided for actor spawning. Its main application is to return [carla.ActorBlueprint](#carla.ActorBlueprint) objects needed to spawn actors. Each blueprint has an identifier and attributes that may or may not be modifiable. The library is automatically created by the server and can be accessed through [carla.World](#carla.World). + + [Here](../bp_library/) is a reference containing every available blueprint and its specifics.

Methods

-- **find**(**self**, **id**) -Returns a [carla.ActorBlueprint](#carla.ActorBlueprint) through its id. - - **Parameters:** - - `id` (_str_) - - **Return:** _[carla.ActorBlueprint](#carla.ActorBlueprint)_ -- **filter**(**self**, **wildcard_pattern**) -Filters a list of ActorBlueprint with id or tags matching wildcard_pattern. The pattern is matched against each blueprint's id and tags. - - **Parameters:** - - `wildcard_pattern` (_str_) - - **Return:** _[carla.BlueprintLibrary](#carla.BlueprintLibrary)_ - - **Note:** _The wildcard_pattern follows Unix shell-style wildcards (fnmatch). -_ - **\__getitem__**(**self**, **pos**) +Returns the blueprint stored in `pos` position inside the data structure containing them. - **Parameters:** - `pos` (_int_) - **Return:** _[carla.ActorBlueprint](#carla.ActorBlueprint)_ -- **\__len__**(**self**) - **\__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:** + - `wildcard_pattern` (_str_) + - **Return:** _[carla.BlueprintLibrary](#carla.BlueprintLibrary)_ +- **find**(**self**, **id**) +Returns the blueprint corresponding to that identifier. + - **Parameters:** + - `id` (_str_) + - **Return:** _[carla.ActorBlueprint](#carla.ActorBlueprint)_ --- ## carla.BoundingBox -Bounding box helper class. +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](../python_cookbook/#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)_) -It contains the vector from the center of the bounding box to one of the vertex of the box. -So, if you want to know the _X bounding box size_, you can just do `extent.x * 2`. +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.

Methods

- **\__init__**(**self**, **location**, **extent**) - **Parameters:** - - `location` (_[carla.Location](#carla.Location)_) - - `extent` (_[carla.Vector3D](#carla.Vector3D)_) + - `location` (_[carla.Location](#carla.Location)_) – Point to center the box. + - `extent` (_[carla.Vector3D](#carla.Vector3D)_) – Vector containing half the size of the box for every axis. - **contains**(**self**, **world_point**, **transform**) Returns **True** if a point passed in world space is inside this bounding box. - **Parameters:** @@ -284,134 +297,142 @@ Returns a list containing the locations of this object's vertices in world space - `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**) +Returns true if both location and extent are equal for this and `other`. - **Parameters:** - `other` (_[carla.BoundingBox](#carla.BoundingBox)_) + - **Return:** _bool_ - **\__ne__**(**self**, **other**) +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. + - **Return:** _str_ --- ## carla.Client -Client used to connect to a Carla server. +The Client connects CARLA to the server which runs the simulation. Both server and client contain a CARLA library (libcarla) with some differences that allow communication between them. Many clients can be created and each of these will connect to the RPC server inside the simulation to send commands. The simulation runs server-side. Once the connection is established, the client will only receive data retrieved from the simulation. Walkers are the exception. The client is in charge of managing pedestrians so, if you are running a simulation with multiple clients, some issues may arise. For example, if you spawn walkers through different clients, collisions may happen, as each client is only aware of the ones it is in charge of. + + The client also has a recording feature that saves all the information of a simulation while running it. This allows the server to replay it at will to obtain information and experiment with it. [Here](recorder_and_playback.md) is some information about how to use this recorder.

Methods

-- **\__init__**(**self**, **host**, **port**, **worker_threads**=0) +- **\__init__**(**self**, **host**=127.0.0.1, **port**=2000, **worker_threads**=0) Client constructor. - **Parameters:** - - `host` (_str_) – IP address where a CARLA Simulator instance is running. - - `port` (_int_) – TCP port where the CARLA Simulator instance is running. + - `host` (_str_) – IP address where a CARLA Simulator instance is running. Default is localhost (127.0.0.1). + - `port` (_int_) – TCP port where the CARLA Simulator instance is running. Default are 2000 and the subsequent 2001. - `worker_threads` (_int_) – Number of working threads used for background updates. If 0, use all available concurrency. -- **set_timeout**(**self**, **seconds**) -Set the timeout in seconds allowed to block when doing networking calls. +- **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:** - - `seconds` (_float_) – New timeout value in seconds. + - `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). +- **apply_batch_sync**(**self**, **commands**, **due_tick_cue**) +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_. + - **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**) -Get the client version as a string. +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**) -Get the server version as a string. +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**) -Get the world currently active in the simulation. +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)_ -- **get_available_maps**(**self**) -Get a list of strings of the maps available on server. The result can be something like: - '/Game/Carla/Maps/Town01' - '/Game/Carla/Maps/Town02' - '/Game/Carla/Maps/Town03' - '/Game/Carla/Maps/Town04' - '/Game/Carla/Maps/Town05' - '/Game/Carla/Maps/Town06' - '/Game/Carla/Maps/Town07'. - - **Return:** _list(str)_ -- **reload_world**(**self**) -Reload the current world, note that a new world is created with default settings using the same map. All actors present in the world will be destroyed. - - **Raises:** RuntimeError - **load_world**(**self**, **map_name**) -Load a new world with default settings using `map_name` map. All actors present in the current world will be destroyed. +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 load, accepts both full paths and map names, e.g. '/Game/Carla/Maps/Town01' or 'Town01'. -- **start_recorder**(**self**, **filename**) -If we use a simple name like 'recording.log' then it will be saved at server folder 'CarlaUE4/Saved/recording.log'. If we use some folder in the name, then it will be considered to be an absolute path, like '/home/carla/recording.log'. + - `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. +- **reload_world**(**self**) +Deletes the current world and creates a new one using the same map and default settings. Every actor in the previous world will be destroyed. + - **Raises:** RuntimeError when corresponding. +- **replay_file**(**self**, **name**, **start**, **duration**, **follow_id**) +The server will start running the simulation `name` previously recorded. The time to start and stop can be stated and if the recreation finishes, the vehicles will continue their behaviour as usual, managed by the server. During the simulation we can follow a specific actor using its ID. - **Parameters:** - - `filename` (_str_) – Name of the file to write the recorded data. -- **stop_recorder**(**self**) -Stops the recording in progress. -- **show_recorder_file_info**(**self**, **filename**, **show_all**) -Will show info about the recorded file (frames, times, events, state, positions...) We have the option to show all the details per frame, that includes all the traffic light states, position of all actors, and animations data. + - `name` (_str_) – Name of the file containing the information of the simulation. + - `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. +- **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:** - `filename` (_str_) – Name of the recorded file to load. - - `show_all` (_bool_) – Show all detailed info, or just a summary. + - `min_time` (_float_) – Minimum time in seconds the actor has to move a minimum distance before being considered blocked. Default is 60 seconds. + - `min_distance` (_float_) – Minimum distance in centimeters the actor has to move to not be considered blocked. Default is 100 centimeters. - **show_recorder_collisions**(**self**, **filename**, **category1**, **category2**) -This will show which collisions were recorded in the file. We can use a filter for the collisions we want, using two categories. The categories can be: - 'h' = Hero +The terminal will show the collisions registered by the recorder. These can be filtered by specifying the type of actor involved. The categories will be specified in `category1` and `category2` as follows: + 'h' = Hero, the one vehicle that can be controlled manually or managed by the user. 'v' = Vehicle 'w' = Walker 't' = Traffic light 'o' = Other - 'a' = Any -So, if you want to see only collisions about a vehicle and a walker, we would use for category1 'v' and category2 'w'. Or if you want all the collisions (filter off) you can use 'a' as both categories. + 'a' = Any +If you want to see only collisions between a vehicles and a walkers, use for `category1` as 'v' and `category2` as 'w' or vice versa. If you want to see all the collisions (filter off) you can use 'a' for both parameters. - **Parameters:** - - `filename` (_str_) – Name of the recorded file to load. - - `category1` (_single char_) – Character specifying the category of the first actor. - - `category2` (_single char_) – Character specifying the category of the second actor. -- **show_recorder_actors_blocked**(**self**, **filename**, **min_time**, **min_distance**) -Shows which actors seem blocked by some reason. The idea is to calculate which actors are not moving as much as 'min_distance' for a period of 'min_time'. By default min_time = 60 seconds (1 min) and min_distance = 100 centimeters (1 m). + - `filename` (_str_) – Name or absolute path of the file recorded, depending on your previous choice. + - `category1` (_single char_) – Character variable specifying a first type of actor involved in the collision. + - `category2` (_single char_) – Character variable specifying the second type of actor involved in the collision. +- **show_recorder_file_info**(**self**, **filename**, **show_all**=False) +The information saved by the recorder will be parsed and shown in your terminal as text (frames, times, events, state, positions...). The information shown can be specified by using the `show_all` parameter. [Here](recorder_binary_file_format.md) is some more information about how to read the recorder file. - **Parameters:** - - `filename` (_str_) – Name of the recorded file to load. - - `min_time` (_float_) – How many seconds has to be stoped an actor to be considered as blocked. - - `min_distance` (_float_) – How many centimeters needs to move the actor in order to be considered as moving, and not blocked. -- **replay_file**(**self**, **name**, **start**, **duration**, **follow_id**) -Playback a file. + - `filename` (_str_) – Name or absolute path of the file recorded, depending on your previous choice. + - `show_all` (_bool_) – When true, will show all the details per frame (traffic light states, positions of all actors, orientation and animation data...), but by default it will only show a summary. +- **start_recorder**(**self**, **filename**) +Enables the recording feature, which will start saving every information possible needed by the server to replay the simulation. - **Parameters:** - - `name` (_str_) – Name of the file. - - `start` (_float_) – Time in seconds where to start the playback. If it is negative, then it starts from the end. - - `duration` (_float_) – Id of the actor to follow. If this is 0 then camera is disabled. - - `follow_id` (_int_) -- **set_replayer_time_factor**(**self**, **time_factor**) -Apply a different playback speed to current playback. Can be used several times while a playback is in curse. - - **Parameters:** - - `time_factor` (_float_) – A value of 1.0 means normal time factor. A value < 1.0 means slow motion (for example 0.5 is half speed) A value > 1.0 means fast motion (for example 2.0 is double speed). -- **apply_batch**(**self**, **commands**) -This function executes the whole list of commands on a single simulation step. For example, to set autopilot on some actors, we could use: [sample_code](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L126). We don't have control about the response of each command. If we need that, we can use `apply_batch_sync()`. - - **Parameters:** - - `commands` (_list_) – A list of commands to execute in batch. Each command has a different number of parameters. Currently, we can use these [commands](#command.ApplyAngularVelocity): - SpawnActor - DestroyActor - ApplyVehicleControl - ApplyWalkerControl - ApplyTransform - ApplyVelocity - AplyAngularVelocity - ApplyImpulse - SetSimulatePhysics - SetAutopilot. -- **apply_batch_sync**(**self**, **commands**, **due_tick_cue**) -This function executes the whole list of commands on a single simulation step, blocks until the commands are executed, and returns a list of [`command.Response`](#command.Response) that can be used to determine whether a single command succeeded or not. [sample_code](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L112-L116). - - **Parameters:** - - `commands` (_list_) – A list of commands to execute in batch. For a list of commands available see function above 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_. - - **Return:** _list_ + - `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/`. --- ## carla.CollisionEvent -
Inherited from _[carla.SensorData](#carla.SensorData)_

Class that defines a registered collision. +

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).

Instance Variables

- **actor** (_[carla.Actor](#carla.Actor)_) -Get "self" actor. Actor that measured the collision. +The actor the sensor is attached to, the one that measured the collision. - **other_actor** (_[carla.Actor](#carla.Actor)_) -Get the actor to which we collided. +The second actor involved in the collision. - **normal_impulse** (_[carla.Vector3D](#carla.Vector3D)_) -Normal impulse result of the collision. +Normal impulse resulting of the collision. --- ## carla.Color -Class that defines a 32-bit BGRA color. +Class that defines a 32-bit RGBA color.

Instance Variables

- **r** (_int_) @@ -425,7 +446,7 @@ Alpha channel (0-255).

Methods

- **\__init__**(**self**, **r**=0, **g**=0, **b**=0, **a**=255) -Client constructor. +Initializes a color, black by default. - **Parameters:** - `r` (_int_) - `g` (_int_) @@ -442,80 +463,77 @@ Client constructor. --- ## carla.ColorConverter -Class that defines the color converter options. Check out this [`recipe`](../python_cookbook/#converted-image-recipe)! +Class that defines conversion patterns that can be applied to a [carla.Image](#carla.Image) in order to show information provided by [carla.Sensor](#carla.Sensor). Depth conversions cause a loss of accuracy, as sensors detect depth as float that is then converted to a grayscale value between 0 and 255. Take a look a this [recipe](../python_cookbook/#converted-image-recipe) to see an example of how to create and save image data for sensor.camera.semantic_segmentation.

Instance Variables

-- **Raw** -- **Depth** -- **LogarithmicDepth** - **CityScapesPalette** +Converts the image to a segmentated map using tags provided by the blueprint library. Used by sensor.camera.semantic_segmentation. +- **Depth** +Converts the image to a linear depth map. Used by sensor.camera.depth. +- **LogarithmicDepth** +Converts the image to a depth map using a logarithmic scale, leading to better precision for small distances at the expense of losing it when further away. +- **Raw** +No changes applied to the image. --- ## carla.DebugHelper -Class that provides drawing debug shapes. Check out this [`example`](https://github.com/carla-simulator/carla/blob/master/PythonAPI/util/lane_explorer.py). +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](../python_cookbook/#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, **persistent_lines**=True) -Draws a point in the given location. +- **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)_) - - `size` (_float_) - - `color` (_[carla.Color](#carla.Color)_) - - `life_time` (_float_) - - `persistent_lines` (_bool_) – _Deprecated, use `life_time = 0` instead_. -- **draw_line**(**self**, **begin**, **end**, **thickness**=0.1f, **color**=(255,0,0), **life_time**=-1.0f, **persistent_lines**=True) -Draws a line between two given locations. + - `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)_) - - `end` (_[carla.Location](#carla.Location)_) - - `thickness` (_float_) - - `color` (_[carla.Color](#carla.Color)_) - - `life_time` (_float_) - - `persistent_lines` (_bool_) – _Deprecated, use `life_time = 0` instead_. -- **draw_arrow**(**self**, **begin**, **end**, **thickness**=0.1f, **arrow_size**=0.1f, **color**=(255,0,0), **life_time**=-1.0f, **persistent_lines**=True) -Draws an arrow between two given locations. + - `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:** - - `begin` (_[carla.Location](#carla.Location)_) - - `end` (_[carla.Location](#carla.Location)_) - - `thickness` (_float_) - - `arrow_size` (_float_) - - `color` (_[carla.Color](#carla.Color)_) - - `life_time` (_float_) - - `persistent_lines` (_bool_) – _Deprecated, use `life_time = 0` instead_. -- **draw_box**(**self**, **box**, **rotation**, **thickness**=0.1f, **color**=(255,0,0), **life_time**=-1.0f, **persistent_lines**=True) -Draws the [carla.BoundingBox](#carla.BoundingBox) of a given bounding_box.
Check out this [`recipe`](../python_cookbook/#debug-bounding-box-recipe)! + - `begin` (_[carla.Location](#carla.Location)_) – Point in the coordinate system where the arrow starts. + - `end` (_[carla.Location](#carla.Location)_) – Point in the coordinate system where the arrow ends and points towards to. + - `thickness` (_float_) – Density of the line. + - `arrow_size` (_float_) – Size of the tip of the arrow. + - `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_box**(**self**, **box**, **rotation**, **thickness**=0.1f, **color**=(255,0,0), **life_time**=-1.0f) +Draws a box, ussually to act for object colliders. - **Parameters:** - - `box` (_[carla.BoundingBox](#carla.BoundingBox)_) - - `rotation` (_[carla.Rotation](#carla.Rotation)_) - - `thickness` (_float_) - - `color` (_[carla.Color](#carla.Color)_) - - `life_time` (_float_) - - `persistent_lines` (_bool_) – _Deprecated, use `life_time = 0` instead_. -- **draw_string**(**self**, **location**, **text**, **draw_shadow**=False, **color**=(255,0,0), **life_time**=-1.0f, **persistent_lines**=True) -Draws a string in a given location. + - `box` (_[carla.BoundingBox](#carla.BoundingBox)_) – Object containing a location and the length of a box for every axis. + - `rotation` (_[carla.Rotation](#carla.Rotation)_) – Orientation of the box according to Unreal Engine's axis system. + - `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_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:** - - `location` (_[carla.Location](#carla.Location)_) - - `text` (_str_) - - `draw_shadow` (_bool_) - - `color` (_[carla.Color](#carla.Color)_) + - `location` (_[carla.Location](#carla.Location)_) – Spot in the simulation where the text will be centered. + - `text` (_str_) – Text intended to be shown in the world. + - `draw_shadow` (_bool_) – Casts a shadow for the string that could help in visualization. It is disabled by default. + - `color` (_[carla.Color](#carla.Color)_) – RGB code to color the string. Red by default. - `life_time` (_float_) - - `persistent_lines` (_bool_) – _Deprecated, set a high `life_time` instead_. - - **Note:** _Strings can only be seen on the server-side. -_ --- ## carla.GearPhysicsControl -Class that provides access to vehicle transmission details. +Class that provides access to vehicle transmission details by defining a gear and when to run on it. This will be later used by [carla.VehiclePhysicsControl](#carla.VehiclePhysicsControl) to help simulate physics.

Instance Variables

- **ratio** (_float_) The transmission ratio of the gear. - **down_ratio** (_float_) -The level of RPM (in relation to MaxRPM) where the gear autobox initiates shifting down. +Quotient between current RPM and MaxRPM where the autonomous gear box should shift down. - **up_ratio** (_float_) -The level of RPM (in relation to MaxRPM) where the gear autobox initiates shifting up. +Quotient between current RPM and MaxRPM where the autonomous gear box should shift up.

Methods

- **\__init__**(**self**, **ratio**=1.0, **down_ratio**=0.5, **up_ratio**=0.65) @@ -534,7 +552,7 @@ The level of RPM (in relation to MaxRPM) where the gear autobox initiates shifti --- ## carla.GeoLocation -Class that contains geolocation simulated data. +Class that contains geographical coordinates simulated data. The [carla.Map](#carla.Map) can convert simulation locations by using the tag in the OpenDRIVE file.

Instance Variables

- **latitude** (_float_) @@ -561,15 +579,15 @@ Height regarding ground level. --- ## carla.GnssMeasurement -
Inherited from _[carla.SensorData](#carla.SensorData)_

Gnss sensor data. +

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

Class that defines the Gnss data registered by a sensor.other.gnss. It essentially reports its position with the position of the sensor and an OpenDRIVE geo-reference.

Instance Variables

+- **altitude** (_float_) +Height regarding ground level. - **latitude** (_float_) North/South value of a point on the map. - **longitude** (_float_) West/East value of a point on the map. -- **altitude** (_float_) -Height regarding ground level.

Methods

- **\__str__**(**self**) @@ -577,15 +595,15 @@ Height regarding ground level. --- ## carla.IMUMeasurement -
Inherited from _[carla.SensorData](#carla.SensorData)_

IMU sensor data regarding the sensor World's transformation. +

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

Class that defines the data registered by a sensor.other.imu, regarding the sensor's transformation according to the current [carla.World](#carla.World). It essentially acts as accelerometer, gyroscope and compass.

Instance Variables

- **accelerometer** (_[carla.Vector3D](#carla.Vector3D)_) -Measures linear acceleration in `m/s^2`. -- **gyroscope** (_[carla.Vector3D](#carla.Vector3D)_) -Measures angular velocity in `rad/sec`. +Linear acceleration in m/s^2. - **compass** (_float_) -Orientation with respect to the North (`(0.0, -1.0, 0.0)` in Unreal) in radians. +Orientation with regard to the North ((0.0, -1.0, 0.0) in Unreal Engine) in radians. +- **gyroscope** (_[carla.Vector3D](#carla.Vector3D)_) +Angular velocity in rad/sec.

Methods

- **\__str__**(**self**) @@ -593,27 +611,27 @@ Orientation with respect to the North (`(0.0, -1.0, 0.0)` in Unreal) in radians. --- ## carla.Image -
Inherited from _[carla.SensorData](#carla.SensorData)_

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

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/).

Instance Variables

-- **width** (_int_) -Image width in pixels. -- **height** (_int_) -Image height in pixels. - **fov** (_float_) Horizontal field of view of the image in degrees. +- **height** (_int_) +Image height in pixels. +- **width** (_int_) +Image width in pixels. - **raw_data** (_bytes_)

Methods

- **convert**(**self**, **color_converter**) -Convert the image with the applied conversion. +Converts the image following the `color_converter` pattern. - **Parameters:** - `color_converter` (_[carla.ColorConverter](#carla.ColorConverter)_) - **save_to_disk**(**self**, **path**, **color_converter**=Raw) -Save the image to disk. +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. - **Parameters:** - - `path` (_str_) – Path where it will be saved. - - `color_converter` (_[carla.ColorConverter](#carla.ColorConverter)_) + - `path` (_str_) – Path that will contain the image. + - `color_converter` (_[carla.ColorConverter](#carla.ColorConverter)_) – Default Raw will make no changes. - **\__len__**(**self**) - **\__iter__**(**self**) - **\__getitem__**(**self**, **pos**) @@ -661,13 +679,13 @@ Traffic rules allow turning right. --- ## carla.LaneInvasionEvent -
Inherited from _[carla.SensorData](#carla.SensorData)_

Lane invasion sensor data. +

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).

Instance Variables

- **actor** (_[carla.Actor](#carla.Actor)_) -Get "self" actor. Actor that invaded another lane. +Gets the actor the sensor is attached to, the one that invaded another lane. - **crossed_lane_markings** (_list([carla.LaneMarking](#carla.LaneMarking))_) -List of lane markings that have been crossed. +List of lane markings that have been crossed and detected by the sensor.

Methods

- **\__str__**(**self**) @@ -706,22 +724,19 @@ White by default. ## carla.LaneMarkingType Class that defines the lane marking types accepted by OpenDRIVE 1.4. Take a look at this [recipe](../python_cookbook/#lanes-recipe) where the user creates a [carla.Waypoint](#carla.Waypoint) for a vehicle location and retrieves from it the information about adjacent lane markings. +__Note on double types:__ Lane markings are defined under the OpenDRIVE standard that determines whereas a line will be considered "BrokenSolid" or "SolidBroken". For each road there is a center lane marking, defined from left to right regarding the lane's directions. The rest of the lane markings are defined in order from the center lane to the closest outside of the road.

Instance Variables

- **NONE** - **BottsDots** - **Broken** - **BrokenBroken** -From inside to outside except for center lane which is from left to right. - **BrokenSolid** -From inside to outside except for center lane which is from left to right. - **Curb** - **Grass** - **Solid** - **SolidBroken** -From inside to outside except for center lane which is from left to right. - **SolidSolid** -For double solid line. - **Other** --- @@ -731,8 +746,6 @@ Class that defines the possible lane types accepted by OpenDRIVE 1.4. This stand

Instance Variables

- **NONE** -- **Any** -Every type except for NONE. - **Bidirectional** - **Biking** - **Border** @@ -753,29 +766,29 @@ Every type except for NONE. - **Special3** - **Stop** - **Tram** +- **Any** +Every type except for NONE. --- ## carla.LidarMeasurement -
Inherited from _[carla.SensorData](#carla.SensorData)_

Lidar sensor measurement data. +

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).

Instance Variables

-- **horizontal_angle** (_float_) -Horizontal angle that the Lidar has rotated at the time of the measurement (in radians). - **channels** (_int_) -Number of lasers. +Number of lasers shot. +- **horizontal_angle** (_float_) +Horizontal angle the Lidar is rotated at the time of the measurement (in radians). - **raw_data** (_bytes_) -List of 3D points. +List of 3D points received as data.

Methods

- **get_point_count**(**self**, **channel**) -Retrieve the number of points that are generated by this 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_) - - **Note:** _Points are sorted by channel, so this method allows to identify the channel that generated each point. -_ - **save_to_disk**(**self**, **path**) -Save point cloud to disk. +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**) @@ -792,12 +805,15 @@ Save point cloud to disk. --- ## carla.Location -
Inherited from _[carla.Vector3D](#carla.Vector3D)_

Represents a location in the world (in meters). +

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

Represents a spot in the world.

Instance Variables

- **x** (_float_) +Distance in meters from origin to spot on X axis. - **y** (_float_) +Distance in meters from origin to spot on Y axis. - **z** (_float_) +Distance in meters from origin to spot on Z axis.

Methods

- **\__init__**(**self**, **x**=0.0, **y**=0.0, **z**=0.0) @@ -805,18 +821,24 @@ Save point cloud to disk. - `x` (_float_) - `y` (_float_) - `z` (_float_) -- **distance**(**self**, **location**) -Computes the Euclidean distance in meters from this location to another one. - - **Parameters:** - - `location` (_[carla.Location](#carla.Location)_) – The Location from where to compute the distance. - - **Return:** _float_ - **\__eq__**(**self**, **other**) +Returns true if both locations are the same point in space. - **Parameters:** - - `other` (_[carla.Location](#carla.Location)_) + - `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)_) + - `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_ --- @@ -840,13 +862,13 @@ Returns a list of waypoints with a certain distance between them for every lane - `distance` (_float_) – Approximate distance between waypoints. - **Return:** _list([carla.Waypoint](#carla.Waypoint))_ - **get_spawn_points**(**self**) -Returns a list of recommendations made by creators of the map to be used spawning points for vehicles. The list includes [carla.Tranform](#carla.Tranform) objects with certain location and orientation. Said locations are slightly on-air and vehicles fall for a bit before starting their way. +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))_ - **get_topology**(**self**) Returns a list of tuples describing a minimal graph of the topology of the OpenDRIVE file. The tuples contain pairs of waypoints located either at the point a road begins or ends. The first one is the origin and the second one represents another road end that can be reached. This graph can be loaded into [NetworkX](https://networkx.github.io/) to work with. Output could look like this: [(w0, w1), (w0, w2), (w1, w3), (w2, w3), (w0, w4)]. - **Return:** _list(tuple([carla.Waypoint](#carla.Waypoint), [carla.Waypoint](#carla.Waypoint)))_ - **get_waypoint**(**self**, **location**, **project_to_road**=True, **lane_type**=[carla.LaneType.Driving](#carla.LaneType.Driving)) -Returns a waypoint that can be located in an exact location or translated to the center of the nearest lane. Said lane type can be defined using flags such as `LaneType.Driving & LaneType.Shoulder`. +Returns a waypoint that can be located in an exact location or translated to the center of the nearest lane. Said lane type can be defined using flags such as `LaneType.Driving & LaneType.Shoulder`. The method will return None if the waypoint is not found, which may happen only when trying to retrieve a waypoint for an exact location. That eases checking if a point is inside a certain road, as otherwise, it will return the corresponding waypoint. - **Parameters:** - `location` (_[carla.Location](#carla.Location)_) – Location used as reference for the [carla.Waypoint](#carla.Waypoint). @@ -860,15 +882,7 @@ 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)_ -- **get_topology**(**self**) -It provides a minimal graph of the topology of the current OpenDRIVE file. It is constituted by a list of pairs of waypoints, where the first waypoint is the origin and the second one is the destination. It can be loaded into [NetworkX](https://networkx.github.io/). A valid output could be: `[ (w0, w1), (w0, w2), (w1, w3), (w2, w3), (w0, w4) ]`. - - **Return:** _list(tuple([carla.Waypoint](#carla.Waypoint), [carla.Waypoint](#carla.Waypoint)))_ -- **generate_waypoints**(**self**, **distance**) -Returns a list of waypoints positioned on the center of the lanes all over the map with an approximate distance between them. - - **Parameters:** - - `distance` (_float_) – Approximate distance between the waypoints. - - **Return:** _list([carla.Waypoint](#carla.Waypoint))_ -- **transform_to_geolocation**(**self**, **path**) +- **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. @@ -885,15 +899,15 @@ Converts a given `location`, a point in the simulation, to a [carla.GeoLocation] --- ## carla.ObstacleDetectionEvent -
Inherited from _[carla.SensorData](#carla.SensorData)_

Obstacle detection sensor data. +

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).

Instance Variables

- **actor** (_[carla.Actor](#carla.Actor)_) -Get "self" actor. Actor that measured the collision. +The actor the sensor is attached to. - **other_actor** (_[carla.Actor](#carla.Actor)_) -Get the actor to which we collided. +The actor or object considered to be an obstacle. - **distance** (_float_) -Get obstacle distance. +Distance between `actor` and `other`.

Methods

- **\__str__**(**self**) @@ -901,17 +915,17 @@ Get obstacle distance. --- ## carla.RadarDetection -Data contained by a [carla.RadarMeasurement](#carla.RadarMeasurement). Represents an object detection produced by the Radar sensor. +Data contained inside a [carla.RadarMeasurement](#carla.RadarMeasurement). Each of these represents one of the points in the cloud that a sensor.other.radar registers and contains the distance, angle and velocity in relation to the radar.

Instance Variables

-- **velocity** (_float_) -The velocity of the detected object towards the sensor in meters per second. -- **azimuth** (_float_) -Azimuth angle of the detection in radians. - **altitude** (_float_) Altitude angle of the detection in radians. +- **azimuth** (_float_) +Azimuth angle of the detection in radians. - **depth** (_float_) Distance in meters from the sensor to the detection position. +- **velocity** (_float_) +The velocity of the detected object towards the sensor in m/s.

Methods

- **\__str__**(**self**) @@ -919,15 +933,15 @@ Distance in meters from the sensor to the detection position. --- ## carla.RadarMeasurement -
Inherited from _[carla.SensorData](#carla.SensorData)_

Measurement produced by a Radar. Consists of an array of [carla.RadarDetection](#carla.RadarDetection). +

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.

Instance Variables

- **raw_data** (_bytes_) -List of [carla.RadarDetection](#carla.RadarDetection). +The complete information of the [carla.RadarDetection](#carla.RadarDetection) the radar has registered.

Methods

- **get_detection_count**(**self**) -Retrieve the number of [carla.RadarDetection](#carla.RadarDetection) that are generated. +Retrieves the number of entries generated, same as **\__str__()**. - **\__len__**(**self**) - **\__iter__**(**self**) - **\__getitem__**(**self**, **pos**) @@ -942,56 +956,84 @@ Retrieve the number of [carla.RadarDetection](#carla.RadarDetection) that are ge --- ## carla.Rotation -Class that represents a 3D rotation. All rotation angles are stored in degrees. +Class that represents a 3D rotation and therefore, an orientation in space. ![UE4_Rotation](https://d26ilriwvtzlb.cloudfront.net/8/83/BRMC_9.jpg) _Unreal Engine's standard (from [UE4 docs](https://wiki.unrealengine.com/Blueprint_Rotating_Movement_Component))_.

Instance Variables

- **pitch** (_float_) -Rotation about Y-axis. +Degrees around the Y-axis. - **yaw** (_float_) -Rotation about Z-axis. +Degrees around the Z-axis. - **roll** (_float_) -Rotation about X-axis. +Degrees around the X-axis.

Methods

- **\__init__**(**self**, **pitch**=0.0, **yaw**=0.0, **roll**=0.0) - **Parameters:** - - `pitch` (_float_) - - `yaw` (_float_) - - `roll` (_float_) + - `pitch` (_float_) – Y rotation in degrees. + - `yaw` (_float_) – Z rotation in degrees. + - `roll` (_float_) – X rotation in degrees. - **get_forward_vector**(**self**) -Computes a forward vector using the current rotation. +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)_) + - `other` (_[carla.Rotation](#carla.Rotation)_) – The other rotation to be compared with. + - **Return:** _bool_ - **\__ne__**(**self**, **other**) +Returns true if both rotations represent the same orientation of each axis. - **Parameters:** - - `other` (_[carla.Rotation](#carla.Rotation)_) + - `other` (_[carla.Rotation](#carla.Rotation)_) – The other rotation to be compared with. + - **Return:** _bool_ - **\__str__**(**self**) +Parses the axis' orientations to string. --- ## carla.Sensor -
Inherited from _[carla.Actor](#carla.Actor)_

A sensor actor. +

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: + 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). + 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).

Instance Variables

- **is_listening** (_boolean_) -Is true if the sensor is listening for data. +When True the sensor will be waiting for data.

Methods

- **listen**(**self**, **callback**) +The function the sensor will be calling to every time a new measurement is received. This function needs for an argument containing an object type [carla.SensorData](#carla.SensorData) to work with. - **Parameters:** - - `callback` (_function_) – Register a callback to be executed each time a new measurement is received. The callback must accept a single argument containing the sensor data; the type of this object varies depending on the type of sensor, but they all derive from [carla.SensorData](#carla.SensorData). + - `callback` (_function_) – The called function with one argument containing the sensor data. - **stop**(**self**) -Stops listening for data. +Commands the sensor to stop listening for data. - **\__str__**(**self**) --- ## carla.SensorData -Base class for all the objects containing data generated by a sensor. +Base class for all the objects containing data generated by a [carla.Sensor](#carla.Sensor). This objects should be the argument of the function said sensor is listening to, in order to work with them. Each of these sensors needs for a specific type of sensor data. The relation between available sensors and their corresponding data goes like: + - Cameras (RGB, depth and semantic segmentation): [carla.Image](#carla.Image). + - Collision detector: [carla.CollisionEvent](#carla.CollisionEvent). + - Gnss detector: [carla.GnssMeasurement](#carla.GnssMeasurement). + - IMU detector: [carla.IMUMeasurement](#carla.IMUMeasurement). + - Lane invasion detector: [carla.LaneInvasionEvent](#carla.LaneInvasionEvent). + - Lidar raycast: [carla.LidarMeasurement](#carla.LidarMeasurement). + - Obstacle detector: [carla.ObstacleDetectionEvent](#carla.ObstacleDetectionEvent). + - Radar detector: [carla.RadarMeasurement](#carla.RadarMeasurement).

Instance Variables

- **frame** (_int_) @@ -1004,7 +1046,7 @@ Sensor's transform when the data was generated. --- ## carla.Timestamp -Class that contains Timestamp simulated data. +Class that contains time information for simulated data. This information is automatically retrieved as part of the [carla.WorldSnapshot](#carla.WorldSnapshot) the client gets on every frame, but might also be used in many other situations such as a [carla.Sensor](#carla.Sensor) retrieveing data.

Instance Variables

- **frame** (_int_) @@ -1014,7 +1056,7 @@ Simulated seconds elapsed since the beginning of the current episode. - **delta_seconds** (_float_) Simulated seconds elapsed since the previous frame. - **platform_timestamp** (_float_) -Time-stamp of the frame at which this measurement was taken, in seconds as given by the OS. +Time register of the frame at which this measurement was taken given by the OS in seconds.

Methods

- **\__init__**(**self**, **frame**, **elapsed_seconds**, **delta_seconds**, **platform_timestamp**) @@ -1034,130 +1076,130 @@ Time-stamp of the frame at which this measurement was taken, in seconds as given --- ## carla.TrafficLight -
Inherited from _[carla.TrafficSign](#carla.TrafficSign)_

A traffic light actor. Check out this [`recipe`](../python_cookbook/#traffic-lights-recipe)! +

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

A traffic light actor, considered a specific type of traffic sign. As traffic lights will mostly appear at junctions, they belong to a group which contains the different traffic lights in it. Inside the group, traffic lights are differenciated by their pole index. + + Within a group the state of traffic lights is changed in a cyclic pattern: one index is chosen and it spends a few seconds in green, yellow and eventually red. The rest of the traffic lights remain frozen in red this whole time, meaning that there is a gap in the last seconds of the cycle where all the traffic lights are red. However, the state of a traffic light can be changed manually. Take a look at this [recipe](../python_cookbook/#traffic-lights-recipe) to learn how to do so.

Instance Variables

- **state** (_[carla.TrafficLightState](#carla.TrafficLightState)_) -Current traffic light state. +Current state of the traffic light.

Methods

-- **set_state**(**self**, **state**) -Sets a given state to a traffic light actor. - - **Parameters:** - - `state` (_[carla.TrafficLightState](#carla.TrafficLightState)_) -- **get_state**(**self**) -Returns the current state of the traffic light. - - **Return:** _[carla.TrafficLightState](#carla.TrafficLightState)_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ -- **set_green_time**(**self**, **green_time**) - - **Parameters:** - - `green_time` (_float_) – Sets a given time (in seconds) to the green state to be active. -- **get_green_time**(**self**) -Returns the current time set for the green light to be active. - - **Return:** _float_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ -- **set_yellow_time**(**self**, **yellow_time**) -Sets a given time (in seconds) to the yellow state to be active. - - **Parameters:** - - `yellow_time` (_float_) -- **get_yellow_time**(**self**) -Returns the current time set for the yellow light to be active. - - **Return:** _float_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ -- **set_red_time**(**self**, **red_time**) -Sets a given time (in seconds) to the red state to be active. - - **Parameters:** - - `red_time` (_float_) -- **get_red_time**(**self**) -Returns the current time set for the red light to be active. - - **Return:** _float_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ -- **get_elapsed_time**(**self**) -Returns the current countdown of the state of a traffic light. - - **Return:** _float_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ - **freeze**(**self**, **freeze**) Stops the traffic light at its current state. - **Parameters:** - `freeze` (_bool_) - **is_frozen**(**self**) -Returns `True` if a traffic light is frozen. +The client returns True if a traffic light is frozen according to last tick. The method does not call the simulator. - **Return:** _bool_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ - **get_pole_index**(**self**) -Returns the index of the pole in the traffic light group. +Returns the index of the pole that identifies it as part of the traffic light group of a junction. - **Return:** _int_ - **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_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)_ +- **get_green_time**(**self**) +The client returns the seconds set for the traffic light to be green according to last tick. The method does not call the simulator. + - **Return:** _float_ +- **get_red_time**(**self**) +The client returns the seconds set for the traffic light to be red according to last tick. The method does not call the simulator. + - **Return:** _float_ +- **get_yellow_time**(**self**) +The client returns the the seconds set for the traffic light to be yellow according to last tick. The method does not call the simulator. + - **Return:** _float_ +- **set_state**(**self**, **state**) +Sets a given state to a traffic light actor. + - **Parameters:** + - `state` (_[carla.TrafficLightState](#carla.TrafficLightState)_) +- **set_green_time**(**self**, **green_time**) + - **Parameters:** + - `green_time` (_float_) – Sets a given time (in seconds) for the green light to be active. +- **set_red_time**(**self**, **red_time**) +Sets a given time (in seconds) for the red state to be active. + - **Parameters:** + - `red_time` (_float_) +- **set_yellow_time**(**self**, **yellow_time**) +Sets a given time (in seconds) for the yellow light to be active. + - **Parameters:** + - `yellow_time` (_float_) - **\__str__**(**self**) --- ## carla.TrafficLightState -All possible states for traffic lights. Check out this [`recipe`](../python_cookbook/#traffic-lights-recipe)! +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](../python_cookbook/#traffic-lights-recipe) to see an example.

Instance Variables

+- **Green** - **Red** - **Yellow** -- **Green** - **Off** - **Unknown** --- ## carla.TrafficSign -
Inherited from _[carla.Actor](#carla.Actor)_

A traffic sign actor. +

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

Traffic signs appearing in the simulation except for traffic lights. These have their own class inherited from this in [carla.TrafficLight](#carla.TrafficLight). Right now, speed signs, stops and yields are mainly the ones implemented, but many others are borne in mind.

Instance Variables

- **trigger_volume** -A [carla.BoundingBox](#carla.BoundingBox) situated near a traffic sign where the [carla.Actor](#carla.Actor) who is inside can know about its state. +A [carla.BoundingBox](#carla.BoundingBox) situated near a traffic sign where the [carla.Actor](#carla.Actor) who is inside can know about it. --- ## carla.Transform -Class that defines a transformation without scaling. +Class that defines a transformation, a combination of location and rotation, without scaling.

Instance Variables

- **location** (_[carla.Location](#carla.Location)_) +Describes a point in the coordinate system. - **rotation** (_[carla.Rotation](#carla.Rotation)_) +Describes a rotation for an object according to Unreal Engine's axis system.

Methods

- **\__init__**(**self**, **location**, **rotation**) - **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**) -Transform a 3D point using the current transformation. +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 the rotation of the current transformation. - - **Return:** _[carla.Vector3D](#carla.Vector3D)_ -- **\__eq__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.Transform](#carla.Transform)_) -- **\__ne__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.Transform](#carla.Transform)_) -- **\__str__**(**self**) --- ## carla.Vector2D -Vector 2D helper class. +Helper class to perform 2D operations.

Instance Variables

- **x** (_float_) +X-axis value. - **y** (_float_) +Y-axis value.

Methods

- **\__init__**(**self**, **x**=0.0, **y**=0.0) @@ -1165,34 +1207,47 @@ Vector 2D helper class. - `x` (_float_) - `y` (_float_) - **\__add__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.Vector2D](#carla.Vector2D)_) -- **\__mul__**(**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)_) -- **\__ne__**(**self**, **other**) + - **Return:** _bool_ +- **\__ne__**(**self**, **bool**) +Returns true if the value for any axis is different. - **Parameters:** - - `other` (_[carla.Vector2D](#carla.Vector2D)_) -- **\__self__**(**self**) + - `bool` (_[carla.Vector2D](#carla.Vector2D)_) + - **Return:** _bool_ +- **\__str__**(**self**) +Returns the axis values for the vector parsed as string. + - **Return:** _str_ --- ## carla.Vector3D -Vector 3D helper class. +Helper class to perform 3D operations.

Instance Variables

- **x** (_float_) +X-axis value. - **y** (_float_) +Y-axis value. - **z** (_float_) +Z-axis value.

Methods

- **\__init__**(**self**, **x**=0.0, **y**=0.0, **z**=0.0) @@ -1201,101 +1256,102 @@ Vector 3D helper class. - `y` (_float_) - `z` (_float_) - **\__add__**(**self**, **other**) - - **Parameters:** - - `other` (_[carla.Vector3D](#carla.Vector3D)_) -- **\__mul__**(**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)_) + - **Return:** _bool_ - **\__ne__**(**self**, **other**) +Returns true if the value for any axis is different. - **Parameters:** - `other` (_[carla.Vector3D](#carla.Vector3D)_) + - **Return:** _bool_ - **\__str__**(**self**) +Returns the axis values for the vector parsed as string. + - **Return:** _str_ --- ## carla.Vehicle -
Inherited from _[carla.Actor](#carla.Actor)_

A vehicle actor. +

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

One of the most important group of actors in CARLA. These include any type of vehicle from cars to trucks, motorbikes, vans, bycicles and also official vehicles such as police cars. A wide set of these actors is provided in [carla.BlueprintLibrary](#carla.BlueprintLibrary) to facilitate differente requirements. Vehicles can be either manually controlled or set to an autopilot mode that will be conducted client-side by the traffic manager.

Instance Variables

- **bounding_box** (_[carla.BoundingBox](#carla.BoundingBox)_) -The vehicle's bounding box. +The vehicle's collider volume.

Methods

- **apply_control**(**self**, **control**) -Apply control to this vehicle. The control will take effect on next tick. +Applies a control object on the next tick, containing driving parameters such as throttle, steering or gear shifting. - **Parameters:** - `control` (_[carla.VehicleControl](#carla.VehicleControl)_) -- **get_control**(**self**) -Returns the control last applied to this vehicle. - - **Return:** _[carla.VehicleControl](#carla.VehicleControl)_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ - **apply_physics_control**(**self**, **physics_control**) -Apply physics control to this vehicle. The control will take effect on the next tick. +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)_) +- **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_physics_control**(**self**) -Returns the physics control last applied to this vehicle. +The simulator returns the last physics control applied to this vehicle. - **Return:** _[carla.VehiclePhysicsControl](#carla.VehiclePhysicsControl)_ - **Warning:** _This function does call the simulator to retrieve the value._ +- **get_speed_limit**(**self**) +The client returns the speed limit affecting this vehicle according to last tick (it does not call the simulator). The speed limit is updated when passing by a speed limit signal, so a vehicle might have none right after spawning. + - **Return:** _float_ +- **get_traffic_light**(**self**) +Retrieves the traffic light actor affecting this vehicle (if any) according to last tick. The method does not call the simulator. + - **Return:** _[carla.TrafficLight](#carla.TrafficLight)_ +- **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) -Switch on/off this vehicle's server-side autopilot. +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_) -- **get_speed_limit**(**self**) -Returns the speed limit currently affecting this vehicle. Note that the speed limit is only updated when passing by a speed limit signal, right after spawning a vehicle it might not reflect the actual speed limit of the current road. - - **Return:** _float_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ -- **get_traffic_light_state**(**self**) -Returns the state of the traffic light currently affecting this vehicle. If no traffic light is currently affecting the vehicle, return Green. - - **Return:** _[carla.TrafficLightState](#carla.TrafficLightState)_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ -- **is_at_traffic_light**(**self**) -Returns whether a traffic light is affecting this vehicle. - - **Return:** _bool_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ -- **get_traffic_light**(**self**) -Retrieve the traffic light actor currently affecting this vehicle. - - **Return:** _[carla.TrafficLight](#carla.TrafficLight)_ - **\__str__**(**self**) - **Return:** _str_ --- ## carla.VehicleControl -VehicleControl is used for controlling the basic movement of a vehicle. +Manages the basic movement of a vehicle using typical driving controls.

Instance Variables

- **throttle** (_float_) -A scalar value to control the vehicle throttle [0.0, 1.0]. +A scalar value to control the vehicle throttle [0.0, 1.0]. Default is 0.0. - **steer** (_float_) -A scalar value to control the vehicle steering [-1.0, 1.0]. +A scalar value to control the vehicle steering [-1.0, 1.0]. Default is 0.0. - **brake** (_float_) -A scalar value to control the vehicle brake [0.0, 1.0]. +A scalar value to control the vehicle brake [0.0, 1.0]. Default is 0.0. - **hand_brake** (_bool_) -If true, hand brake will be used. +Determines whether hand brake will be used. Default is False. - **reverse** (_bool_) -If true, the vehicle will move reverse. +Determines whether the vehicle will move backwards. Default is False. - **manual_gear_shift** (_bool_) -If true, the vehicle will be controlled by changing gears manually. +Determines whether the vehicle will be controlled by changing gears manually. Default is False. - **gear** (_int_) -Controls the gear value of the vehicle. +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) -VehicleControl constructor. - **Parameters:** - `throttle` (_float_) - `steer` (_float_) @@ -1339,7 +1395,7 @@ All lights on. --- ## carla.VehiclePhysicsControl -VehiclePhysicsControl is used for controlling the physics parameters of a vehicle. +Summarizes the parameters that will be used to simulate a [carla.Vehicle](#carla.Vehicle) as a physical object. The specific settings for the wheels though are stipulated using [carla.WheelPhysicsControl](#carla.WheelPhysicsControl).

Instance Variables

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

Methods

- **\__init__**(**self**, **torque_curve**=[[0.0, 500.0], [5000.0, 500.0]], **max_rpm**=5000.0, **moi**=1.0, **damping_rate_full_throttle**=0.15, **damping_rate_zero_throttle_clutch_engaged**=2.0, **damping_rate_zero_throttle_clutch_disengaged**=0.35, **use_gear_autobox**=True, **gear_switch_time**=0.5, **clutch_strength**=10.0, **final_ratio**=4.0, **forward_gears**=list(), **mass**=1000.0, **drag_coefficient**=0.3, **center_of_mass**=[0.0, 0.0, 0.0], **steering_curve**=[[0.0, 1.0], [10.0, 0.5]], **wheels**=list()) @@ -1405,64 +1461,59 @@ VehiclePhysicsControl constructor. --- ## carla.Walker -
Inherited from _[carla.Actor](#carla.Actor)_

A walking actor, pedestrian. +

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

This class inherits from the [carla.Actor](#carla.Actor) and defines pedestrians in the simulation. Walkers are a special type of actor that can be controlled either by an AI ([carla.WalkerAIController](#carla.WalkerAIController)) or manually via script, using a series of [carla.WalkerControl](#carla.WalkerControl) to move these and their skeletons.

Instance Variables

- **bounding_box** (_[carla.BoundingBox](#carla.BoundingBox)_) -The walker's bounding box. +The walker's collider defined by a bounding box.

Methods

- **apply_control**(**self**, **control**) -Apply control to this walker. +On the next tick, the control will move the walker in a certain direction with a certain speed. Jumps can be commanded too. - **Parameters:** - `control` (_[carla.WalkerControl](#carla.WalkerControl)_) - - **Note:** _The control will take effect on the next tick. -_ - **apply_control**(**self**, **control**) -Apply bone control to this walker. +On the next tick, the control defines a list of bone transformations that will be applied to the walker's skeleton. - **Parameters:** - `control` (_[carla.WalkerBoneControl](#carla.WalkerBoneControl)_) - - **Note:** _The control will take effect on the next tick. -_ - **get_control**(**self**) -Returns the control last applied to this walker. +The client returns the control applied to this walker during last tick. The method does not call the simulator. - **Return:** _[carla.WalkerControl](#carla.WalkerControl)_ - - **Note:** _This function does not call the simulator, it returns the data received in the last tick. -_ - **\__str__**(**self**) - **Return:** _str_ --- ## carla.WalkerAIController -
Inherited from _[carla.Actor](#carla.Actor)_

Class used for controlling the automation of a pedestrian. +

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**) -Initializes walker controller. +Enables AI control for its parent walker. - **stop**(**self**) -Stops walker controller. +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)_) - **set_max_speed**(**self**, **speed**=1.4) -Sets the speed of the pedestrian. +Sets a speed for the walker in meters per second. - **Parameters:** - - `speed` (_float_) – Speed is in m/s. + - `speed` (_float_) – speed in m/s. An easy walking speed is set by default. - **\__str__**(**self**) --- ## carla.WalkerBoneControl -Class used for controlling the skeleton of a walker. See [walker bone control](walker_bone_control.md). +This class grants bone specific manipulation for walker. The skeletons of walkers have been unified for clarity and the transform applied to each bone are always relative to its parent. Take a look [here](walker_bone_control.md) to learn more on how to create a walker and define its movement.

Instance Variables

- **bone_transforms** (_list([name,transform])_) -List of pairs where the first value is the bone name and the second value is the bone transform. +List of tuples where the first value is the bone's name and the second value stores the transformation (changes in location and rotation) that will be applied to it.

Methods

- **\__init__**(**self**, **list(name,transform)**) +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_) - **\__str__**(**self**) @@ -1470,27 +1521,30 @@ List of pairs where the first value is the bone name and the second value is the --- ## carla.WalkerControl -WalkerControl is used for controlling the basic movement of a walker. +This class defines specific directions that can be commanded to a [carla.Walker](#carla.Walker) to control it via script. The walker's animations will blend automatically with the parameters defined in this class when applied, though specific skeleton moves can be obtained through class.WalkerBoneControl. + + AI control can be settled for walkers, but the control used to do so is [carla.WalkerAIController](#carla.WalkerAIController).

Instance Variables

- **direction** (_[carla.Vector3D](#carla.Vector3D)_) -Vector that controls the direction of the walker. +Vector using global coordinates that will correspond to the direction of the walker. - **speed** (_float_) -A scalar value to control the walker speed. +A scalar value to control the walker's speed. - **jump** (_bool_) -If true, the walker will perform a jump. +If True, the walker will perform a jump.

Methods

- **\__init__**(**self**, **direction**=[1.0, 0.0, 0.0], **speed**=0.0, **jump**=False) -WalkerControl constructor. - **Parameters:** - `direction` (_[carla.Vector3D](#carla.Vector3D)_) - `speed` (_float_) - `jump` (_bool_) - **\__eq__**(**self**, **other**) +Compares every variable with `other` and returns True if these are all the same. - **Parameters:** - `other` (_[carla.WalkerControl](#carla.WalkerControl)_) - **\__ne__**(**self**, **other**) +Compares every variable with `other` and returns True if any of these differ. - **Parameters:** - `other` (_[carla.WalkerControl](#carla.WalkerControl)_) - **\__str__**(**self**) @@ -1528,16 +1582,16 @@ 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, regardless if the lane change is allowed in this location. -Can return None if the lane does not exist. +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, regardless if the lane change is allowed in this location. -Can return None if the lane does not exist. +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 road ends before the specified distance, for instance, a lane ending with the only option of incorporating to another road. +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. - **Parameters:** - `distance` (_float_) – The approximate distance where to get the next waypoints. - **Return:** _list([carla.Waypoint](#carla.Waypoint))_ @@ -1547,8 +1601,8 @@ Returns a list of waypoints from this to the end of the lane separated by a cert - `distance` (_float_) – The approximate distance between waypoints. - **Return:** _list([carla.Waypoint](#carla.Waypoint))_ - **previous**(**self**, **distance**) -This method does not return the waypoint previously visited by an actor, but a list of waypoints at an approximate `distance` but in the opposite direction of the lane. Similarly to **next()**, 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 road ends before the specified distance, for instance, a lane ending with the only option of incorporating to another road. +This method does not return the waypoint previously visited by an actor, but a list of waypoints at an approximate `distance` but in the opposite direction of the lane. Similarly to **next()**, 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. - **Parameters:** - `distance` (_float_) – The approximate distance where to get the previous waypoints. - **Return:** _list([carla.Waypoint](#carla.Waypoint))_ @@ -1562,17 +1616,18 @@ Returns a list of waypoints from this to the start of the lane separated by a ce --- ## carla.WeatherParameters -WeatherParameters class is used for requesting and changing the lighting and weather conditions inside the world. +This class defines objects containing lightning and weather specifications that can later be applied in [carla.World](#carla.World). So far, these conditions only intervene with [sensor.camera.rgb](/bp_library/). They neither affect the actor's physics nor other sensors. + Each of these parameters acts indepently from the rest. Increasing the rainfall will not automatically create puddles nor change the road's humidity. That makes for a better customization but means that realistic conditions need to be scripted. However an example of dynamic weather conditions working realistically can be found [here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/dynamic_weather.py).

Instance Variables

- **cloudiness** (_float_) -Weather cloudiness. It only affects the RGB camera sensor. Values range from 0 to 100. +Values range from 0 to 100, being 0 a clear sky and 100 one completely covered with clouds. - **precipitation** (_float_) -Precipitation amount for controlling rain intensity. It only affects the RGB camera sensor. Values range from 0 to 100. +Rain intensity values range from 0 to 100, being 0 none at all and 100 a heavy rain. - **precipitation_deposits** (_float_) -Precipitation deposits for controlling the area of puddles on roads. It only affects the RGB camera sensor. Values range from 0 to 100. +Determines the creation of puddles. Values range from 0 to 100, being 0 none at all and 100 a road completely capped with water. Puddles are created with static noise, meaning that they will always appear at the same locations. - **wind_intensity** (_float_) -Wind intensity, it affects the clouds moving speed, the raindrop direction, and vegetation. This doesn't affect the car physics. Values range from 0 to 100. +Controls the strenght of the wind with values from 0, no wind at all, to 100, a strong wind. The wind does affect rain direction and leaves from trees, so this value is restricted to avoid animation issues. - **fog_density** (_float_) Fog density. It only affects the RGB camera sensor. Values range from 0 to 100. - **fog_distance** (_float_) @@ -1580,52 +1635,53 @@ Fog start distance (in meters). Values range from 0 to infinite. - **wetness** (_float_) Wetness intensity. It only affects the RGB camera sensor. Values range from 0 to 100. - **sun_azimuth_angle** (_float_) -The azimuth angle of the sun in degrees. Values range from 0 to 360 (degrees). +The azimuth angle of the sun in degrees. Values range from 0 to 360. Zero is an origin point in a sphere determined by Unreal Engine. - **sun_altitude_angle** (_float_) -Altitude angle of the sun in degrees. Values range from -90 to 90 (where 0 degrees is the horizon). +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) -WeatherParameters constructor. +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_) - - `precipitation` (_float_) - - `precipitation_deposits` (_float_) - - `wind_intensity` (_float_) - - `sun_azimuth_angle` (_float_) - - `sun_altitude_angle` (_float_) + - `cloudiness` (_float_) – 0 is a clear sky, 100 complete overcast. + - `precipitation` (_float_) – 0 is no rain at all, 100 a heavy rain. + - `precipitation_deposits` (_float_) – 0 means no puddles on the road, 100 means roads completely capped by rain. + - `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. + - **Note:** _ClearNoon, CloudyNoon, WetNoon, WetCloudyNoon, SoftRainNoon, MidRainyNoon, HardRainNoon, ClearSunset, CloudySunset, WetSunset, WetCloudySunset, SoftRainSunset, MidRainSunset, HardRainSunset. +_ - **\__eq__**(**self**, **other**) -Returns True if `self` and `other` are equal. +Returns True if both objects' variables are the same. - **Return:** _bool_ - **\__ne__**(**self**, **other**) -Returns True if `self` and `other` are not equal. +Returns True if both objects' variables are different. - **Return:** _bool_ - **\__str__**(**self**) --- ## carla.WheelPhysicsControl -WheelPhysicsControl is used for controlling the physics parameters of a vehicle's wheel. +Class that defines specific physical parameters for wheel objects that will be part of a [carla.VehiclePhysicsControl](#carla.VehiclePhysicsControl) to simulate vehicle it as a material object.

Instance Variables

- **tire_friction** (_float_) A scalar value that indicates the friction of the wheel. - **damping_rate** (_float_) -The damping rate of the wheel. +Damping rate of the wheel. - **max_steer_angle** (_float_) -The maximum angle in degrees that the wheel can steer. +Maximum angle in degrees that the wheel can steer. - **radius** (_float_) -The radius of the wheel in centimeters. +Radius of the wheel in centimeters. - **max_brake_torque** (_float_) -The maximum brake torque in Nm. +Maximum brake torque in Nm. - **max_handbrake_torque** (_float_) -The maximum handbrake torque in Nm. +Maximum handbrake torque in Nm. - **position** (_[carla.Vector3D](#carla.Vector3D)_) -World position of the wheel. Note that it is a read-only parameter. +World position of the wheel. This is a read-only parameter.

Methods

- **\__init__**(**self**, **tire_friction**=2.0, **damping_rate**=0.25, **max_steer_angle**=70.0, **radius**=30.0, **max_brake_torque**=1500.0, **max_handbrake_torque**=3000.0, **position**=(0.0,0.0,0.0)) -WheelPhysicsControl constructor. - **Parameters:** - `tire_friction` (_float_) - `damping_rate` (_float_) @@ -1645,146 +1701,170 @@ WheelPhysicsControl constructor. --- ## carla.World -Class that contains the current loaded map. +World objects are created by the client to have a place for the simulation to happen. The world contains the map we can see, meaning the asset, not the navigation map. Navigation maps are part of the [carla.Map](#carla.Map) class. It also manages the weather and actors present in it. There can only be one world per simulation, but it can be changed anytime.

Instance Variables

- **id** (_int_) -The id of the episode associated with this world. +The ID of the episode associated with this world. Episodes are different sessions of a simulation. These change everytime a world is disabled or reloaded. Keeping track is useful to avoid possible issues. - **debug** (_[carla.DebugHelper](#carla.DebugHelper)_) +Responsible for creating different shapes for debugging. Take a look at its class to learn more about it.

Methods

-- **get_blueprint_library**(**self**) -Return the list of blueprints available in this world. These blueprints can be used to spawn actors into the world. - - **Return:** _[carla.BlueprintLibrary](#carla.BlueprintLibrary)_ -- **get_map**(**self**) -Return the map that describes this world. - - **Return:** _[carla.Map](#carla.Map)_ -- **get_spectator**(**self**) -Return the spectator actor. The spectator controls the view in the simulator window. - - **Return:** _[carla.Actor](#carla.Actor)_ -- **get_settings**(**self**) - - **Return:** _[carla.WorldSettings](#carla.WorldSettings)_ +- **\__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**) -Returns the id of the frame when the settings took effect. +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_ -- **get_weather**(**self**) -Retrieve the weather parameters currently active in the world. - - **Return:** _[carla.WeatherParameters](#carla.WeatherParameters)_ -- **set_weather**(**self**, **weather**) -Change the weather in the simulation. - - **Parameters:** - - `weather` (_[carla.WeatherParameters](#carla.WeatherParameters)_) -- **get_snapshot**(**self**) -Return a snapshot of the world at this moment. - - **Return:** _[carla.WorldSnapshot](#carla.WorldSnapshot)_ - **get_actor**(**self**, **actor_id**) -Find actor by id, return None if not found. +Looks up for an actor by ID and returns None if not found. - **Parameters:** - `actor_id` (_int_) - **Return:** _[carla.Actor](#carla.Actor)_ -- **get_random_location_from_navigation**(**self**) -Retrieve a random location to be used as a destination for walkers in [carla.WalkerAIController.go_to_location](#carla.WalkerAIController.go_to_location). See [`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_actors**(**self**) -By default it returns a list with every actor present in the world. _A list of ids can be used as a parameter_. +- **get_actors**(**self**, **actor_ids**=None) +Retrieves a list of [carla.Actor](#carla.Actor) elements, either using a list of IDs provided or just listing everyone on stage. If an ID does not correspond with any actor, it will be excluded from the list returned, meaning that both the list of IDs and the list of actors may have different lengths. + - **Parameters:** + - `actor_ids` (_list_) – The IDs of the actors being searched. By default it is set to None and returns every actor on scene. - **Return:** _[carla.ActorList](#carla.ActorList)_ -- **spawn_actor**(**self**, **blueprint**, **transform**, **attach_to**=None, **attachment**=Rigid) -Spawn an actor into the world based on the blueprint provided at transform. If a parent is provided, the actor is attached to parent. - - **Parameters:** - - `blueprint` (_[carla.BlueprintLibrary](#carla.BlueprintLibrary)_) - - `transform` (_[carla.Transform](#carla.Transform)_) – If attached to parent, transform acts like a relative_transform to the parent actor. - - `attach_to` (_[carla.Actor](#carla.Actor)_) - - `attachment` (_[carla.AttachmentType](#carla.AttachmentType)_) - - **Return:** _[carla.Actor](#carla.Actor)_ -- **try_spawn_actor**(**self**, **blueprint**, **transform**, **attach_to**=None, **attachment**=Rigid) -Same as SpawnActor but return none on failure instead of throwing an exception. - - **Parameters:** - - `blueprint` (_[carla.BlueprintLibrary](#carla.BlueprintLibrary)_) - - `transform` (_[carla.Transform](#carla.Transform)_) – If attached to parent, transform acts like a relative_transform to the parent actor. - - `attach_to` (_[carla.Actor](#carla.Actor)_) - - `attachment` (_[carla.AttachmentType](#carla.AttachmentType)_) - - **Return:** _[carla.Actor](#carla.Actor)_ -- **wait_for_tick**(**self**, **seconds**=10.0) -Block calling thread until a world tick is received. - - **Parameters:** - - `seconds` (_float_) +- **get_blueprint_library**(**self**) +Returns a list of actor blueprints available to ease the spawn of these into the world. + - **Return:** _[carla.BlueprintLibrary](#carla.BlueprintLibrary)_ +- **get_map**(**self**) +Returns the object containing the navigation map used to describe this world. + - **Return:** _[carla.Map](#carla.Map)_ +- **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_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**) -Returns the ID of the callback so it can be removed with `remove_on_tick`. +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)_) + - `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**) -Removes on tick callbacks. +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**) -Synchronizes with the simulator and returns the id of the newly started frame (only has effect on synchronous mode). +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_ -- **\__str__**(**self**) +- **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)_ --- ## carla.WorldSettings -Class that provides access to modifiable world settings. Check it out in our [section](../configuring_the_simulation/). +The simulation has some advanced configuration options that are contained in this class and can be managed using [carla.World](#carla.World) and its methods. These allow the user to choose between client-server synchrony/asynchrony, activation of "no rendering mode" and either if the simulation should run with a fixed or variable time-step. Check [this](../configuring_the_simulation/) out if you want to learn about it.

Instance Variables

- **synchronous_mode** (_bool_) +States the synchrony between client and server. When set to true, the server will wait for a client tick in order to move forward. It is false by default. - **no_rendering_mode** (_bool_) +When enabled, the simulation will run no rendering at all. This is mainly used to avoid overhead during heavy traffic simulations. It is false by default. - **fixed_delta_seconds** (_float_) +Ensures that the time elapsed between two steps of the simulation is fixed. Set this to 0.0 to work with a variable time-step, as happens by default.

Methods

- **\__init__**(**self**, **synchronous_mode**=False, **no_rendering_mode**=False, **fixed_delta_seconds**=0.0) +Creates an object containing desired settings that could later be applied through [carla.World](#carla.World) and its method **apply_settings()**. - **Parameters:** - - `synchronous_mode` (_bool_) - - `no_rendering_mode` (_bool_) - - `fixed_delta_seconds` (_float_) + - `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**) +Returns True if both objects' variables are the same. - **Parameters:** - - `other` (_[carla.Timestamp](#carla.Timestamp)_) + - `other` (_[carla.WorldSettings](#carla.WorldSettings)_) – Settings to be compared with. + - **Return:** _bool_ - **\__ne__**(**self**, **other**) +Returns True if both objects' variables are different. - **Parameters:** - - `other` (_[carla.Timestamp](#carla.Timestamp)_) + - `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. + - **Return:** _str_ --- ## carla.WorldSnapshot -Class that represents the state of every actor in the simulation at a single frame. +This snapshot comprises all the information for every actor on scene at a certain moment of time. It creates and gives acces to a data structure containing a series of [carla.ActorSnapshot](#carla.ActorSnapshot). The client recieves a new snapshot on every tick that cannot be stored.

Instance Variables

- **id** (_int_) -The WorldSnapshot's identifier. +A value unique for every snapshot to differenciate them. - **frame** (_int_) -Frame number. +Simulation frame in which the snapshot was taken. - **timestamp** (_[carla.Timestamp](#carla.Timestamp)_) -Timestamp simulated data. +Precise moment in time when snapshot was taken. This class works in seconds as given by the operative system.

Methods

-- **has_actor**(**self**, **actor_id**) -Check if an actor is present in this snapshot. - - **Parameters:** - - `actor_id` (_int_) -- **find**(**self**, **actor_id**) -Find an ActorSnapshot by id, return None if the actor is not found. - - **Parameters:** - - `actor_id` (_int_) -- **\__len__**(**self**) -Return number of [carla.ActorSnapshot](#carla.ActorSnapshot) present in this [carla.WorldSnapshot](#carla.WorldSnapshot). - - **Return:** _int_ -- **\__iter__**(**self**) - **\__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)_) -- **\__self__**(**self**) + - **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:** + - `actor_id` (_int_) + - **Return:** _[carla.ActorSnapshot](#carla.ActorSnapshot)_ +- **has_actor**(**self**, **actor_id**) +Given a certain actor ID, checks if there is a snapshot corresponding it and so, if the actor was present at that moment. + - **Parameters:** + - `actor_id` (_int_) + - **Return:** _bool_ --- ## command.ApplyAngularVelocity -Set the actor's angular velocity. +Command adaptation of **set_angular_velocity()** in [carla.Actor](#carla.Actor). Sets an actor's angular velocity.

Instance Variables

- **actor_id** (_int_) @@ -1795,13 +1875,13 @@ The 3D angular velocity that will be applied to the actor.

Methods

- **\__init__**(**self**, **actor**, **angular_velocity**) - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor) or int_) + - `actor` (_[carla.Actor](#carla.Actor) or int_) – Actor or its ID to whom the command will be applied to. - `angular_velocity` (_[carla.Vector3D](#carla.Vector3D)_) --- ## command.ApplyImpulse -Adds impulse to the actor. +Command adaptation of **add_impulse()** in [carla.Actor](#carla.Actor). Adds impulse to an actor.

Instance Variables

- **actor_id** (_int_) @@ -1812,13 +1892,13 @@ Impulse applied to the actor.

Methods

- **\__init__**(**self**, **actor**, **impulse**) - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor) or int_) + - `actor` (_[carla.Actor](#carla.Actor) or int_) – Actor or its ID to whom the command will be applied to. - `impulse` (_[carla.Vector3D](#carla.Vector3D)_) --- ## command.ApplyTransform -Sets a new transform to the actor. +Command adaptation of **set_transform()** in [carla.Actor](#carla.Actor). Sets a new transform to an actor.

Instance Variables

- **actor_id** (_int_) @@ -1829,13 +1909,13 @@ Transformation to be applied.

Methods

- **\__init__**(**self**, **actor**, **transform**) - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor) or int_) + - `actor` (_[carla.Actor](#carla.Actor) or int_) – Actor or its ID to whom the command will be applied to. - `transform` (_[carla.Transform](#carla.Transform)_) --- ## command.ApplyVehicleControl -Apply control to the vehicle. +Command adaptation of **apply_control()** in [carla.Vehicle](#carla.Vehicle). Applies a certain control to a vehicle.

Instance Variables

- **actor_id** (_int_) @@ -1846,13 +1926,13 @@ Vehicle control to be applied.

Methods

- **\__init__**(**self**, **actor**, **control**) - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor) or int_) + - `actor` (_[carla.Actor](#carla.Actor) or int_) – Actor or its ID to whom the command will be applied to. - `control` (_[carla.VehicleControl](#carla.VehicleControl)_) --- ## command.ApplyVelocity -Sets actor's velocity. +Command adaptation of **set_velocity()** in [carla.Actor](#carla.Actor). Sets an actor's velocity.

Instance Variables

- **actor_id** (_int_) @@ -1863,30 +1943,30 @@ The 3D velocity applied to the actor.

Methods

- **\__init__**(**self**, **actor**, **velocity**) - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor) or int_) + - `actor` (_[carla.Actor](#carla.Actor) or int_) – Actor or its ID to whom the command will be applied to. - `velocity` (_[carla.Vector3D](#carla.Vector3D)_) --- ## command.ApplyWalkerControl -Apply control to the walker. +Command adaptation of **apply_control()** in [carla.Walker](#carla.Walker). Applies a control to a walker.

Instance Variables

- **actor_id** (_int_) Walker actor affected by the command. -- **control** (_[carla.VehicleControl](#carla.VehicleControl)_) +- **control** (_[carla.WalkerControl](#carla.WalkerControl)_) Walker control to be applied.

Methods

- **\__init__**(**self**, **actor**, **control**) - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor) or int_) + - `actor` (_[carla.Actor](#carla.Actor) or int_) – Actor or its ID to whom the command will be applied to. - `control` (_[carla.WalkerControl](#carla.WalkerControl)_) --- ## command.ApplyWalkerState -Apply a state to the walker actor. +Apply a state to the walker actor. Specially useful to initialize an actor them with a specific location, orientation and speed.

Instance Variables

- **actor_id** (_int_) @@ -1899,14 +1979,14 @@ Speed to be applied.

Methods

- **\__init__**(**self**, **actor**, **transform**, **speed**) - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor) or int_) + - `actor` (_[carla.Actor](#carla.Actor) or int_) – Actor or its ID to whom the command will be applied to. - `transform` (_[carla.Transform](#carla.Transform)_) - `speed` (_float_) --- ## command.DestroyActor -Tell the simulator to destroy this Actor, and return whether the actor was successfully destroyed. It has no effect if the Actor was already successfully destroyed. +Command adaptation of **destroy()** in [carla.Actor](#carla.Actor) that tells the simulator to destroy this actor. It has no effect if the actor was already destroyed. When executed with **apply_batch_synch()** in [carla.Client](#carla.Client) there will be a command.Response that will return a boolean stating whether the actor was successfully destroyed.

Instance Variables

- **actor_id** (_int_) @@ -1915,65 +1995,68 @@ Actor affected by the command.

Methods

- **\__init__**(**self**, **actor**) - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor) or int_) + - `actor` (_[carla.Actor](#carla.Actor) or int_) – Actor or its ID to whom the command will be applied to. --- ## command.Response -Execution result of a command, contains either an error string or an actor ID, depending on whether or not the command succeeded. See [carla.Client.apply_batch_sync](#carla.Client.apply_batch_sync). +States the result of executing a command as either the ID of the actor to whom the command was applied to (when succeeded) or an error string (when failed). actor ID, depending on whether or not the command succeeded. The method **apply_batch_sync()** in [carla.Client](#carla.Client) returns a list of these to summarize the execution of a batch.

Instance Variables

- **actor_id** (_int_) -Actor affected by the command. +Actor to whom the command was applied to. States that the command was successful. - **error** (_str_) +A string stating the command has failed.

Methods

- **has_error**(**self**) +Returns True if the command represents a successful execution and False if not. + - **Return:** _bool_ --- ## command.SetAutopilot -Switch on/off vehicle's server-side autopilot. +Command adaptation of **set_autopilot()** in [carla.Vehicle](#carla.Vehicle). Turns on/off the vehicle's server-side autopilot.

Instance Variables

- **actor_id** (_int_) Actor that is affected by the command. - **enabled** (_bool_) -If the autopilot is enabled or not. +If autopilot should be activated or not.

Methods

- **\__init__**(**self**, **actor**, **enabled**) - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor) or int_) + - `actor` (_[carla.Actor](#carla.Actor) or int_) – Actor or its ID to whom the command will be applied to. - `enabled` (_bool_) --- ## command.SetSimulatePhysics -Whether an actor will be affected by physics or not. +Command adaptation of **set_simulate_physics()** in [carla.Actor](#carla.Actor). Determines whether an actor will be affected by physics or not.

Instance Variables

- **actor_id** (_int_) Actor affected by the command. - **enabled** (_bool_) -If physics will affect the actor. +If physics should be activated or not.

Methods

- **\__init__**(**self**, **actor**, **enabled**) - **Parameters:** - - `actor` (_[carla.Actor](#carla.Actor) or int_) + - `actor` (_[carla.Actor](#carla.Actor) or int_) – Actor or its ID to whom the command will be applied to. - `enabled` (_bool_) --- ## command.SpawnActor -Spawn an actor into the world based on the blueprint provided and the transform. If a parent is provided, the actor is attached to parent. +Command adaptation of **spawn_actor()** in [carla.World](#carla.World). Spawns an actor into the world based on the blueprint provided and the transform. If a parent is provided, the actor is attached to it.

Instance Variables

- **transform** (_[carla.Transform](#carla.Transform)_) Transform to be applied. - **parent_id** (_int_) -Parent's actor id. +Identificator of the parent actor.

Methods

- **\__init__**(**self**) @@ -1987,7 +2070,7 @@ Parent's actor id. - `transform` (_[carla.Transform](#carla.Transform)_) - `parent` (_[carla.Actor](#carla.Actor) or int_) - **then**(**self**, **command**) -Link another command to be executed right after. +Links another command to be executed right after. It allows to ease very common flows such as spawning a set of vehicles by command and then using this method to set them to autopilot automatically. - **Parameters:** - `command` (_[carla.Command](#carla.Command)_) – CommandType. diff --git a/PythonAPI/docs/actor.yml b/PythonAPI/docs/actor.yml index 726d8255e..58a28dd6c 100644 --- a/PythonAPI/docs/actor.yml +++ b/PythonAPI/docs/actor.yml @@ -5,136 +5,94 @@ - class_name: Actor # - DESCRIPTION ------------------------ doc: > - Base class for all actors. - - Actor is anything that plays a role in the simulation and can be moved - around, examples of actors are vehicles, pedestrians, and sensors. + CARLA defines actors as anything that plays a role in the simulation or can be moved around. That includes: pedestrians, vehicles, sensors and traffic signs (considering traffic lights as part of these). Actors are spawned in the simulation by carla.World and they need for a carla.ActorBlueprint to be created. These blueprints belong into a library provided by CARLA, find more about them [here](../bp_library/). # - PROPERTIES ------------------------- instance_variables: - - var_name: id - type: int - doc: > - Unique id identifying this actor. Note ids are unique during a - given episode. - - var_name: type_id - type: str - doc: > - Id of the blueprint that created this actor, e.g. - "vehicle.ford.mustang". - - var_name: parent - type: carla.Actor - doc: > - Parent actor of this instance, None if this instance is not attached to - another actor. - - var_name: semantic_tags - type: list(int) - doc: > - List of semantic tags of all components of this actor, see semantic - segmentation sensor for the list of available tags. E.g., a traffic - light actor could contain "pole" and "traffic light" tags. - - var_name: is_alive - type: bool - deprecated: > - This method is not reliable to check if an actor is still alive. Use - `world.get_actor(actor.id)` to check if the actor is still present in - the simulation. - doc: > - Returns whether this object was destroyed using this actor handle. - var_name: attributes type: dict doc: > - Dictionary of attributes of the blueprint that created this actor. + A dictionary containing the attributes of the blueprint this actor was based on. + - var_name: id + type: int + doc: > + Identifier for this actor. Unique during a given episode. + - var_name: parent + type: carla.Actor + doc: > + Actors may be attached to a parent actor that they will follow around. This is said actor. + - var_name: semantic_tags + type: list(int) + doc: > + A list of semantic tags provided by the blueprint listing components for this actor. E.g. a traffic light could be tagged with "pole" and "traffic light". These tags are used by the semantic segmentation sensor. Find more about this and other sensors [here](../cameras_and_sensors/#sensor.camera.semantic_segmentation). + - var_name: type_id + type: str + doc: > + The identifier of the blueprint this actor was based on, e.g. "vehicle.ford.mustang". + # - METHODS ---------------------------- methods: - - def_name: destroy - return: bool + - def_name: __str__ + return: str doc: > - Tell the simulator to destroy this Actor, and return whether the actor - was successfully destroyed. It has no effect if the Actor was already - successfully destroyed. - warning: > - This function blocks until the destruction operation is completed by the - simulator. - # -------------------------------------- - - def_name: get_world - return: carla.World - doc: > - Returns the world this actor belongs to. - # -------------------------------------- - - def_name: get_location - return: carla.Location - doc: > - Returns the actor's current location. - note: > - This function does not call the simulator, it returns the location - received in the last tick. - # -------------------------------------- - - def_name: get_transform - return: carla.Transform - doc: > - Returns the actor's current transform. - note: > - This function does not call the simulator, it returns the - transform received in the last tick. - # -------------------------------------- - - def_name: get_velocity - return: carla.Vector3D - doc: > - Returns the actor's current 3D velocity. - note: > - This function does not call the simulator, it returns the velocity - received in the last tick. - # -------------------------------------- - - def_name: get_angular_velocity - return: carla.Vector3D - doc: > - Returns the actor's current 3D angular velocity. - note: > - This function does not call the simulator, it returns the angular - velocity received in the last tick. - # -------------------------------------- - - def_name: get_acceleration - return: carla.Vector3D - doc: > - Returns the actor's current 3D acceleration. - note: > - This function does not call the simulator, it returns the acceleration - received in the last tick. - # -------------------------------------- - - def_name: set_location - params: - - param_name: location - type: carla.Location - doc: > - Teleport the actor to a given location. - # -------------------------------------- - - def_name: set_transform - params: - - param_name: transform - type: carla.Transform - doc: > - Teleport the actor to a given transform. - # -------------------------------------- - - def_name: set_velocity - params: - - param_name: velocity - type: carla.Vector3D - doc: > - Set the actor's velocity. - # -------------------------------------- - - def_name: set_angular_velocity - params: - - param_name: angular_velocity - type: carla.Vector3D - doc: > - Set the actor's angular velocity. + Parses a summary of this actor's information to string. # -------------------------------------- - def_name: add_impulse params: - param_name: impulse type: carla.Vector3D doc: > - Add impulse to the actor. + Adds an impulse to the actor. + # -------------------------------------- + - def_name: destroy + return: bool + doc: > + Tells the simulator to destroy this actor and returns True if it was successful. It has no effect if it was already destroyed. + warning: > + This method blocks the script until the destruction is completed by the simulator. + # -------------------------------------- + - def_name: get_acceleration + return: carla.Vector3D + doc: > + Returns the actor's 3D acceleration vector the client recieved during last tick. The method does not call the simulator. + # -------------------------------------- + - def_name: get_angular_velocity + return: carla.Vector3D + doc: > + Returns the actor's angular velocity vector the client recieved during last tick. The method does not call the simulator. + # -------------------------------------- + - def_name: get_location + return: carla.Location + doc: > + Returns the actor's location the client recieved during last tick. The method does not call the simulator. + # -------------------------------------- + - def_name: get_transform + return: carla.Transform + doc: > + Returns the actor's transform (location and rotation) the client recieved during last tick. The method does not call the simulator. + # -------------------------------------- + - def_name: get_velocity + return: carla.Vector3D + doc: > + Returns the actor's velocity vector the client recieved during last tick. The method does not call the simulator. + # -------------------------------------- + - def_name: get_world + return: carla.World + doc: > + Returns the world this actor belongs to. + # -------------------------------------- + - def_name: set_angular_velocity + params: + - param_name: angular_velocity + type: carla.Vector3D + doc: > + Changes the actor's angular velocity vector. + # -------------------------------------- + - def_name: set_location + params: + - param_name: location + type: carla.Location + doc: > + Teleports the actor to a given location. # -------------------------------------- - def_name: set_simulate_physics params: @@ -142,10 +100,21 @@ type: bool default: True doc: > - Enable or disable physics simulation on this actor. + Enables or disables the simulation of physics on this actor. # -------------------------------------- - - def_name: __str__ - return: str + - def_name: set_transform + params: + - param_name: transform + type: carla.Transform + doc: > + Teleports the actor to a given transform (location and rotation). + # -------------------------------------- + - def_name: set_velocity + params: + - param_name: velocity + type: carla.Vector3D + doc: > + Sets the actor's velocity vector. # -------------------------------------- - class_name: VehicleLightState # - DESCRIPTION ------------------------ @@ -183,13 +152,13 @@ parent: carla.Actor # - DESCRIPTION ------------------------ doc: > - A vehicle actor. + One of the most important group of actors in CARLA. These include any type of vehicle from cars to trucks, motorbikes, vans, bycicles and also official vehicles such as police cars. A wide set of these actors is provided in carla.BlueprintLibrary to facilitate differente requirements. Vehicles can be either manually controlled or set to an autopilot mode that will be conducted client-side by the traffic manager. # - PROPERTIES ------------------------- instance_variables: - var_name: bounding_box type: carla.BoundingBox doc: > - The vehicle's bounding box + The vehicle's collider volume. # - METHODS ---------------------------- methods: - def_name: get_light_state @@ -213,71 +182,54 @@ - param_name: control type: carla.VehicleControl doc: > - Apply control to this vehicle. The control will take effect on next - tick. - # -------------------------------------- - - def_name: get_control - return: carla.VehicleControl - doc: > - Returns the control last applied to this vehicle. - note: > - This function does not call the simulator, it returns the data received - in the last tick. + Applies a control object on the next tick, containing driving parameters such as throttle, steering or gear shifting. # -------------------------------------- - def_name: apply_physics_control params: - param_name: physics_control type: carla.VehiclePhysicsControl doc: > - Apply physics control to this vehicle. The control will take effect on the - next tick. + 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: 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_physics_control return: carla.VehiclePhysicsControl doc: > - Returns the physics control last applied to this vehicle. + The simulator returns the last physics control applied to this vehicle. warning: This function does call the simulator to retrieve the value. # -------------------------------------- + - def_name: get_speed_limit + return: float + doc: > + The client returns the speed limit affecting this vehicle according to last tick (it does not call the simulator). The speed limit is updated when passing by a speed limit signal, so a vehicle might have none right after spawning. + # -------------------------------------- + - def_name: get_traffic_light + return: carla.TrafficLight + doc: > + Retrieves the traffic light actor affecting this vehicle (if any) according to last tick. The method does not call the simulator. + # -------------------------------------- + - def_name: get_traffic_light_state + return: carla.TrafficLightState + doc: > + 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 type: bool default: True doc: > - Switch on/off this vehicle's server-side autopilot. - # -------------------------------------- - - def_name: get_speed_limit - return: float - doc: > - Returns the speed limit currently affecting this vehicle. Note that the - speed limit is only updated when passing by a speed limit signal, right - after spawning a vehicle it might not reflect the actual speed limit of - the current road. - note: > - This function does not call the simulator, it returns the data received - in the last tick. - # -------------------------------------- - - def_name: get_traffic_light_state - return: carla.TrafficLightState - doc: > - Returns the state of the traffic light currently affecting this vehicle. - If no traffic light is currently affecting the vehicle, return Green. - note: > - This function does not call the simulator, it returns the data received - in the last tick. - # -------------------------------------- - - def_name: is_at_traffic_light - return: bool - doc: > - Returns whether a traffic light is affecting this vehicle. - note: > - This function does not call the simulator, it returns the data received - in the last tick. - # -------------------------------------- - - def_name: get_traffic_light - return: carla.TrafficLight - doc: > - Retrieve the traffic light actor currently affecting this vehicle. + 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: __str__ return: str @@ -287,13 +239,13 @@ parent: carla.Actor # - DESCRIPTION ------------------------ doc: > - A walking actor, pedestrian. + This class inherits from the carla.Actor and defines pedestrians in the simulation. Walkers are a special type of actor that can be controlled either by an AI (carla.WalkerAIController) or manually via script, using a series of carla.WalkerControl to move these and their skeletons. # - PROPERTIES ------------------------- instance_variables: - var_name: bounding_box type: carla.BoundingBox doc: > - The walker's bounding box. + The walker's collider defined by a bounding box. # - METHODS ---------------------------- methods: - def_name: apply_control @@ -301,26 +253,19 @@ - param_name: control type: carla.WalkerControl doc: > - Apply control to this walker. - note: > - The control will take effect on the next tick. + On the next tick, the control will move the walker in a certain direction with a certain speed. Jumps can be commanded too. # -------------------------------------- - def_name: apply_control params: - param_name: control type: carla.WalkerBoneControl doc: > - Apply bone control to this walker. - note: > - The control will take effect on the next tick. + On the next tick, the control defines a list of bone transformations that will be applied to the walker's skeleton. # -------------------------------------- - def_name: get_control return: carla.WalkerControl doc: > - Returns the control last applied to this walker. - note: > - This function does not call the simulator, it returns the data received - in the last tick. + The client returns the control applied to this walker during last tick. The method does not call the simulator. # -------------------------------------- - def_name: __str__ return: str @@ -330,16 +275,16 @@ parent: carla.Actor # - DESCRIPTION ------------------------ doc: > - Class used for controlling the automation of a pedestrian. + 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: start doc: > - Initializes walker controller. + Enables AI control for its parent walker. # -------------------------------------- - def_name: stop doc: > - Stops walker controller. + Disables AI control for its parent walker. # -------------------------------------- - def_name: go_to_location params: @@ -354,36 +299,34 @@ type: float default: 1.4 doc: > - Speed is in m/s. + speed in m/s. An easy walking speed is set by default. doc: > - Sets the speed of the pedestrian. + Sets a speed for the walker in meters per second. # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: TrafficSign parent: carla.Actor # - DESCRIPTION ------------------------ doc: > - A traffic sign actor. + Traffic signs appearing in the simulation except for traffic lights. These have their own class inherited from this in carla.TrafficLight. Right now, speed signs, stops and yields are mainly the ones implemented, but many others are borne in mind. # - PROPERTIES ------------------------- instance_variables: - var_name: trigger_volume doc: > - A carla.BoundingBox situated near a traffic sign where the - carla.Actor who is inside can know about its state. + A carla.BoundingBox situated near a traffic sign where the carla.Actor who is inside can know about it. # -------------------------------------- - class_name: TrafficLightState # - DESCRIPTION ------------------------ doc: > - All possible states for traffic lights. Check out this [`recipe`](../python_cookbook/#traffic-lights-recipe)! + 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](../python_cookbook/#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 # -------------------------------------- @@ -392,83 +335,17 @@ parent: carla.TrafficSign # - DESCRIPTION ------------------------ doc: > - A traffic light actor. Check out this [`recipe`](../python_cookbook/#traffic-lights-recipe)! + A traffic light actor, considered a specific type of traffic sign. As traffic lights will mostly appear at junctions, they belong to a group which contains the different traffic lights in it. Inside the group, traffic lights are differenciated by their pole index. + + Within a group the state of traffic lights is changed in a cyclic pattern: one index is chosen and it spends a few seconds in green, yellow and eventually red. The rest of the traffic lights remain frozen in red this whole time, meaning that there is a gap in the last seconds of the cycle where all the traffic lights are red. However, the state of a traffic light can be changed manually. Take a look at this [recipe](../python_cookbook/#traffic-lights-recipe) to learn how to do so. # - PROPERTIES ------------------------- instance_variables: - var_name: state type: carla.TrafficLightState doc: > - Current traffic light state. + Current state of the traffic light. # - METHODS ---------------------------- methods: - - def_name: set_state - params: - - param_name: state - type: carla.TrafficLightState - doc: > - Sets a given state to a traffic light actor. - # -------------------------------------- - - def_name: get_state - return: carla.TrafficLightState - doc: > - Returns the current state of the traffic light. - note: > - This function does not call the simulator, it returns the data - received in the last tick. - # -------------------------------------- - - def_name: set_green_time - params: - - param_name: green_time - type: float - doc: > - Sets a given time (in seconds) to the green state to be active. - # -------------------------------------- - - def_name: get_green_time - return: float - doc: > - Returns the current time set for the green light to be active. - note: > - This function does not call the simulator, it returns the data - received in the last tick. - # -------------------------------------- - - def_name: set_yellow_time - params: - - param_name: yellow_time - type: float - doc: > - Sets a given time (in seconds) to the yellow state to be active. - # -------------------------------------- - - def_name: get_yellow_time - return: float - doc: > - Returns the current time set for the yellow light to be active. - note: > - This function does not call the simulator, it returns the data - received in the last tick. - # -------------------------------------- - - def_name: set_red_time - params: - - param_name: red_time - type: float - doc: > - Sets a given time (in seconds) to the red state to be active. - # -------------------------------------- - - def_name: get_red_time - return: float - doc: > - Returns the current time set for the red light to be active. - note: > - This function does not call the simulator, it returns the data - received in the last tick. - # -------------------------------------- - - def_name: get_elapsed_time - return: float - doc: > - Returns the current countdown of the state of a traffic light. - note: > - This function does not call the simulator, it returns the data - received in the last tick. - # -------------------------------------- - def_name: freeze params: - param_name: freeze @@ -479,24 +356,73 @@ - def_name: is_frozen return: bool doc: > - Returns `True` if a traffic light is frozen. - note: > - This function does not call the simulator, it returns the data - received in the last tick. + 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 doc: > - Returns the index of the pole in the traffic light group. + Returns the index of the pole that identifies it as part of the traffic light group of a junction. # -------------------------------------- - def_name: get_group_traffic_lights return: list(carla.TrafficLight) doc: > - Returns all traffic lights in the group this one belongs to. + Returns all traffic lights in the group this one belongs to. note: > This function calls the simulator. # -------------------------------------- - - def_name: __str__ + - def_name: get_elapsed_time + return: float doc: > + 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_state + return: carla.TrafficLightState + doc: > + The client returns the state of the traffic light according to last tick. The method does not call the simulator. + # -------------------------------------- + - def_name: get_green_time + return: float + doc: > + The client returns the seconds set for the traffic light to be green according to last tick. The method does not call the simulator. + # -------------------------------------- + - def_name: get_red_time + return: float + doc: > + The client returns the seconds set for the traffic light to be red according to last tick. The method does not call the simulator. + # -------------------------------------- + - def_name: get_yellow_time + return: float + doc: > + The client returns the the seconds set for the traffic light to be yellow according to last tick. The method does not call the simulator. + # -------------------------------------- + - def_name: set_state + params: + - param_name: state + type: carla.TrafficLightState + doc: > + Sets a given state to a traffic light actor. + # -------------------------------------- + - def_name: set_green_time + params: + - param_name: green_time + type: float + doc: > + Sets a given time (in seconds) for the green light to be active. + # -------------------------------------- + - def_name: set_red_time + params: + - param_name: red_time + type: float + doc: > + Sets a given time (in seconds) for the red state to be active. + # -------------------------------------- + - def_name: set_yellow_time + params: + - param_name: yellow_time + type: float + doc: > + Sets a given time (in seconds) for the yellow light to be active. + # -------------------------------------- + - def_name: __str__ # -------------------------------------- ... diff --git a/PythonAPI/docs/blueprint.yml b/PythonAPI/docs/blueprint.yml index 40be531f1..1c371a5c7 100644 --- a/PythonAPI/docs/blueprint.yml +++ b/PythonAPI/docs/blueprint.yml @@ -6,42 +6,37 @@ - class_name: ActorAttributeType # - DESCRIPTION ------------------------ doc: > - Class that defines the type of attribute of a carla.ActorAttribute. + CARLA provides a library of blueprints for actors in carla.BlueprintLibrary with different attributes each. This class defines the types those at carla.ActorAttribute can be as a series of enum. All this information is managed internally and listed here for a better comprehension of how CARLA works. # - PROPERTIES ------------------------- instance_variables: - var_name: Bool - doc: > - var_name: Int - doc: > - var_name: Float - doc: > - - var_name: String - doc: > - var_name: RGBColor - doc: > + - var_name: String - class_name: Color # - DESCRIPTION ------------------------ doc: > - Class that defines a 32-bit BGRA color. + Class that defines a 32-bit RGBA color. # - PROPERTIES ------------------------- instance_variables: - var_name: r type: int doc: > - Red color (0-255) + Red color (0-255). - var_name: g type: int doc: > - Green color (0-255) + Green color (0-255). - var_name: b type: int doc: > - Blue color (0-255) + Blue color (0-255). - var_name: a type: int doc: > - Alpha channel (0-255) + Alpha channel (0-255). # - METHODS ---------------------------- methods: - def_name: __init__ @@ -49,124 +44,151 @@ - param_name: r type: int default: 0 - doc: > - param_name: g type: int default: 0 - doc: > - param_name: b type: int default: 0 - doc: > - param_name: a type: int default: 255 - doc: > doc: > - Client constructor + Initializes a color, black by default. # -------------------------------------- - def_name: __eq__ params: - param_name: other type: carla.Color - doc: > # -------------------------------------- - def_name: __ne__ params: - param_name: other type: carla.Color - doc: > # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: ActorAttribute # - DESCRIPTION ------------------------ doc: > - Class that defines an attribute of a carla.ActorBlueprint. + CARLA provides a library of blueprints for actors that can be accessed as carla.BlueprintLibrary. Each of these blueprints has a series of attributes defined internally. Some of these are modifiable, others are not. A list of recommended values is provided for those that can be set. # - PROPERTIES ------------------------- instance_variables: - var_name: id type: str doc: > - The attribute's identifier + The attribute's name and identifier in the library. - var_name: type type: carla.ActorAttributeType doc: > - The attribute parameter type + The attribute's parameter type. - var_name: recommended_values type: list(str) doc: > - List of recommended values that the attribute may have. + A list of values suggested by those who designed the blueprint. - var_name: is_modifiable type: bool doc: > - True if the attribute is modifiable. + It is True if the attribute's value can be modified. # - METHODS ---------------------------- methods: - def_name: as_bool doc: > - # -------------------------------------- - - def_name: as_int - doc: > - # -------------------------------------- - - def_name: as_float - doc: > - # -------------------------------------- - - def_name: as_str - doc: > + Reads the attribute as boolean value. # -------------------------------------- - def_name: as_color doc: > + Reads the attribute as carla.Color. # -------------------------------------- - - def_name: __eq__ - params: - - param_name: other - type: bool / int / float / str / carla.Color / carla.ActorAttribute + - def_name: as_int doc: > + Reads the attribute as int. # -------------------------------------- - - def_name: __ne__ - params: - - param_name: other - type: bool / int / float / str / carla.Color / carla.ActorAttribute + - def_name: as_float doc: > + Reads the attribute as float. # -------------------------------------- - - def_name: __nonzero__ + - 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: __str__ doc: > + Parses the attribute ID and its value to string. # -------------------------------------- - - def_name: __str__ + - def_name: __eq__ + return: bool + params: + - param_name: other + type: bool / int / float / str / carla.Color / carla.ActorAttribute doc: > + Returns true if this actor's attribute and `other` are the same. + # -------------------------------------- + - def_name: __ne__ + return: bool + params: + - param_name: other + type: bool / int / float / str / carla.Color / carla.ActorAttribute + doc: > + Returns true if this actor's attribute and `other` are different. + # -------------------------------------- + - def_name: __nonzero__ + return: bool + doc: > + Returns true if this actor's attribute is not zero or null. # -------------------------------------- - class_name: ActorBlueprint # - DESCRIPTION ------------------------ doc: > - Class that contains all the necessary information for spawning an Actor. + CARLA provides a blueprint library for actors that can be consulted through carla.BlueprintLibrary. Each of these consists of an identifier for the blueprint and a series of attributes that may be modifiable or not. This class is the intermediate step between the library and the actor creation. Actors need an actor blueprint to be spawned. These store the information for said blueprint in an object with its attributes and some tags to categorize them. The user can then customize some attributes and eventually spawn the actors through carla.World. # - PROPERTIES ------------------------- instance_variables: - var_name: id type: str doc: > - Actor blueprint identifier, e.g. `walker.pedestrian.0001`. + The identifier of said blueprint inside the library. E.g. `walker.pedestrian.0001`. - var_name: tags type: list(str) doc: > - List of tags of an actor blueprint e.g. `['0001', 'pedestrian', 'walker']` + 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: + - param_name: id + type: str + doc: > + e.g. `gender` would return **True** for pedestrians' blueprints. + doc: > + Returns True if the blueprint contains the attribute `id`. + # -------------------------------------- - def_name: has_tag return: bool params: @@ -175,7 +197,7 @@ doc: > e.g. 'walker' doc: > - Returns `true` if an actor blueprint has the tag. + Returns True if the blueprint has the specified `tag` listed. # -------------------------------------- - def_name: match_tags return: bool @@ -183,19 +205,7 @@ - param_name: wildcard_pattern type: str doc: > - Test if any of the flags or id matches wildcard_pattern. - note: > - The wildcard_pattern follows Unix shell-style wildcards. - # -------------------------------------- - - def_name: has_attribute - return: bool - params: - - param_name: id - type: str - doc: > - e.g 'gender' - doc: > - Returns `true` if the blueprint contains the specified attribute + Returns True if any of the tags listed for this blueprint matches `wildcard_pattern`. Matching follows [fnmatch](https://docs.python.org/2/library/fnmatch.html) standard. # -------------------------------------- - def_name: get_attribute return: carla.ActorAttribute @@ -203,7 +213,7 @@ - param_name: id type: str doc: > - Returns the current actor attribute through its id + Returns the actor's attribute with `id` as identifier if existing. Return: carla.ActorAttribute # -------------------------------------- - def_name: set_attribute @@ -211,64 +221,59 @@ - param_name: id type: str doc: > - # -------------------------------------- + The identifier for the attribute that is intended to be changed. - param_name: value type: str doc: > + The new value for said attribute. doc: > - Sets an existing attribute to the actor's blueprint - note: > - Attribute can only be set or changed if it is modifiable - # -------------------------------------- - - def_name: __len__ - doc: > - # -------------------------------------- - - def_name: __iter__ - doc: > - # -------------------------------------- - - def_name: __str__ - doc: > + If the `id` attribute is modifiable, changes its value to `value`. # -------------------------------------- - class_name: BlueprintLibrary # - DESCRIPTION ------------------------ doc: > - Class that provides access to [blueprints](../bp_library/). + A class that contains the blueprints provided for actor spawning. Its main application is to return carla.ActorBlueprint objects needed to spawn actors. Each blueprint has an identifier and attributes that may or may not be modifiable. The library is automatically created by the server and can be accessed through carla.World. + + [Here](../bp_library/) is a reference containing every available blueprint and its specifics. # - METHODS ---------------------------- methods: - - def_name: find - params: - - param_name: id - type: str - return: carla.ActorBlueprint - doc: > - Returns a carla.ActorBlueprint through its id - # -------------------------------------- - - def_name: filter - params: - - param_name: wildcard_pattern - type: str - doc: > - Filters a list of ActorBlueprint with id or tags matching wildcard_pattern. - The pattern is matched against each blueprint's id and tags. - note: > - The wildcard_pattern follows Unix shell-style wildcards (fnmatch). - return: carla.BlueprintLibrary - # -------------------------------------- - def_name: __getitem__ params: - param_name: pos type: int return: carla.ActorBlueprint doc: > - # -------------------------------------- - - def_name: __len__ - 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 + type: str + doc: > + 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. + return: carla.BlueprintLibrary + # -------------------------------------- + - def_name: find + params: + - param_name: id + type: str + return: carla.ActorBlueprint + doc: > + Returns the blueprint corresponding to that identifier. # -------------------------------------- ... diff --git a/PythonAPI/docs/bp_doc_gen.py b/PythonAPI/docs/bp_doc_gen.py old mode 100755 new mode 100644 diff --git a/PythonAPI/docs/client.yml b/PythonAPI/docs/client.yml index 0bf0d47bb..d2388b364 100644 --- a/PythonAPI/docs/client.yml +++ b/PythonAPI/docs/client.yml @@ -1,12 +1,15 @@ --- - module_name: carla doc: > + # - CLASSES ------------------------------ classes: - class_name: Client # - DESCRIPTION ------------------------ doc: > - Client used to connect to a Carla server + The Client connects CARLA to the server which runs the simulation. Both server and client contain a CARLA library (libcarla) with some differences that allow communication between them. Many clients can be created and each of these will connect to the RPC server inside the simulation to send commands. The simulation runs server-side. Once the connection is established, the client will only receive data retrieved from the simulation. Walkers are the exception. The client is in charge of managing pedestrians so, if you are running a simulation with multiple clients, some issues may arise. For example, if you spawn walkers through different clients, collisions may happen, as each client is only aware of the ones it is in charge of. + + The client also has a recording feature that saves all the information of a simulation while running it. This allows the server to replay it at will to obtain information and experiment with it. [Here](recorder_and_playback.md) is some information about how to use this recorder. # - PROPERTIES ------------------------- instance_variables: # - METHODS ---------------------------- @@ -15,12 +18,14 @@ params: - param_name: host type: str + default: '127.0.0.1' doc: > - IP address where a CARLA Simulator instance is running + IP address where a CARLA Simulator instance is running. Default is localhost (127.0.0.1). - param_name: port type: int + default: 2000 doc: > - TCP port where the CARLA Simulator instance is running + TCP port where the CARLA Simulator instance is running. Default are 2000 and the subsequent 2001. - param_name: worker_threads type: int default: 0 @@ -30,120 +35,128 @@ doc: > Client constructor # -------------------------------------- - - def_name: set_timeout + - def_name: apply_batch params: - - param_name: seconds - type: float + - param_name: commands + type: list doc: > - New timeout value in seconds + 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) doc: > - Set the timeout in seconds allowed to block when doing networking calls + 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. # -------------------------------------- - - def_name: get_client_version + - def_name: apply_batch_sync params: - return: str + - param_name: commands + type: list + doc: > + A list of commands to execute in batch. The commands available are listed right above, in the function **apply_batch()**. + - param_name: due_tick_cue + type: bool + doc: > + A boolean parameter to specify whether or not to perform a carla.World.tick after applying the batch in _synchronous mode_. + return: list(command.Response) doc: > - Get the client version as a string - # -------------------------------------- - - def_name: get_server_version - params: - return: str - doc: > - Get the server version as a string - # -------------------------------------- - - def_name: get_world - params: - return: carla.World - doc: > - Get the world currently active in the simulation + 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 params: return: list(str) doc: > - Get a list of strings of the maps available on server. The result can be something like: - '/Game/Carla/Maps/Town01' - '/Game/Carla/Maps/Town02' - '/Game/Carla/Maps/Town03' - '/Game/Carla/Maps/Town04' - '/Game/Carla/Maps/Town05' - '/Game/Carla/Maps/Town06' - '/Game/Carla/Maps/Town07' + 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: reload_world + - def_name: get_client_version params: - raises: RuntimeError + return: str doc: > - 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. + 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. # -------------------------------------- - def_name: load_world params: - param_name: map_name type: str doc: > - Name of the map to load, accepts both full paths and map names, e.g. - '/Game/Carla/Maps/Town01' or 'Town01'. + 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. doc: > - Load a new world with default settings using `map_name` map. All actors - present in the current world will be destroyed. + Creates a new world with default settings using `map_name` map. All actors in the current world will be destroyed. # -------------------------------------- - - def_name: start_recorder + - def_name: reload_world params: - - param_name: filename + raises: RuntimeError when corresponding. + doc: > + Deletes the current world and creates a new one using the same map and default settings. Every actor in the previous world will be + destroyed. + # -------------------------------------- + - def_name: replay_file + params: + - param_name: name type: str doc: > - Name of the file to write the recorded data + Name of the file containing the information of the simulation. + - param_name: start + type: float + doc: > + 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. + - param_name: duration + type: float + doc: > + Time in seconds that will be reenacted using the information `name` file. If the end is reached, the simulation will continue. + - param_name: follow_id + type: int + doc: > + ID of the actor to follow. If this is 0 then camera is disabled. doc: > - If we use a simple name like 'recording.log' then it will be saved at server folder 'CarlaUE4/Saved/recording.log'. - If we use some folder in the name, then it will be considered to be an absolute path, like '/home/carla/recording.log'. + The server will start running the simulation `name` previously recorded. The time to start and stop can be stated and if the recreation finishes, the vehicles will continue their behaviour as usual, managed by the server. During the simulation we can follow a specific actor using its ID. # -------------------------------------- - - def_name: stop_recorder + - 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: > - Stops the recording in progress. + 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: show_recorder_file_info + - def_name: set_timeout params: - - param_name: filename - type: str + - param_name: seconds + type: float doc: > - Name of the recorded file to load - - param_name: show_all - type: bool - doc: > - Show all detailed info, or just a summary + New timeout value in seconds. Default is 5 seconds. doc: > - Will show info about the recorded file (frames, times, events, state, positions...) - We have the option to show all the details per frame, that includes all the traffic light states, position of all actors, and animations data. - # -------------------------------------- - - def_name: show_recorder_collisions - params: - - param_name: filename - type: str - doc: > - Name of the recorded file to load - - param_name: category1 - type: single char - doc: > - Character specifying the category of the first actor - - param_name: category2 - type: single char - doc: > - Character specifying the category of the second actor - doc: > - This will show which collisions were recorded in the file. We can use a filter for the collisions we want, using two categories. - The categories can be: - 'h' = Hero - 'v' = Vehicle - 'w' = Walker - 't' = Traffic light - 'o' = Other - 'a' = Any - So, if you want to see only collisions about a vehicle and a walker, we would use for category1 'v' and category2 'w'. - Or if you want all the collisions (filter off) you can use 'a' as both categories. - # -------------------------------------- + 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 @@ -153,87 +166,66 @@ - param_name: min_time type: float doc: > - How many seconds has to be stoped an actor to be considered as blocked + Minimum time in seconds the actor has to move a minimum distance before being considered blocked. Default is 60 seconds. - param_name: min_distance type: float doc: > - How many centimeters needs to move the actor in order to be considered as moving, and not blocked + Minimum distance in centimeters the actor has to move to not be considered blocked. Default is 100 centimeters. doc: > - Shows which actors seem blocked by some reason. - The idea is to calculate which actors are not moving as much as 'min_distance' for a period of 'min_time'. - By default min_time = 60 seconds (1 min) and min_distance = 100 centimeters (1 m). - # -------------------------------------- - - def_name: replay_file + 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`. + # -------------------------------------- + - def_name: show_recorder_collisions params: - - param_name: name + - param_name: filename type: str doc: > - Name of the file. - - param_name: start - type: float + Name or absolute path of the file recorded, depending on your previous choice. + - param_name: category1 + type: single char doc: > - Time in seconds where to start the playback. If it is negative, then it starts from the end. - - param_name: duration - type: float - doc: > - Id of the actor to follow. If this is 0 then camera is disabled - - param_name: follow_id - type: int + Character variable specifying a first type of actor involved in the collision. + - param_name: category2 + type: single char doc: > + Character variable specifying the second type of actor involved in the collision. doc: > - Playback a file + The terminal will show the collisions registered by the recorder. These can be filtered by specifying the type of actor involved. + The categories will be specified in `category1` and `category2` as follows: + 'h' = Hero, the one vehicle that can be controlled manually or managed by the user. + 'v' = Vehicle + 'w' = Walker + 't' = Traffic light + 'o' = Other + 'a' = Any + If you want to see only collisions between a vehicles and a walkers, use for `category1` as 'v' and `category2` as 'w' or vice versa. + If you want to see all the collisions (filter off) you can use 'a' for both parameters. # -------------------------------------- - - def_name: set_replayer_time_factor + - def_name: show_recorder_file_info params: - - param_name: time_factor - type: float - doc: > - A value of 1.0 means normal time factor. - A value < 1.0 means slow motion (for example 0.5 is half speed) - A value > 1.0 means fast motion (for example 2.0 is double speed) - doc: > - Apply a different playback speed to current playback. Can be used several times while a playback is in curse. - # -------------------------------------- - - def_name: apply_batch - params: - - param_name: commands - type: list - doc: > - A list of commands to execute in batch. Each command has a different number of parameters. - Currently, we can use these [commands](#command.ApplyAngularVelocity): - SpawnActor - DestroyActor - ApplyVehicleControl - ApplyWalkerControl - ApplyTransform - ApplyVelocity - AplyAngularVelocity - ApplyImpulse - SetSimulatePhysics - SetAutopilot - doc: > - This function executes the whole list of commands on a single simulation step. - For example, to set autopilot on some actors, we could use: - [sample_code](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L126). - We don't have control about the response of each command. If we need that, we can use `apply_batch_sync()`. - - # -------------------------------------- - - def_name: apply_batch_sync - params: - - param_name: commands - type: list - doc: > - A list of commands to execute in batch. For a list of commands available see function above apply_batch(). - - param_name: due_tick_cue + - param_name: filename + type: str + doc: > + Name or absolute path of the file recorded, depending on your previous choice. + - param_name: show_all type: bool + default: false doc: > - A boolean parameter to specify whether or not to perform a carla.World.tick after applying the batch in _synchronous mode_. - return: list + When true, will show all the details per frame (traffic light states, positions of all actors, orientation and animation data...), but by default it will only show a summary. doc: > - This function executes the whole list of commands on a single simulation - step, blocks until the commands are executed, and returns a list of - [`command.Response`](#command.Response) that can be used to determine whether a single - command succeeded or not. - [sample_code](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L112-L116) + The information saved by the recorder will be parsed and shown in your terminal as text (frames, times, events, state, positions...). The information shown can be specified by using the `show_all` parameter. [Here](recorder_binary_file_format.md) is some more information about how to read the recorder file. + # -------------------------------------- + - def_name: start_recorder + params: + - param_name: filename + type: str + doc: > + 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. + doc: > + Enables the recording feature, which will start saving every information possible needed by the server to replay the simulation. + # -------------------------------------- + - def_name: stop_recorder + params: + doc: > + Stops the recording in progress. If you specified a path in `filename`, the recording will be there. If not, look inside `CarlaUE4/Saved/`. # -------------------------------------- ... diff --git a/PythonAPI/docs/commands.yml b/PythonAPI/docs/commands.yml index 8ad6af763..0441f3869 100644 --- a/PythonAPI/docs/commands.yml +++ b/PythonAPI/docs/commands.yml @@ -5,43 +5,44 @@ - class_name: Response # - DESCRIPTION ------------------------ doc: > - Execution result of a command, contains either an error string or an - actor ID, depending on whether or not the command succeeded. See carla.Client.apply_batch_sync + States the result of executing a command as either the ID of the actor to whom the command was applied to (when succeeded) or an error string (when failed). + actor ID, depending on whether or not the command succeeded. The method **apply_batch_sync()** in carla.Client returns a list of these to summarize the execution of a batch. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id type: int doc: > - Actor affected by the command + Actor to whom the command was applied to. States that the command was successful. - var_name: error type: str doc: > + A string stating the command has failed. # - METHODS ---------------------------- methods: - def_name: has_error + return: bool params: doc: > + Returns True if the command represents a successful execution and False if not. # -------------------------------------- - class_name: SpawnActor # - DESCRIPTION ------------------------ doc: > - Spawn an actor into the world based on the blueprint provided and the transform. - If a parent is provided, the actor is attached to parent. + Command adaptation of **spawn_actor()** in carla.World. Spawns an actor into the world based on the blueprint provided and the transform. If a parent is provided, the actor is attached to it. # - PROPERTIES ------------------------- instance_variables: - var_name: transform type: carla.Transform doc: > - Transform to be applied + Transform to be applied. - var_name: parent_id type: int doc: > - Parent's actor id + Identificator of the parent actor. # - METHODS ---------------------------- methods: - def_name: __init__ - doc: > # -------------------------------------- - def_name: __init__ params: @@ -49,7 +50,6 @@ type: carla.ActorBlueprint - param_name: transform type: carla.Transform - doc: > # -------------------------------------- - def_name: __init__ params: @@ -59,7 +59,6 @@ type: carla.Transform - param_name: parent type: carla.Actor or int - doc: > # -------------------------------------- - def_name: then params: @@ -68,15 +67,13 @@ doc: > CommandType. doc: > - Link another command to be executed right after. + Links another command to be executed right after. It allows to ease very common flows such as spawning a set of vehicles by command and then using this method to set them to autopilot automatically. # -------------------------------------- - class_name: DestroyActor # - DESCRIPTION ------------------------ doc: > - Tell the simulator to destroy this Actor, and return whether the actor was - successfully destroyed. It has no effect if the Actor was already - successfully destroyed. + Command adaptation of **destroy()** in carla.Actor that tells the simulator to destroy this actor. It has no effect if the actor was already destroyed. When executed with **apply_batch_synch()** in carla.Client there will be a command.Response that will return a boolean stating whether the actor was successfully destroyed. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id @@ -89,120 +86,124 @@ params: - param_name: actor type: carla.Actor or int - doc: > + doc: > + Actor or its ID to whom the command will be applied to. # -------------------------------------- - class_name: ApplyVehicleControl # - DESCRIPTION ------------------------ doc: > - Apply control to the vehicle. + Command adaptation of **apply_control()** in carla.Vehicle. Applies a certain control to a vehicle. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id type: int doc: > - Vehicle actor affected by the command + Vehicle actor affected by the command. - var_name: control type: carla.VehicleControl doc: > - Vehicle control to be applied + Vehicle control to be applied. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: actor type: carla.Actor or int + doc: > + Actor or its ID to whom the command will be applied to. - param_name: control type: carla.VehicleControl - doc: > # -------------------------------------- - class_name: ApplyWalkerControl # - DESCRIPTION ------------------------ doc: > - Apply control to the walker + Command adaptation of **apply_control()** in carla.Walker. Applies a control to a walker. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id type: int doc: > - Walker actor affected by the command + Walker actor affected by the command. - var_name: control - type: carla.VehicleControl + type: carla.WalkerControl doc: > - Walker control to be applied + Walker control to be applied. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: actor type: carla.Actor or int + doc: > + Actor or its ID to whom the command will be applied to. - param_name: control type: carla.WalkerControl - doc: > # -------------------------------------- - class_name: ApplyTransform # - DESCRIPTION ------------------------ doc: > - Sets a new transform to the actor. + Command adaptation of **set_transform()** in carla.Actor. Sets a new transform to an actor. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id type: int doc: > - Actor affected by the command + Actor affected by the command. - var_name: transform type: carla.Transform doc: > - Transformation to be applied + Transformation to be applied. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: actor type: carla.Actor or int + doc: > + Actor or its ID to whom the command will be applied to. - param_name: transform type: carla.Transform - doc: > # -------------------------------------- - class_name: ApplyWalkerState # - DESCRIPTION ------------------------ doc: > - Apply a state to the walker actor + Apply a state to the walker actor. Specially useful to initialize an actor them with a specific location, orientation and speed. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id type: int doc: > - Walker actor affected by the command + Walker actor affected by the command. - var_name: transform type: carla.Transform doc: > - Transform to be applied + Transform to be applied. - var_name: speed type: float doc: > - Speed to be applied + Speed to be applied. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: actor type: carla.Actor or int + doc: > + Actor or its ID to whom the command will be applied to. - param_name: transform type: carla.Transform - doc: > - param_name: speed type: float - doc: > # -------------------------------------- - class_name: ApplyVelocity # - DESCRIPTION ------------------------ doc: > - Sets actor's velocity + Command adaptation of **set_velocity()** in carla.Actor. Sets an actor's velocity. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id @@ -212,97 +213,101 @@ - var_name: velocity type: carla.Vector3D doc: > - The 3D velocity applied to the actor + The 3D velocity applied to the actor. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: actor type: carla.Actor or int + doc: > + Actor or its ID to whom the command will be applied to. - param_name: velocity type: carla.Vector3D - doc: > # -------------------------------------- - class_name: ApplyAngularVelocity # - DESCRIPTION ------------------------ doc: > - Set the actor's angular velocity + Command adaptation of **set_angular_velocity()** in carla.Actor. Sets an actor's angular velocity. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id type: int doc: > - Actor affected by the command + Actor affected by the command. - var_name: angular_velocity type: carla.Vector3D doc: > - The 3D angular velocity that will be applied to the actor + The 3D angular velocity that will be applied to the actor. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: actor type: carla.Actor or int + doc: > + Actor or its ID to whom the command will be applied to. - param_name: angular_velocity type: carla.Vector3D - doc: > # -------------------------------------- - class_name: ApplyImpulse # - DESCRIPTION ------------------------ doc: > - Adds impulse to the actor + Command adaptation of **add_impulse()** in carla.Actor. Adds impulse to an actor. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id type: int doc: > - Actor affected by the command + Actor affected by the command. - var_name: impulse type: carla.Vector3D doc: > - Impulse applied to the actor + Impulse applied to the actor. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: actor type: carla.Actor or int + doc: > + Actor or its ID to whom the command will be applied to. - param_name: impulse type: carla.Vector3D - doc: > # -------------------------------------- - class_name: SetSimulatePhysics # - DESCRIPTION ------------------------ doc: > - Whether an actor will be affected by physics or not. + Command adaptation of **set_simulate_physics()** in carla.Actor. Determines whether an actor will be affected by physics or not. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id type: int doc: > - Actor affected by the command + Actor affected by the command. - var_name: enabled type: bool doc: > - If physics will affect the actor + If physics should be activated or not. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: actor type: carla.Actor or int + doc: > + Actor or its ID to whom the command will be applied to. - param_name: enabled type: bool - doc: > # -------------------------------------- - class_name: SetAutopilot # - DESCRIPTION ------------------------ doc: > - Switch on/off vehicle's server-side autopilot + Command adaptation of **set_autopilot()** in carla.Vehicle. Turns on/off the vehicle's server-side autopilot. # - PROPERTIES ------------------------- instance_variables: - var_name: actor_id @@ -312,15 +317,16 @@ - var_name: enabled type: bool doc: > - If the autopilot is enabled or not. + If autopilot should be activated or not. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: actor type: carla.Actor or int + doc: > + Actor or its ID to whom the command will be applied to. - param_name: enabled type: bool - doc: > # -------------------------------------- ... diff --git a/PythonAPI/docs/control.yml b/PythonAPI/docs/control.yml index 61bb7a1a4..39255efb8 100644 --- a/PythonAPI/docs/control.yml +++ b/PythonAPI/docs/control.yml @@ -6,43 +6,43 @@ - class_name: VehicleControl # - DESCRIPTION ------------------------ doc: > - VehicleControl is used for controlling the basic movement of a vehicle. + Manages the basic movement of a vehicle using typical driving controls. # - PROPERTIES ------------------------- instance_variables: - var_name: throttle type: float doc: > - A scalar value to control the vehicle throttle [0.0, 1.0]. + A scalar value to control the vehicle throttle [0.0, 1.0]. Default is 0.0. # -------------------------------------- - var_name: steer type: float doc: > - A scalar value to control the vehicle steering [-1.0, 1.0]. + A scalar value to control the vehicle steering [-1.0, 1.0]. Default is 0.0. # -------------------------------------- - var_name: brake type: float doc: > - A scalar value to control the vehicle brake [0.0, 1.0]. + A scalar value to control the vehicle brake [0.0, 1.0]. Default is 0.0. # -------------------------------------- - var_name: hand_brake type: bool doc: > - If true, hand brake will be used. + Determines whether hand brake will be used. Default is False. # -------------------------------------- - var_name: reverse type: bool doc: > - If true, the vehicle will move reverse. + Determines whether the vehicle will move backwards. Default is False. # -------------------------------------- - var_name: manual_gear_shift type: bool doc: > - If true, the vehicle will be controlled by changing gears manually. + Determines whether the vehicle will be controlled by changing gears manually. Default is False. # -------------------------------------- - var_name: gear type: int doc: > - Controls the gear value of the vehicle. + States which gear is the vehicle running on. # - METHODS ---------------------------- methods: @@ -69,8 +69,6 @@ - param_name: gear type: int default: 0 - doc: > - VehicleControl constructor # -------------------------------------- - def_name: __eq__ params: @@ -80,32 +78,32 @@ params: - param_name: other type: carla.VehicleControl - doc: > # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: WalkerControl doc: > - WalkerControl is used for controlling the basic movement of a walker. + This class defines specific directions that can be commanded to a carla.Walker to control it via script. The walker's animations will blend automatically with the parameters defined in this class when applied, though specific skeleton moves can be obtained through class.WalkerBoneControl. + + AI control can be settled for walkers, but the control used to do so is carla.WalkerAIController. # - PROPERTIES ------------------------- instance_variables: - var_name: direction type: carla.Vector3D doc: > - Vector that controls the direction of the walker. + Vector using global coordinates that will correspond to the direction of the walker. # -------------------------------------- - var_name: speed type: float doc: > - A scalar value to control the walker speed. + A scalar value to control the walker's speed. # -------------------------------------- - var_name: jump type: bool doc: > - If true, the walker will perform a jump. + If True, the walker will perform a jump. # - METHODS ---------------------------- methods: @@ -120,35 +118,34 @@ - param_name: jump default: False type: bool - doc: > - WalkerControl constructor # -------------------------------------- - def_name: __eq__ params: - param_name: other type: carla.WalkerControl + doc: > + Compares every variable with `other` and returns True if these are all the same. # -------------------------------------- - def_name: __ne__ params: - param_name: other type: carla.WalkerControl + doc: > + Compares every variable with `other` and returns True if any of these differ. # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: WalkerBoneControl # - DESCRIPTION ------------------------ doc: > - Class used for controlling the skeleton of a walker. - See [walker bone control](walker_bone_control.md) + This class grants bone specific manipulation for walker. The skeletons of walkers have been unified for clarity and the transform applied to each bone are always relative to its parent. Take a look [here](walker_bone_control.md) to learn more on how to create a walker and define its movement. # - PROPERTIES ------------------------- instance_variables: - var_name: bone_transforms type: list([name,transform]) doc: > - List of pairs where the first value is the bone name - and the second value is the bone transform. + List of tuples where the first value is the bone's name and the second value stores the transformation (changes in location and rotation) that will be applied to it. # - METHODS ---------------------------- methods: - def_name: __init__ @@ -156,15 +153,15 @@ - param_name: 'list(name,transform)' type: tuple doc: > + 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. # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: GearPhysicsControl # - DESCRIPTION ------------------------ doc: > - Class that provides access to vehicle transmission details. + Class that provides access to vehicle transmission details by defining a gear and when to run on it. This will be later used by carla.VehiclePhysicsControl to help simulate physics. # - PROPERTIES ------------------------- instance_variables: - var_name: ratio @@ -175,12 +172,12 @@ - var_name: down_ratio type: float doc: > - The level of RPM (in relation to MaxRPM) where the gear autobox initiates shifting down. + Quotient between current RPM and MaxRPM where the autonomous gear box should shift down. # -------------------------------------- - var_name: up_ratio type: float doc: > - The level of RPM (in relation to MaxRPM) where the gear autobox initiates shifting up. + Quotient between current RPM and MaxRPM where the autonomous gear box should shift up. # - METHODS ---------------------------- methods: - def_name: __init__ @@ -194,27 +191,23 @@ - param_name: up_ratio type: float default: 0.65 - doc: > # -------------------------------------- - def_name: __eq__ params: - param_name: other type: carla.GearPhysicsControl - doc: > # -------------------------------------- - def_name: __ne__ params: - param_name: other type: carla.GearPhysicsControl - doc: > # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: VehiclePhysicsControl doc: > - VehiclePhysicsControl is used for controlling the physics parameters of a vehicle. + Summarizes the parameters that will be used to simulate a carla.Vehicle as a physical object. The specific settings for the wheels though are stipulated using carla.WheelPhysicsControl. # - PROPERTIES ------------------------- instance_variables: @@ -236,22 +229,22 @@ - var_name: damping_rate_full_throttle type: float doc: > - Damping rate when the throttle is maximum. + Damping ratio when the throttle is maximum. # -------------------------------------- - var_name: damping_rate_zero_throttle_clutch_engaged type: float doc: > - Damping rate when the throttle is zero with clutch engaged. + Damping ratio when the throttle is zero with clutch engaged. # -------------------------------------- - var_name: damping_rate_zero_throttle_clutch_disengaged type: float doc: > - Damping rate when the throttle is zero with clutch disengaged. + Damping ratio when the throttle is zero with clutch disengaged. # -------------------------------------- - var_name: use_gear_autobox type: bool doc: > - If true, the vehicle will have an automatic transmission. + If True, the vehicle will have an automatic transmission. # -------------------------------------- - var_name: gear_switch_time type: float @@ -261,7 +254,7 @@ - var_name: clutch_strength type: float doc: > - The clutch strength of the vehicle. Measured in Kgm^2/s. + The clutch strength of the vehicle in Kgm^2/s. # -------------------------------------- - var_name: final_ratio type: float @@ -271,12 +264,12 @@ - var_name: forward_gears type: list(carla.GearPhysicsControl) doc: > - List of GearPhysicsControl objects. + List of objects defining the vehicle's gears. # -------------------------------------- - var_name: mass type: float doc: > - The mass of the vehicle measured in Kg. + The mass of the vehicle in Kg. # -------------------------------------- - var_name: drag_coefficient type: float @@ -296,7 +289,7 @@ - var_name: wheels type: list(carla.WheelPhysicsControl) doc: > - List of carla.WheelPhysicsControl objects. This list should have 4 elements, where index 0 corresponds to the front left wheel, index 1 corresponds to the front right wheel, index 2 corresponds to the back left wheel and index 3 corresponds to the back right wheel. For 2 wheeled vehicles, set the same values for both front and back wheels. + List of wheel physics objects. This list should have 4 elements, where index 0 corresponds to the front left wheel, index 1 corresponds to the front right wheel, index 2 corresponds to the back left wheel and index 3 corresponds to the back right wheel. For 2 wheeled vehicles, set the same values for both front and back wheels. # - METHODS ---------------------------- methods: @@ -363,12 +356,11 @@ type: carla.VehiclePhysicsControl # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: WheelPhysicsControl doc: > - WheelPhysicsControl is used for controlling the physics parameters of a vehicle's wheel. + Class that defines specific physical parameters for wheel objects that will be part of a carla.VehiclePhysicsControl to simulate vehicle it as a material object. # - PROPERTIES ------------------------- instance_variables: - var_name: tire_friction @@ -379,32 +371,32 @@ - var_name: damping_rate type: float doc: > - The damping rate of the wheel. + Damping rate of the wheel. # -------------------------------------- - var_name: max_steer_angle type: float doc: > - The maximum angle in degrees that the wheel can steer. + Maximum angle in degrees that the wheel can steer. # -------------------------------------- - var_name: radius type: float doc: > - The radius of the wheel in centimeters. + Radius of the wheel in centimeters. # -------------------------------------- - var_name: max_brake_torque type: float doc: > - The maximum brake torque in Nm. + Maximum brake torque in Nm. # -------------------------------------- - var_name: max_handbrake_torque type: float doc: > - The maximum handbrake torque in Nm. + Maximum handbrake torque in Nm. # -------------------------------------- - var_name: position type: carla.Vector3D doc: > - World position of the wheel. Note that it is a read-only parameter. + World position of the wheel. This is a read-only parameter. # - METHODS ---------------------------- methods: - def_name: __init__ @@ -430,8 +422,6 @@ - param_name: position default: (0.0,0.0,0.0) type: carla.Vector3D - doc: > - WheelPhysicsControl constructor # -------------------------------------- - def_name: __eq__ params: @@ -444,6 +434,5 @@ type: carla.WheelPhysicsControl # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- ... diff --git a/PythonAPI/docs/geom.yml b/PythonAPI/docs/geom.yml index 5333732ed..5b8d08845 100644 --- a/PythonAPI/docs/geom.yml +++ b/PythonAPI/docs/geom.yml @@ -1,17 +1,20 @@ --- - module_name: carla - doc: > classes: - class_name: Vector2D # - DESCRIPTION ------------------------ doc: > - Vector 2D helper class + Helper class to perform 2D operations. # - PROPERTIES ------------------------- instance_variables: - var_name: x type: float + doc: > + X-axis value. - var_name: 'y' type: float + doc: > + Y-axis value. # - METHODS ---------------------------- methods: - def_name: __init__ @@ -22,54 +25,75 @@ - param_name: y type: float default: 0.0 - doc: > # -------------------------------------- - def_name: __add__ params: - param_name: other type: carla.Vector2D - # -------------------------------------- - - def_name: __mul__ - 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 params: - param_name: other type: carla.Vector2D + doc: > + Returns true if values for every axis are equal. # -------------------------------------- - def_name: __ne__ + return: bool params: - - param_name: other + - param_name: bool type: carla.Vector2D - # -------------------------------------- - - def_name: __self__ doc: > + Returns true if the value for any axis is different. + # -------------------------------------- + - def_name: __str__ + return: str + doc: > + Returns the axis values for the vector parsed as string. # -------------------------------------- - class_name: Vector3D # - DESCRIPTION ------------------------ doc: > - Vector 3D helper class + Helper class to perform 3D operations. # - PROPERTIES ------------------------- instance_variables: - var_name: x type: float + doc: > + X-axis value. - var_name: 'y' type: float + doc: > + Y-axis value. - var_name: z type: float + doc: > + Z-axis value. # - METHODS ---------------------------- methods: - def_name: __init__ @@ -88,49 +112,71 @@ params: - param_name: other type: carla.Vector3D - # -------------------------------------- - - def_name: __mul__ - 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: - param_name: other type: carla.Vector3D + return: bool + doc: > + Returns true if values for every axis are equal. # -------------------------------------- - def_name: __ne__ params: - param_name: other type: carla.Vector3D + return: bool + doc: > + Returns true if the value for any axis is different. # -------------------------------------- - def_name: __str__ + return: str doc: > + Returns the axis values for the vector parsed as string. # -------------------------------------- - class_name: Location parent: carla.Vector3D # - DESCRIPTION ------------------------ doc: > - Represents a location in the world (in meters). + Represents a spot in the world. # - PROPERTIES ------------------------- instance_variables: - var_name: x type: float + doc: > + Distance in meters from origin to spot on X axis. - var_name: 'y' type: float + doc: > + Distance in meters from origin to spot on Y axis. - var_name: z type: float + doc: > + Distance in meters from origin to spot on Z axis. # - METHODS ---------------------------- methods: - def_name: __init__ @@ -144,36 +190,47 @@ - param_name: z 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 type: carla.Location doc: > - The Location from where to compute the distance + The other point to compute the distance with. return: float doc: > - Computes the Euclidean distance in meters from this location to another one - # -------------------------------------- - - def_name: __eq__ - params: - - param_name: other - type: carla.Location - # -------------------------------------- - - def_name: __ne__ - params: - - param_name: other - type: carla.Location - # -------------------------------------- - - def_name: __str__ - doc: > + Returns Euclidean distance in meters from this location to another one. # -------------------------------------- - class_name: Rotation # - DESCRIPTION ------------------------ doc: > - Class that represents a 3D rotation. All rotation angles are stored in degrees. + Class that represents a 3D rotation and therefore, an orientation in space. ![UE4_Rotation](https://d26ilriwvtzlb.cloudfront.net/8/83/BRMC_9.jpg) @@ -183,15 +240,15 @@ - var_name: pitch type: float doc: > - Rotation about Y-axis. + Degrees around the Y-axis. - var_name: yaw type: float doc: > - Rotation about Z-axis. + Degrees around the Z-axis. - var_name: roll type: float doc: > - Rotation about X-axis. + Degrees around the X-axis. # - METHODS ---------------------------- methods: - def_name: __init__ @@ -199,46 +256,64 @@ - param_name: pitch type: float default: 0.0 + doc: > + Y rotation in degrees. - param_name: yaw type: float default: 0.0 + doc: > + Z rotation in degrees. - param_name: roll type: float default: 0.0 - doc: > + doc: > + X rotation in degrees. # -------------------------------------- - def_name: get_forward_vector params: return: carla.Vector3D doc: > - Computes a forward vector using the current rotation + Computes the vector pointing forward according to the orientation of each axis. # -------------------------------------- - def_name: __eq__ + return: bool 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. # -------------------------------------- - 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. + # -------------------------------------- - def_name: __str__ doc: > + Parses the axis' orientations to string. # -------------------------------------- - class_name: Transform # - DESCRIPTION ------------------------ doc: > - Class that defines a transformation without scaling. + Class that defines a transformation, a combination of location and rotation, without scaling. # - PROPERTIES ------------------------- instance_variables: - var_name: location type: carla.Location + doc: > + Describes a point in the coordinate system. - var_name: rotation type: carla.Rotation + doc: > + Describes a rotation for an object according to Unreal Engine's axis system. # - METHODS ---------------------------- methods: - def_name: __init__ @@ -247,42 +322,47 @@ type: carla.Location - 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 type: carla.Location doc: > - Location in the space to which the transformation will be applied - doc: > - Transform a 3D point using the current transformation - # -------------------------------------- - - def_name: get_forward_vector - return: carla.Vector3D - doc: > - Computes a forward vector using the rotation of the current transformation - # -------------------------------------- - - def_name: __eq__ - params: - - param_name: other - type: carla.Transform - doc: > - # -------------------------------------- - - def_name: __ne__ - params: - - param_name: other - type: carla.Transform - doc: > - # -------------------------------------- - - def_name: __str__ + Location in the space to which the transformation will be applied. doc: > + Translates a 3D point from global to local coordinates using the current transformation as frame of reference. # -------------------------------------- - class_name: BoundingBox # - DESCRIPTION ------------------------ doc: > - Bounding box helper class. + 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](../python_cookbook/#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 @@ -292,18 +372,21 @@ - var_name: extent type: carla.Vector3D doc: > - It contains the vector from the center of the bounding box to one of the vertex of the box. - - So, if you want to know the _X bounding box size_, you can just do `extent.x * 2` + 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. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: location type: carla.Location + doc: > + Point to center the box. - param_name: extent type: carla.Vector3D - doc: > + doc: > + Vector containing half the size of the box for every axis. # -------------------------------------- - def_name: contains return: bool @@ -335,25 +418,31 @@ Returns a list containing the locations of this object's vertices in world space. # -------------------------------------- - def_name: __eq__ + return: bool params: - param_name: other type: carla.BoundingBox doc: > + Returns true if both location and extent are equal for this and `other`. # -------------------------------------- - def_name: __ne__ + return: bool params: - param_name: other type: carla.BoundingBox doc: > + Returns true if either location or extent are different for this and `other`. # -------------------------------------- - def_name: __str__ + return: str doc: > + Parses the location and extent of the bounding box to string. # -------------------------------------- - class_name: GeoLocation # - DESCRIPTION ------------------------ doc: > - Class that contains geolocation simulated data + Class that contains geographical coordinates simulated data. The carla.Map can convert simulation locations by using the tag in the OpenDRIVE file. # - PROPERTIES ------------------------- instance_variables: - var_name: latitude diff --git a/PythonAPI/docs/map.yml b/PythonAPI/docs/map.yml index 13c977e64..35f5bd075 100644 --- a/PythonAPI/docs/map.yml +++ b/PythonAPI/docs/map.yml @@ -6,14 +6,11 @@ - class_name: LaneType # - DESCRIPTION ------------------------ doc: > - Class that defines the possible lane types accepted by OpenDRIVE 1.4. This standards define the road information. For instance in this [recipe](../python_cookbook/#lanes-recipe) the user creates a carla.Waypoint for the current location of a vehicle and uses it to get the current and adjacent lane types. + Class that defines the possible lane types accepted by OpenDRIVE 1.4. This standards define the road information. For instance in this [recipe](../python_cookbook/#lanes-recipe) the user creates a carla.Waypoint for the current location of a vehicle and uses it to get the current and adjacent lane types. # - PROPERTIES ------------------------- instance_variables: - var_name: NONE - doc: > - - var_name: Any - doc: > - Every type except for NONE. + doc: > - var_name: Bidirectional doc: > - var_name: Biking @@ -54,11 +51,14 @@ doc: > - var_name: Tram doc: > + - var_name: Any + doc: > + Every type except for NONE. - class_name: LaneChange # - DESCRIPTION ------------------------ doc: > - Class that defines the permission to turn either left, right, both or none (meaning only going straight is allowed). This information is stored for every carla.Waypoint according to the OpenDRIVE file. In this [recipe](../python_cookbook/#lanes-recipe) the user creates a waypoint for a current vehicle position and learns which turns are permitted. + Class that defines the permission to turn either left, right, both or none (meaning only going straight is allowed). This information is stored for every carla.Waypoint according to the OpenDRIVE file. In this [recipe](../python_cookbook/#lanes-recipe) the user creates a waypoint for a current vehicle position and learns which turns are permitted. # - PROPERTIES ------------------------- instance_variables: - var_name: NONE @@ -82,7 +82,7 @@ instance_variables: - var_name: Standard doc: > - White by default. + White by default. - var_name: Blue doc: > - var_name: Green @@ -99,7 +99,9 @@ - class_name: LaneMarkingType # - DESCRIPTION ------------------------ doc: > - Class that defines the lane marking types accepted by OpenDRIVE 1.4. Take a look at this [recipe](../python_cookbook/#lanes-recipe) where the user creates a carla.Waypoint for a vehicle location and retrieves from it the information about adjacent lane markings. + Class that defines the lane marking types accepted by OpenDRIVE 1.4. Take a look at this [recipe](../python_cookbook/#lanes-recipe) where the user creates a carla.Waypoint for a vehicle location and retrieves from it the information about adjacent lane markings. + + __Note on double types:__ Lane markings are defined under the OpenDRIVE standard that determines whereas a line will be considered "BrokenSolid" or "SolidBroken". For each road there is a center lane marking, defined from left to right regarding the lane's directions. The rest of the lane markings are defined in order from the center lane to the closest outside of the road. # - PROPERTIES ------------------------- instance_variables: - var_name: NONE @@ -109,11 +111,9 @@ - var_name: Broken doc: > - var_name: BrokenBroken - doc: > - From inside to outside except for center lane which is from left to right. + doc: > - var_name: BrokenSolid doc: > - From inside to outside except for center lane which is from left to right. - var_name: Curb doc: > - var_name: Grass @@ -122,38 +122,36 @@ doc: > - var_name: SolidBroken doc: > - From inside to outside except for center lane which is from left to right. - var_name: SolidSolid doc: > - For double solid line. - var_name: Other doc: > - class_name: Map # - DESCRIPTION ------------------------ doc: > - Class containing the road information and waypoint managing. Data is retrieved from an OpenDRIVE file that describes the road. A query system is defined which works hand in hand with carla.Waypoint to translate geometrical information from the .xodr to natural world points. CARLA is currently working with [OpenDRIVE 1.4 standard](http://www.opendrive.org/docs/OpenDRIVEFormatSpecRev1.4H.pdf). + Class containing the road information and waypoint managing. Data is retrieved from an OpenDRIVE file that describes the road. A query system is defined which works hand in hand with carla.Waypoint to translate geometrical information from the .xodr to natural world points. CARLA is currently working with [OpenDRIVE 1.4 standard](http://www.opendrive.org/docs/OpenDRIVEFormatSpecRev1.4H.pdf). # - PROPERTIES ------------------------- instance_variables: - var_name: name type: str doc: > - The name of the map. It corresponds to the .umap from Unreal Engine that is loaded from a CARLA server, which then references to the .xodr road description. + The name of the map. It corresponds to the .umap from Unreal Engine that is loaded from a CARLA server, which then references to the .xodr road description. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: name type: str - doc: > - Name of the current map. + doc: > + Name of the current map. - param_name: xodr_content type: str doc: > .xodr content in string format. return: list(carla.Transform) doc: > - Constructor for this class. Though a map is automatically generated when initializing the world, using this method in no-rendering mode facilitates working with an .xodr without any CARLA server running. + Constructor for this class. Though a map is automatically generated when initializing the world, using this method in no-rendering mode facilitates working with an .xodr without any CARLA server running. # -------------------------------------- - def_name: generate_waypoints params: @@ -163,12 +161,12 @@ Approximate distance between waypoints. return: list(carla.Waypoint) 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. + 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: get_spawn_points return: list(carla.Transform) doc: > - Returns a list of recommendations made by creators of the map to be used spawning points for vehicles. The list includes carla.Tranform objects with certain location and orientation. Said locations are slightly on-air and vehicles fall for a bit before starting their way. + 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 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. # -------------------------------------- - def_name: get_topology doc: > @@ -177,22 +175,22 @@ # -------------------------------------- - def_name: get_waypoint doc: > - Returns a waypoint that can be located in an exact location or translated to the center of the nearest lane. Said lane type can be defined using flags such as `LaneType.Driving & LaneType.Shoulder`. - The method will return None if the waypoint is not found, which may happen only when trying to retrieve a waypoint for an exact location. That eases checking if a point is inside a certain road, as otherwise, it will return the corresponding waypoint. + Returns a waypoint that can be located in an exact location or translated to the center of the nearest lane. Said lane type can be defined using flags such as `LaneType.Driving & LaneType.Shoulder`. + The method will return None if the waypoint is not found, which may happen only when trying to retrieve a waypoint for an exact location. That eases checking if a point is inside a certain road, as otherwise, it will return the corresponding waypoint. params: - param_name: location type: carla.Location - doc: > - Location used as reference for the carla.Waypoint. + doc: > + Location used as reference for the carla.Waypoint. - param_name: project_to_road type: bool default: "True" - doc: > + doc: > If **True**, the waypoint will be at the center of the closest lane. This is the default setting. If **False**, the waypoint will be exactly in `location`. None means said location does not belong to a road. - param_name: lane_type type: carla.LaneType default: carla.LaneType.Driving - doc: > + doc: > Limits the search for nearest lane to one or various lane types that can be flagged. return: carla.Waypoint # -------------------------------------- @@ -214,26 +212,7 @@ Specify the length from the road start return: carla.Waypoint # -------------------------------------- - - def_name: get_topology - doc: > - It provides a minimal graph of the topology of the current OpenDRIVE file. - It is constituted by a list of pairs of waypoints, where the first waypoint is the origin and the second - one is the destination. It can be loaded into [NetworkX](https://networkx.github.io/). A valid output could be: - `[ (w0, w1), (w0, w2), (w1, w3), (w2, w3), (w0, w4) ]` - return: list(tuple(carla.Waypoint, carla.Waypoint)) - # -------------------------------------- - - def_name: generate_waypoints - params: - - param_name: distance - type: float - doc: > - Approximate distance between the waypoints - return: list(carla.Waypoint) - doc: > - Returns a list of waypoints positioned on the center of the lanes - all over the map with an approximate distance between them. - # -------------------------------------- - - def_name: transform_to_geolocation + - def_name: save_to_disk params: - param_name: path doc: > @@ -243,7 +222,7 @@ # -------------------------------------- - def_name: to_opendrive doc: > - Returns the .xodr OpenDRIVe file of the current map as string. + Returns the .xodr OpenDRIVe file of the current map as string. return: str # -------------------------------------- - def_name: transform_to_geolocation @@ -260,17 +239,17 @@ - class_name: LaneMarking # - DESCRIPTION ------------------------ doc: > - Class that gathers all the information regarding a lane marking according to [OpenDRIVE 1.4 standard](http://www.opendrive.org/docs/OpenDRIVEFormatSpecRev1.4H.pdf) standard. + Class that gathers all the information regarding a lane marking according to [OpenDRIVE 1.4 standard](http://www.opendrive.org/docs/OpenDRIVEFormatSpecRev1.4H.pdf) standard. # - PROPERTIES ------------------------- instance_variables: - var_name: color type: carla.LaneMarkingColor doc: > - Actual color of the marking. + Actual color of the marking. - var_name: lane_change type: carla.LaneChange doc: > - Permissions for said lane marking to be crossed. + Permissions for said lane marking to be crossed. - var_name: type type: carla.LaneMarkingType doc: > @@ -284,21 +263,21 @@ - class_name: Waypoint # - DESCRIPTION ------------------------ doc: > - Waypoints in CARLA are described as 3D directed points. They store a certain carla.Transform which locates the waypoint in a road and orientates it according to the lane. They also store the road information belonging to said point regarding its lane and lane markings. All of this information is retrieved as provided by the OpenDRIVE file. + Waypoints in CARLA are described as 3D directed points. They store a certain carla.Transform which locates the waypoint in a road and orientates it according to the lane. They also store the road information belonging to said point regarding its lane and lane markings. All of this information is retrieved as provided by the OpenDRIVE file. # - PROPERTIES ------------------------- instance_variables: - var_name: id type: int doc: > - The identificator is generated using a hash combination of the road, section, lane and s values that correspond to said point in the OpenDRIVE geometry. The s precision is set to 2 centimeters, so 2 waypoints closer than 2 centimeters in the same road, section and lane, will have the same identificator. + The identificator is generated using a hash combination of the road, section, lane and s values that correspond to said point in the OpenDRIVE geometry. The s precision is set to 2 centimeters, so 2 waypoints closer than 2 centimeters in the same road, section and lane, will have the same identificator. - var_name: transform type: carla.Transform doc: > - Position and orientation of the waypoint according to the current lane information. This data is computed the first time it is accessed. It is not created right away in order to ease computing costs when lots of waypoints are created but their specific transform is not needed. + Position and orientation of the waypoint according to the current lane information. This data is computed the first time it is accessed. It is not created right away in order to ease computing costs when lots of waypoints are created but their specific transform is not needed. - var_name: road_id type: int doc: > - OpenDRIVE road's id. + OpenDRIVE road's id. - var_name: section_id type: int doc: > @@ -314,7 +293,7 @@ - var_name: is_junction type: bool doc: > - True if the current Waypoint is on a junction as defined by OpenDRIVE. + True if the current Waypoint is on a junction as defined by OpenDRIVE. - var_name: lane_width type: float doc: > @@ -340,16 +319,16 @@ - 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, regardless if the lane change is allowed in this location. + 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. - Can return None if the lane does not exist + 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, regardless if the lane change is allowed in this location. + 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. - Can return None if the lane does not exist. + Will return None if the lane does not exist. # -------------------------------------- - def_name: next params: @@ -359,9 +338,9 @@ The approximate distance where to get the next waypoints. return: list(carla.Waypoint) doc: > - 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. + 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 road ends before the specified distance, for instance, a lane ending with the only option of incorporating to another road. + The list may be empty if the lane is not connected to any other at the specified distance. # -------------------------------------- - def_name: next_until_lane_end params: @@ -381,9 +360,9 @@ The approximate distance where to get the previous waypoints. return: list(carla.Waypoint) doc: > - This method does not return the waypoint previously visited by an actor, but a list of waypoints at an approximate `distance` but in the opposite direction of the lane. Similarly to **next()**, it takes into account the road and its possible deviations without performing any lane change and returns one waypoint per option. + This method does not return the waypoint previously visited by an actor, but a list of waypoints at an approximate `distance` but in the opposite direction of the lane. Similarly to **next()**, 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 road ends before the specified distance, for instance, a lane ending with the only option of incorporating to another road. + The list may be empty if the lane is not connected to any other at the specified distance. # -------------------------------------- - def_name: previous_until_lane_start params: @@ -422,6 +401,6 @@ Type of lanes to get the waypoints. return: list(tuple(carla.Waypoint)) doc: > - Returns a list of pairs of waypoints. Every tuple on the list contains first an initial and then a final waypoint within the intersection boundaries that describe the beginning and the end of said lane along the junction. Lanes follow their OpenDRIVE definitions so there may be many different tuples with the same starting waypoint due to possible deviations, as this are considered different lanes. + Returns a list of pairs of waypoints. Every tuple on the list contains first an initial and then a final waypoint within the intersection boundaries that describe the beginning and the end of said lane along the junction. Lanes follow their OpenDRIVE definitions so there may be many different tuples with the same starting waypoint due to possible deviations, as this are considered different lanes. # -------------------------------------- ... diff --git a/PythonAPI/docs/sensor.yml b/PythonAPI/docs/sensor.yml index cea2cb41a..21166bb4e 100644 --- a/PythonAPI/docs/sensor.yml +++ b/PythonAPI/docs/sensor.yml @@ -1,19 +1,33 @@ --- - module_name: carla - doc: > # - CLASSES ------------------------------ classes: - class_name: Sensor parent: carla.Actor # - DESCRIPTION ------------------------ doc: > - A sensor 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 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: + 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). + 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). + # - PROPERTIES ------------------------- instance_variables: - var_name: is_listening type: boolean doc: > - Is true if the sensor is listening for data + When True the sensor will be waiting for data. # - METHODS ---------------------------- methods: - def_name: listen @@ -21,17 +35,14 @@ - param_name: callback type: function doc: > - Register a callback to be executed each time a new measurement is - received. The callback must accept a single argument containing the - sensor data; the type of this object varies depending on the type of - sensor, but they all derive from carla.SensorData. + The called function with one argument containing the sensor data. doc: > + The function the sensor will be calling to every time a new measurement is received. This function needs for an argument containing an object type carla.SensorData to work with. # -------------------------------------- - def_name: stop doc: > - Stops listening for data + Commands the sensor to stop listening for data. # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- ... diff --git a/PythonAPI/docs/sensor_data.yml b/PythonAPI/docs/sensor_data.yml index 0a6922af7..2809a46f9 100644 --- a/PythonAPI/docs/sensor_data.yml +++ b/PythonAPI/docs/sensor_data.yml @@ -1,12 +1,19 @@ --- - module_name: carla - doc: > # - CLASSES ------------------------------ classes: - class_name: SensorData # - DESCRIPTION ------------------------ doc: > - Base class for all the objects containing data generated by a sensor. + Base class for all the objects containing data generated by a carla.Sensor. This objects should be the argument of the function said sensor is listening to, in order to work with them. Each of these sensors needs for a specific type of sensor data. The relation between available sensors and their corresponding data goes like: + - Cameras (RGB, depth and semantic segmentation): carla.Image. + - Collision detector: carla.CollisionEvent. + - Gnss detector: carla.GnssMeasurement. + - IMU detector: carla.IMUMeasurement. + - Lane invasion detector: carla.LaneInvasionEvent. + - Lidar raycast: carla.LidarMeasurement. + - Obstacle detector: carla.ObstacleDetectionEvent. + - Radar detector: carla.RadarMeasurement. # - PROPERTIES ------------------------- instance_variables: - var_name: frame @@ -26,40 +33,43 @@ - class_name: ColorConverter # - DESCRIPTION ------------------------ doc: > - Class that defines the color converter options. Check out this [`recipe`](../python_cookbook/#converted-image-recipe)! + Class that defines conversion patterns that can be applied to a carla.Image in order to show information provided by carla.Sensor. Depth conversions cause a loss of accuracy, as sensors detect depth as float that is then converted to a grayscale value between 0 and 255. Take a look a this [recipe](../python_cookbook/#converted-image-recipe) to see an example of how to create and save image data for sensor.camera.semantic_segmentation. # - PROPERTIES ------------------------- instance_variables: - - var_name: Raw - doc: > - - var_name: Depth - doc: > - - var_name: LogarithmicDepth - doc: > - var_name: CityScapesPalette doc: > + Converts the image to a segmentated map using tags provided by the blueprint library. Used by sensor.camera.semantic_segmentation. + - var_name: Depth + doc: > + Converts the image to a linear depth map. Used by sensor.camera.depth. + - var_name: LogarithmicDepth + doc: > + Converts the image to a depth map using a logarithmic scale, leading to better precision for small distances at the expense of losing it when further away. + - var_name: Raw + doc: > + No changes applied to the image. - class_name: Image parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Class that defines an image of 32-bit BGRA colors. + 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/). # - PROPERTIES ------------------------- instance_variables: - - var_name: width - type: int - doc: > - Image width in pixels. - - var_name: height - type: int - doc: > - Image height in pixels - var_name: fov type: float doc: > Horizontal field of view of the image in degrees. + - var_name: height + type: int + doc: > + Image height in pixels. + - var_name: width + type: int + doc: > + Image width in pixels. - var_name: raw_data type: bytes - doc: > # - METHODS ---------------------------- methods: - def_name: convert @@ -67,31 +77,30 @@ - param_name: color_converter type: carla.ColorConverter doc: > - Convert the image with the applied conversion. + Converts the image following the `color_converter` pattern. # -------------------------------------- - def_name: save_to_disk params: - param_name: path type: str doc: > - Path where it will be saved + Path that will contain the image. - param_name: color_converter type: carla.ColorConverter default: Raw + doc: > + Default Raw will make no changes. doc: > - Save the image to disk. + 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__ - doc: > # -------------------------------------- - def_name: __iter__ - doc: > # -------------------------------------- - def_name: __getitem__ params: - param_name: pos type: int - doc: > # -------------------------------------- - def_name: __setitem__ params: @@ -99,31 +108,29 @@ type: int - param_name: color type: carla.Color - doc: > # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: LidarMeasurement parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Lidar sensor measurement data. + 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). # - PROPERTIES ------------------------- instance_variables: - - var_name: horizontal_angle - type: float - doc: > - Horizontal angle that the Lidar has rotated at the time of the measurement (in radians) - var_name: channels type: int doc: > - Number of lasers + Number of lasers shot. + - var_name: horizontal_angle + type: float + doc: > + Horizontal angle the Lidar is rotated at the time of the measurement (in radians). - var_name: raw_data type: bytes doc: > - List of 3D points + List of 3D points received as data. # - METHODS ---------------------------- methods: - def_name: get_point_count @@ -131,29 +138,23 @@ - param_name: channel type: int doc: > - Retrieve the number of points that are generated by this channel. - note: > - Points are sorted by channel, so this method allows to identify the channel - that generated each point. + 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 type: str doc: > - Save point cloud to disk + 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__ - doc: > # -------------------------------------- - def_name: __iter__ - doc: > # -------------------------------------- - def_name: __getitem__ params: - param_name: pos type: int - doc: > # -------------------------------------- - def_name: __setitem__ params: @@ -161,85 +162,85 @@ type: int - param_name: location type: carla.Location - doc: > # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: CollisionEvent parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Class that defines a registered collision. + 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). # - PROPERTIES ------------------------- instance_variables: - var_name: actor type: carla.Actor doc: > - Get "self" actor. Actor that measured the collision. + The actor the sensor is attached to, the one that measured the collision. - var_name: other_actor type: carla.Actor doc: > - Get the actor to which we collided. + The second actor involved in the collision. - var_name: normal_impulse type: carla.Vector3D doc: > - Normal impulse result of the collision. + Normal impulse resulting of the collision. - class_name: ObstacleDetectionEvent parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Obstacle detection sensor data + Class that defines the obstacle data for sensor.other.obstacle. Learn more about this [here](/cameras_and_sensors/#sensorotherobstacle). # - PROPERTIES ------------------------- instance_variables: - var_name: actor type: carla.Actor doc: > - Get "self" actor. Actor that measured the collision. + The actor the sensor is attached to. - var_name: other_actor type: carla.Actor doc: > - Get the actor to which we collided. + The actor or object considered to be an obstacle. - var_name: distance type: float doc: > - Get obstacle distance. + Distance between `actor` and `other`. # - METHODS ---------------------------- methods: - def_name: __str__ - doc: > # -------------------------------------- - class_name: LaneInvasionEvent parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Lane invasion sensor data. + 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). # - PROPERTIES ------------------------- instance_variables: - var_name: actor type: carla.Actor doc: > - Get "self" actor. Actor that invaded another lane. + Gets the actor the sensor is attached to, the one that invaded another lane. - var_name: crossed_lane_markings type: list(carla.LaneMarking) doc: > - List of lane markings that have been crossed. + List of lane markings that have been crossed and detected by the sensor. # - METHODS ---------------------------- methods: - def_name: __str__ - doc: > # -------------------------------------- - class_name: GnssMeasurement parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Gnss sensor data + Class that defines the Gnss data registered by a sensor.other.gnss. It essentially reports its position with the position of the sensor and an OpenDRIVE geo-reference. # - PROPERTIES ------------------------- instance_variables: + - var_name: altitude + type: float + doc: > + Height regarding ground level. - var_name: latitude type: float doc: > @@ -248,69 +249,60 @@ type: float doc: > West/East value of a point on the map. - - var_name: altitude - type: float - doc: > - Height regarding ground level. # - METHODS ---------------------------- methods: - def_name: __str__ - doc: > # -------------------------------------- - class_name: IMUMeasurement parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - IMU sensor data regarding the sensor World's transformation + Class that defines the data registered by a sensor.other.imu, regarding the sensor's transformation according to the current carla.World. It essentially acts as accelerometer, gyroscope and compass. # - PROPERTIES ------------------------- instance_variables: - var_name: accelerometer type: carla.Vector3D doc: > - Measures linear acceleration in `m/s^2`. - - var_name: gyroscope - type: carla.Vector3D - doc: > - Measures angular velocity in `rad/sec`. + Linear acceleration in m/s^2. - var_name: compass type: float doc: > - Orientation with respect to the North (`(0.0, -1.0, 0.0)` in Unreal) in radians. + Orientation with regard to the North ((0.0, -1.0, 0.0) in Unreal Engine) in radians. + - var_name: gyroscope + type: carla.Vector3D + doc: > + Angular velocity in rad/sec. # - METHODS ---------------------------- methods: - def_name: __str__ - doc: > # -------------------------------------- - class_name: RadarMeasurement parent: carla.SensorData # - DESCRIPTION ------------------------ doc: > - Measurement produced by a Radar. Consists of an array of carla.RadarDetection. + 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. # - PROPERTIES ------------------------- instance_variables: - var_name: raw_data type: bytes doc: > - List of carla.RadarDetection. + The complete information of the carla.RadarDetection the radar has registered. # - METHODS ---------------------------- methods: - def_name: get_detection_count doc: > - Retrieve the number of carla.RadarDetection that are generated. + Retrieves the number of entries generated, same as **\__str__()**. # -------------------------------------- - def_name: __len__ - doc: > # -------------------------------------- - def_name: __iter__ - doc: > # -------------------------------------- - def_name: __getitem__ params: - param_name: pos type: int - doc: > # -------------------------------------- - def_name: __setitem__ params: @@ -318,40 +310,37 @@ type: int - param_name: detection type: carla.RadarDetection - doc: > # -------------------------------------- - def_name: __str__ - doc: > # -------------------------------------- - class_name: RadarDetection # - DESCRIPTION ------------------------ doc: > - Data contained by a carla.RadarMeasurement. Represents an object detection produced by the Radar sensor. + Data contained inside a carla.RadarMeasurement. Each of these represents one of the points in the cloud that a sensor.other.radar registers and contains the distance, angle and velocity in relation to the radar. # - PROPERTIES ------------------------- instance_variables: - - var_name: velocity + - var_name: altitude type: float doc: > - The velocity of the detected object towards the sensor in meters per second. + Altitude angle of the detection in radians. # -------------------------------------- - var_name: azimuth type: float doc: > - Azimuth angle of the detection in radians - # -------------------------------------- - - var_name: altitude - type: float - doc: > - Altitude angle of the detection in radians + Azimuth angle of the detection in radians. # -------------------------------------- - var_name: depth type: float doc: > Distance in meters from the sensor to the detection position. + # -------------------------------------- + - var_name: velocity + type: float + doc: > + The velocity of the detected object towards the sensor in m/s. # - METHODS ---------------------------- methods: - def_name: __str__ - doc: > # -------------------------------------- ... diff --git a/PythonAPI/docs/snapshot.yml b/PythonAPI/docs/snapshot.yml index b12f7a728..938ec8458 100644 --- a/PythonAPI/docs/snapshot.yml +++ b/PythonAPI/docs/snapshot.yml @@ -2,100 +2,100 @@ - module_name: carla doc: > # - CLASSES ------------------------------ + classes: - class_name: WorldSnapshot # - DESCRIPTION ------------------------ doc: > - Class that represents the state of every actor - in the simulation at a single frame + This snapshot comprises all the information for every actor on scene at a certain moment of time. It creates and gives acces to a data structure containing a series of carla.ActorSnapshot. The client recieves a new snapshot on every tick that cannot be stored. # - PROPERTIES ------------------------- instance_variables: - var_name: id type: int doc: > - The WorldSnapshot's identifier + A value unique for every snapshot to differenciate them. - var_name: frame type: int doc: > - Frame number + Simulation frame in which the snapshot was taken. - var_name: timestamp type: carla.Timestamp doc: > - Timestamp simulated data + Precise moment in time when snapshot was taken. This class works in seconds as given by the operative system. # - METHODS ---------------------------- methods: - - def_name: has_actor + - def_name: __eq__ + return: bool params: - - param_name: actor_id - type: int + - param_name: other + type: carla.WorldSnapshot doc: > - Check if an actor is present in this snapshot. + Returns True if both **timestamp** are the same. # -------------------------------------- - - def_name: find - return: - params: - - param_name: actor_id - type: int - doc: > - Find an ActorSnapshot by id, return None if the actor is not found. + - 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: > - Return number of carla.ActorSnapshot present in this carla.WorldSnapshot. + Returns the amount of carla.ActorSnapshot present in this snapshot. # -------------------------------------- - - def_name: __iter__ - doc: > + - def_name: find + return: carla.ActorSnapshot + params: + - param_name: actor_id + type: int + doc: > + Given a certain actor ID, returns its corresponding snapshot or None if it is not found. # -------------------------------------- - - def_name: __eq__ + - def_name: has_actor + return: bool params: - - param_name: other - type: carla.WorldSnapshot - doc: > - # -------------------------------------- - - def_name: __ne__ - params: - - param_name: other - type: carla.WorldSnapshot - doc: > - # -------------------------------------- - - def_name: __self__ + - param_name: actor_id + type: int doc: > + Given a certain actor ID, checks if there is a snapshot corresponding it and so, if the actor was present at that moment. # -------------------------------------- - class_name: ActorSnapshot # - DESCRIPTION ------------------------ doc: > - Class that provides access to the data of a carla.Actor in a carla.WorldSnapshot. + A class that comprises all the information for an actor at a certain moment in time. These objects are contained in a carla.WorldSnapshot and sent to the client once every tick. # - PROPERTIES ------------------------- instance_variables: - var_name: id type: int doc: > - The ActorSnapshot's identifier + An identifier for the snapshot itself. # - METHODS ---------------------------- methods: - - def_name: get_transform - return: carla.Transform - doc: > - Returns the actor's current transform - # -------------------------------------- - - def_name: get_velocity + - def_name: get_acceleration return: carla.Vector3D - doc: > - Returns the actor's current 3D velocity + doc: > + Returns the acceleration vector registered for an actor in that tick. # -------------------------------------- - def_name: get_angular_velocity return: carla.Vector3D doc: > - Returns the actor's current 3D angular velocity + Returns the angular velocity vector registered for an actor in that tick. # -------------------------------------- - - def_name: get_acceleration + - def_name: get_transform + return: carla.Transform + doc: > + Returns the actor's transform (location and rotation) for an actor in that tick. + # -------------------------------------- + - def_name: get_velocity return: carla.Vector3D - doc: > - Returns the actor's current 3D acceleration - # -------------------------------------- - - def_name: __self__ - doc: > + doc: > + Returns the velocity vector registered for an actor in that tick. # -------------------------------------- ... diff --git a/PythonAPI/docs/weather.yml b/PythonAPI/docs/weather.yml index 7b9899e5e..af5d139d9 100644 --- a/PythonAPI/docs/weather.yml +++ b/PythonAPI/docs/weather.yml @@ -6,31 +6,29 @@ - class_name: WeatherParameters # - DESCRIPTION ------------------------ doc: > - WeatherParameters class is used for requesting and changing the lighting and weather conditions inside the world. + This class defines objects containing lightning and weather specifications that can later be applied in carla.World. So far, these conditions only intervene with [sensor.camera.rgb](/bp_library/). They neither affect the actor's physics nor other sensors. + Each of these parameters acts indepently from the rest. Increasing the rainfall will not automatically create puddles nor change the road's humidity. That makes for a better customization but means that realistic conditions need to be scripted. However an example of dynamic weather conditions working realistically can be found [here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/dynamic_weather.py). # - PROPERTIES ------------------------- instance_variables: - var_name: cloudiness type: float doc: > - Weather cloudiness. It only affects the RGB camera sensor. Values range from 0 to 100. + Values range from 0 to 100, being 0 a clear sky and 100 one completely covered with clouds. # -------------------------------------- - var_name: precipitation type: float doc: > - Precipitation amount for controlling rain intensity. It only affects the RGB camera sensor. - Values range from 0 to 100. + Rain intensity values range from 0 to 100, being 0 none at all and 100 a heavy rain. # -------------------------------------- - var_name: precipitation_deposits type: float doc: > - Precipitation deposits for controlling the area of puddles on roads. It only affects the RGB camera sensor. - Values range from 0 to 100. + Determines the creation of puddles. Values range from 0 to 100, being 0 none at all and 100 a road completely capped with water. Puddles are created with static noise, meaning that they will always appear at the same locations. # -------------------------------------- - var_name: wind_intensity type: float doc: > - Wind intensity, it affects the clouds moving speed, the raindrop direction, - and vegetation. This doesn't affect the car physics. Values range from 0 to 100. + Controls the strenght of the wind with values from 0, no wind at all, to 100, a strong wind. The wind does affect rain direction and leaves from trees, so this value is restricted to avoid animation issues. # -------------------------------------- - var_name: fog_density type: float @@ -50,12 +48,12 @@ - var_name: sun_azimuth_angle type: float doc: > - The azimuth angle of the sun in degrees. Values range from 0 to 360 (degrees). + The azimuth angle of the sun in degrees. Values range from 0 to 360. Zero is an origin point in a sphere determined by Unreal Engine. # -------------------------------------- - var_name: sun_altitude_angle type: float doc: > - Altitude angle of the sun in degrees. Values range from -90 to 90 (where 0 degrees is the horizon). + Altitude angle of the sun in degrees. Values range from -90 to 90 corresponding to midnight and midday each. # - METHODS ---------------------------- methods: @@ -64,37 +62,51 @@ - param_name: cloudiness type: float default: 0.0 + doc: > + 0 is a clear sky, 100 complete overcast. - param_name: precipitation type: float default: 0.0 + doc: > + 0 is no rain at all, 100 a heavy rain. - param_name: precipitation_deposits type: float default: 0.0 + doc: > + 0 means no puddles on the road, 100 means roads completely capped by rain. - param_name: wind_intensity type: float default: 0.0 + doc: > + 0 is calm, 100 a strong wind. - param_name: sun_azimuth_angle type: float default: 0.0 + doc: > + 90 is midday, -90 is midnight. - param_name: sun_altitude_angle type: float default: 0.0 + doc: > + 0 is an arbitrary North, 180 its corresponding South. + note: > + ClearNoon, CloudyNoon, WetNoon, WetCloudyNoon, SoftRainNoon, MidRainyNoon, HardRainNoon, ClearSunset, CloudySunset, WetSunset, WetCloudySunset, SoftRainSunset, MidRainSunset, HardRainSunset. doc: > - WeatherParameters constructor + Method to initialize an object defining weather conditions. This class has some presets for different noon and sunset conditions listed in a note below. # -------------------------------------- - def_name: __eq__ params: - param_name: other return: bool doc: > - Returns True if `self` and `other` are equal + Returns True if both objects' variables are the same. # -------------------------------------- - def_name: __ne__ params: - param_name: other return: bool doc: > - Returns True if `self` and `other` are not equal + 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 ec4b967b6..a422ce77a 100644 --- a/PythonAPI/docs/world.yml +++ b/PythonAPI/docs/world.yml @@ -6,7 +6,7 @@ - class_name: Timestamp # - DESCRIPTION ------------------------ doc: > - Class that contains Timestamp simulated data. + Class that contains time information for simulated data. This information is automatically retrieved as part of the carla.WorldSnapshot the client gets on every frame, but might also be used in many other situations such as a carla.Sensor retrieveing data. # - PROPERTIES ------------------------- instance_variables: - var_name: frame @@ -24,8 +24,7 @@ - var_name: platform_timestamp type: float doc: > - Time-stamp of the frame at which this measurement was taken, in seconds - as given by the OS. + Time register of the frame at which this measurement was taken given by the OS in seconds. # - METHODS ---------------------------- methods: - def_name: __init__ @@ -59,167 +58,158 @@ - class_name: ActorList # - DESCRIPTION ------------------------ doc: > - Class that provides access to actors. + 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: find - params: - - param_name: actor_id - type: int - doc: > - Find an actor by ID. - # -------------------------------------- - - def_name: filter - params: - - param_name: wildcard_pattern - type: str - doc: > - Filters a list of Actors with type_id matching wildcard_pattern. - note: > - The wildcard_pattern follows Unix shell-style wildcards (fnmatch). - # -------------------------------------- - def_name: __getitem__ + return: carla.Actor params: - param_name: pos type: int doc: > - # -------------------------------------- - - def_name: __len__ - 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: + - param_name: wildcard_pattern + type: str + doc: > + 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. + # -------------------------------------- + - def_name: find + return: carla.Actor + params: + - param_name: actor_id + type: int + doc: > + Finds an actor using its identifier and returns it or None if it is not present. # -------------------------------------- - class_name: WorldSettings # - DESCRIPTION ------------------------ doc: > - Class that provides access to modifiable world settings. - Check it out in our [section](../configuring_the_simulation/) + The simulation has some advanced configuration options that are contained in this class and can be managed using carla.World and its methods. These allow the user to choose between client-server synchrony/asynchrony, activation of "no rendering mode" and either if the simulation should run with a fixed or variable time-step. Check [this](../configuring_the_simulation/) out if you want to learn about it. # - PROPERTIES ------------------------- instance_variables: - var_name: synchronous_mode type: bool doc: > + States the synchrony between client and server. When set to true, the server will wait for a client tick in order to move forward. It is false by default. - var_name: no_rendering_mode type: bool doc: > + When enabled, the simulation will run no rendering at all. This is mainly used to avoid overhead during heavy traffic simulations. It is false by default. - var_name: fixed_delta_seconds type: float doc: > + Ensures that the time elapsed between two steps of the simulation is fixed. Set this to 0.0 to work with a variable time-step, as happens by default. # - METHODS ---------------------------- methods: - def_name: __init__ params: - param_name: synchronous_mode type: bool - default: false + default: False doc: > + Set this to true to enable client-server synchrony. - param_name: no_rendering_mode type: bool - default: false + default: False doc: > + Set this to true to completely disable rendering in the simulation. - param_name: fixed_delta_seconds type: float default: 0.0 doc: > + 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. doc: > + Creates an object containing desired settings that could later be applied through carla.World and its method **apply_settings()**. # -------------------------------------- - def_name: __eq__ + return: bool params: - param_name: other - type: carla.Timestamp + type: carla.WorldSettings + doc: > + Settings to be compared with. doc: > + Returns True if both objects' variables are the same. # -------------------------------------- - def_name: __ne__ + return: bool params: - param_name: other - type: carla.Timestamp + type: carla.WorldSettings + doc: > + Settings to be compared with. doc: > + Returns True if both objects' variables are different. # -------------------------------------- - def_name: __str__ + return: str doc: > + Parses the established settings to a string and shows them in command line. # -------------------------------------- - class_name: AttachmentType # - DESCRIPTION ------------------------ doc: > - Class that defines the attachment options. See carla.World.spawn_actor.
- Check out this [`recipe`](../python_cookbook/#attach-sensors-recipe)! + Class that defines attachment options between an actor and its parent. When spawning actors, these can be attached to another actor so their position changes accordingly. This is specially useful for cameras and sensors. [Here](../python_cookbook/#attach-sensors-recipe) is a brief recipe in which we can see how sensors can be attached to a car when spawned. Note that the attachment type is declared as an enum within the class. # - PROPERTIES ------------------------- instance_variables: - var_name: Rigid doc: > - Standard fixed attachment. + With this fixed attatchment the object follow its parent position strictly. - var_name: SpringArm doc: > - Attachment that expands or retracts based on camera situation. + An attachment that expands or retracts depending on camera situation. SpringArms are an Unreal Engine component so [check this out](../python_cookbook/#attach-sensors-recipe) to learn some more about them. # -------------------------------------- - class_name: World # - DESCRIPTION ------------------------ doc: > - Class that contains the current loaded map. + World objects are created by the client to have a place for the simulation to happen. The world contains the map we can see, meaning the asset, not the navigation map. Navigation maps are part of the carla.Map class. It also manages the weather and actors present in it. There can only be one world per simulation, but it can be changed anytime. # - PROPERTIES ------------------------- instance_variables: - var_name: id type: int doc: > - The id of the episode associated with this world. + The ID of the episode associated with this world. Episodes are different sessions of a simulation. These change everytime a world is disabled or reloaded. Keeping track is useful to avoid possible issues. - var_name: debug type: carla.DebugHelper doc: > + Responsible for creating different shapes for debugging. Take a look at its class to learn more about it. # - METHODS ---------------------------- - methods: - - def_name: get_blueprint_library - return: carla.BlueprintLibrary + methods: + - def_name: __str__ + return: string doc: > - Return the list of blueprints available in this world. These blueprints - can be used to spawn actors into the world. - # -------------------------------------- - - def_name: get_map - return: carla.Map - doc: > - Return the map that describes this world. - # -------------------------------------- - - def_name: get_spectator - return: carla.Actor - doc: > - Return the spectator actor. The spectator controls the view in the - simulator window. - # -------------------------------------- - - def_name: get_settings - return: carla.WorldSettings - 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: - param_name: world_settings type: carla.WorldSettings doc: > - Returns the id of the frame when the settings took effect. - # -------------------------------------- - - def_name: get_weather - return: carla.WeatherParameters - doc: > - Retrieve the weather parameters currently active in the world. - # -------------------------------------- - - def_name: set_weather - params: - - param_name: weather - type: carla.WeatherParameters - doc: > - Change the weather in the simulation. - # -------------------------------------- - - def_name: get_snapshot - return: carla.WorldSnapshot - doc: > - Return a snapshot of the world at this moment. + This method applies settings contained in an object to the simulation running and returns the ID of the frame they were implemented. # -------------------------------------- - def_name: get_actor return: carla.Actor @@ -227,63 +217,134 @@ - param_name: actor_id type: int doc: > - Find actor by id, return None if not found. + Looks up for an actor by ID and returns None if not found. + # -------------------------------------- + - def_name: get_actors + return: carla.ActorList + params: + - param_name: actor_ids + type: list + default: None + doc: > + The IDs of the actors being searched. By default it is set to None and returns every actor on scene. + doc: > + Retrieves a list of carla.Actor elements, either using a list of IDs provided or just listing everyone on stage. If an ID does not correspond with any actor, it will be excluded from the list returned, meaning that both the list of IDs and the list of actors may have different lengths. + # -------------------------------------- + - def_name: get_blueprint_library + return: carla.BlueprintLibrary + doc: > + Returns a list of actor blueprints available to ease the spawn of these into the world. + # -------------------------------------- + - def_name: get_map + return: carla.Map + doc: > + Returns the object containing the navigation map used to describe this world. # -------------------------------------- - def_name: get_random_location_from_navigation return: carla.Location doc: > - Retrieve a random location to be used as a destination for walkers in carla.WalkerAIController.go_to_location. See [`spawn_npc.py`](https://github.com/carla-simulator/carla/blob/e73ad54d182e743b50690ca00f1709b08b16528c/PythonAPI/examples/spawn_npc.py#L179) for an example. + 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_actors - return: carla.ActorList + - def_name: get_snapshot + return: carla.WorldSnapshot doc: > - By default it returns a list with every actor present in the world. - _A list of ids can be used as a parameter_ + Returns a snapshot of the world at a certain moment comprising all the information about the actors. + # -------------------------------------- + - def_name: get_spectator + return: carla.Actor + 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 + type: carla.WeatherParameters + doc: > + 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.BlueprintLibrary + type: carla.ActorBlueprint doc: > + The reference from which the actor will be created. - param_name: transform type: carla.Transform doc: > - If attached to parent, transform acts like a relative_transform to the parent actor. + 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: > - Spawn an actor into the world based on the blueprint provided at - transform. If a parent is provided, the actor is attached to - parent. + 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.BlueprintLibrary + type: carla.ActorBlueprint doc: > + The reference from which the actor will be created. - param_name: transform type: carla.Transform doc: > - If attached to parent, transform acts like a relative_transform to the parent actor. + 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: > + doc: > + Determines how fixed and rigorous should be the changes in position according to its parent object. doc: > - Same as SpawnActor but return none on failure instead of throwing an - exception. + Same as **spawn_actor()** but returns None on failure instead of throwing an exception. # -------------------------------------- - def_name: wait_for_tick return: carla.WorldSnapshot @@ -291,159 +352,157 @@ - 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: > - Block calling thread until a world tick is received. - # -------------------------------------- - - def_name: on_tick - return: int - params: - - param_name: callback - type: carla.WorldSnapshot - doc: > - Returns the ID of the callback so it can be removed with `remove_on_tick`. - # -------------------------------------- - - def_name: remove_on_tick - params: - - param_name: callback_id - doc: > - Removes on tick callbacks. - # -------------------------------------- - - def_name: tick - return: int - doc: > - Synchronizes with the simulator and returns the id of the newly started frame (only has effect on - synchronous mode). - # -------------------------------------- - - def_name: __str__ - doc: > + The client tells the server to block calling thread until a **world_tick()** is received. # -------------------------------------- - class_name: DebugHelper # - DESCRIPTION ------------------------ doc: > - Class that provides drawing debug shapes. - Check out this [`example`](https://github.com/carla-simulator/carla/blob/master/PythonAPI/util/lane_explorer.py) + 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](../python_cookbook/#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 - - param_name: persistent_lines - type: bool - default: True doc: > - _Deprecated, use `life_time = 0` instead_ + Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. doc: > - Draws a point in the given location. + 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 - - param_name: persistent_lines - type: bool - default: True doc: > - _Deprecated, use `life_time = 0` instead_ + Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. doc: > - Draws a line between two given locations. + Draws a line in between `begin` and `end`. # -------------------------------------- - def_name: draw_arrow params: - param_name: begin type: carla.Location + doc: > + Point in the coordinate system where the arrow starts. - param_name: end type: carla.Location + doc: > + Point in the coordinate system where the arrow ends and points towards to. - param_name: thickness type: float default: 0.1f + doc: > + Density of the line. - param_name: arrow_size type: float default: 0.1f + doc: > + Size of the tip of the arrow. - 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 - - param_name: persistent_lines - type: bool - default: True doc: > - _Deprecated, use `life_time = 0` instead_ + Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. doc: > - Draws an arrow between two given locations. + Draws an arrow from `begin` to `end` pointing in that direction. # -------------------------------------- - def_name: draw_box params: - param_name: box type: carla.BoundingBox + doc: > + Object containing a location and the length of a box for every axis. - param_name: rotation type: carla.Rotation + doc: > + Orientation of the box according to Unreal Engine's axis system. - param_name: thickness type: float default: 0.1f + doc: > + Density of the lines that define the box. - 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 - - param_name: persistent_lines - type: bool - default: True doc: > - _Deprecated, use `life_time = 0` instead_ + Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes. doc: > - Draws the carla.BoundingBox of a given bounding_box.
- Check out this [`recipe`](../python_cookbook/#debug-bounding-box-recipe)! + Draws a box, ussually to act for object colliders. # -------------------------------------- - def_name: draw_string params: - param_name: location type: carla.Location + doc: > + Spot in the simulation where the text will be centered. - param_name: text type: str + doc: > + Text intended to be shown in the world. - param_name: draw_shadow type: bool default: False + doc: > + Casts a shadow for the string that could help in visualization. It is disabled by default. - param_name: color type: carla.Color default: (255,0,0) + doc: > + RGB code to color the string. Red by default. - param_name: life_time type: float default: -1.0f - - param_name: persistent_lines - type: bool - default: true - doc: > - _Deprecated, set a high `life_time` instead_ doc: > - Draws a string in a given location. - note: > - Strings can only be seen on the server-side. + Draws a string in a given location of the simulation which can only be seen server-side. # -------------------------------------- ...