Skip to content
651 changes: 333 additions & 318 deletions Docs/python_api.md

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions PythonAPI/docs/actor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,30 +120,30 @@
return: carla.Vector3D
return_units: m/s<sup>2</sup>
doc: >
Returns the actor's 3D acceleration vector the client recieved during last tick. The method does not call the simulator.
Returns the actor's 3D acceleration vector the client received during last tick. The method does not call the simulator.
# --------------------------------------
- def_name: get_angular_velocity
return: carla.Vector3D
return_units: deg/s
doc: >
Returns the actor's angular velocity vector the client recieved during last tick. The method does not call the simulator.
Returns the actor's angular velocity vector the client received during last tick. The method does not call the simulator.
# --------------------------------------
- def_name: get_location
return: carla.Location
return_units: meters
doc: >
Returns the actor's location the client recieved during last tick. The method does not call the simulator.
Returns the actor's location the client received 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.
Returns the actor's transform (location and rotation) the client received during last tick. The method does not call the simulator.
# --------------------------------------
- def_name: get_velocity
return: carla.Vector3D
return_units: m/s
doc: >
Returns the actor's velocity vector the client recieved during last tick. The method does not call the simulator.
Returns the actor's velocity vector the client received during last tick. The method does not call the simulator.
# --------------------------------------
- def_name: get_world
return: carla.World
Expand Down Expand Up @@ -252,7 +252,7 @@
parent: carla.Actor
# - DESCRIPTION ------------------------
doc: >
One of the most important groups 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 <b>traffic manager</b>.
One of the most important groups of actors in CARLA. These include any type of vehicle from cars to trucks, motorbikes, vans, bicycles and also official vehicles such as police cars. A wide set of these actors is provided in carla.BlueprintLibrary to facilitate different requirements. Vehicles can be either manually controlled or set to an autopilot mode that will be conducted client-side by the <b>traffic manager</b>.
# - PROPERTIES -------------------------
instance_variables:
- var_name: bounding_box
Expand Down Expand Up @@ -591,7 +591,7 @@
parent: carla.TrafficSign
# - DESCRIPTION ------------------------
doc: >
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.
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 differentiated 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.
# - PROPERTIES -------------------------
Expand Down
2 changes: 1 addition & 1 deletion PythonAPI/docs/bp_doc_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
print(" .---------------------------------------------------.")
print(" | Make sure the python client is compiled! |")
print(" '---------------------------------------------------'\n")
# We don't provide an error to prvent Travis checks failing
# We don't provide an error to prevent Travis checks failing
sys.exit(0)

import carla
Expand Down
44 changes: 41 additions & 3 deletions PythonAPI/docs/client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@
type: list
doc: >
A list of commands to execute in batch. Each command is different and has its own parameters. They appear listed at the bottom of this page.
- param_name: do_tick
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_. Defaults to __False__.
doc: >
Executes a list of commands on a single simulation step and retrieves no information. If you need information about the response of each command, use the __<font color="#7fb800">apply_batch_sync()</font>__ method.
[Here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/generate_traffic.py) is an example on how to delete the actors that appear in carla.ActorList all at once.
Expand All @@ -51,11 +56,11 @@
type: list
doc: >
A list of commands to execute in batch. The commands available are listed right above, in the method **<font color="#7fb800">apply_batch()</font>**.
- param_name: due_tick_cue
- param_name: do_tick
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_. It is __False__ by default.
A boolean parameter to specify whether or not to perform a carla.World.tick after applying the batch in _synchronous mode_. Defaults to __False__.
return: list(command.Response)
doc: >
Executes a list of commands on a single simulation step, blocks until the commands are linked, and returns a list of <b>command.Response</b> that can be used to determine whether a single command succeeded or not. [Here](https://github.com/carla-simulator/carla/blob/master/PythonAPI/examples/generate_traffic.py) is an example of it being used to spawn actors.
Expand Down Expand Up @@ -169,6 +174,7 @@
ID of the actor to follow. If this is 0 then camera is disabled.
- param_name: replay_sensors
type: bool
default: false
doc: >
Flag to enable or disable the spawn of sensors during playback.
doc: >
Expand Down Expand Up @@ -793,4 +799,36 @@
- var_name: enable_pedestrian_navigation
type: bool
doc: >
If __True__, Pedestrian navigation will be enabled using Recast tool. For very large maps it is recomended to disable this option. __Default is `True`__.
If __True__, Pedestrian navigation will be enabled using Recast tool. For very large maps it is recommended to disable this option. __Default is `True`__.
# - METHODS ----------------------------
methods:
- def_name: __init__
params:
- param_name: vertex_distance
type: float
param_units: meters
default: 2.0
- param_name: max_road_length
type: float
param_units: meters
default: 50.0
- param_name: wall_height
type: float
param_units: meters
default: 1.0
- param_name: additional_width
type: float
param_units: meters
default: 0.6
- param_name: smooth_junctions
type: bool
default: true
- param_name: enable_mesh_visibility
type: bool
default: true
- param_name: enable_pedestrian_navigation
type: bool
default: true
doc: >
OpendriveGenerationParameters constructor

2 changes: 1 addition & 1 deletion PythonAPI/docs/doc_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def textn(self, buf):

def first_title(self):
self._data = join([
self._data, '#Python API reference\n'])
self._data, '# Python API reference\n'])

def title(self, strongness, buf):
self._data = join([
Expand Down
17 changes: 13 additions & 4 deletions PythonAPI/docs/geom.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,20 +440,29 @@
- def_name: transform
params:
- param_name: in_point
type: carla.Location
type: carla.Vector3D
doc: >
Location in the space to which the transformation will be applied.
doc: >
Translates a 3D point from local to global coordinates using the current transformation as frame of reference.
Translates a 3D point in place from local to global coordinates using the current transformation as frame of reference.
# --------------------------------------
- def_name: inverse_transform
params:
- param_name: in_point
type: carla.Vector3D
doc: >
Location in the space to which the inverse transformation will be applied.
doc: >
Applies the inverse of `transform` by translating a 3D point in place from global to local coordinates using the current transformation as frame of reference.
# --------------------------------------
- def_name: transform_vector
params:
- param_name: in_vector
- param_name: in_point
type: carla.Vector3D
doc: >
Vector to which the transformation will be applied.
doc: >
Rotates a vector using the current transformation as frame of reference, without applying translation. Use this to transform, for example, a velocity.
Rotates a vector in place using the current transformation as frame of reference, without applying translation. Use this to transform, for example, a velocity.
# --------------------------------------
- def_name: get_forward_vector
return: carla.Vector3D
Expand Down
4 changes: 0 additions & 4 deletions PythonAPI/docs/sensor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@
- [V2X sensor](ref_sensors.md#v2x-sensor)
# - PROPERTIES -------------------------
instance_variables:
- var_name: is_listening
type: boolean
doc: >
When **True** the sensor will be waiting for data.
# - METHODS ----------------------------
methods:
- def_name: listen
Expand Down
2 changes: 1 addition & 1 deletion PythonAPI/docs/sensor_data.yml
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@
- class_name: GBufferTextureID
# - DESCRIPTION ------------------------
doc: >
Defines the of each GBuffer texture (See the method `carla.Sensor.listen_to_gbuffer`).
Defines the identifiers of each GBuffer texture (See the method carla.Sensor.listen_to_gbuffer).
# - PROPERTIES -------------------------
instance_variables:
- var_name: SceneColor
Expand Down
5 changes: 5 additions & 0 deletions PythonAPI/docs/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
type: int
doc: >
Simulation frame in which the snapshot was taken.
- var_name: elapsed_seconds
type: float
var_units: seconds
doc: >
Simulated seconds elapsed since the beginning of the current episode.
- var_name: timestamp
type: carla.Timestamp
var_units: seconds
Expand Down
2 changes: 1 addition & 1 deletion PythonAPI/docs/weather.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# - DESCRIPTION ------------------------
doc: >
This class defines objects containing lighting and weather specifications that can later be applied in carla.World. So far, these conditions only intervene with [sensor.camera.rgb](ref_sensors.md#rgb-camera). 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).
Each of these parameters acts independently 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
Expand Down
22 changes: 11 additions & 11 deletions PythonAPI/docs/world.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@
doc: >
Defines wether to use deterministic physics for pedestrian death animations or physical ragdoll simulation.
When enabled, pedestrians have less realistic death animation but ensures determinism.
When disabled, pedestrians are simulated as ragdolls with more realistic simulation and collision but no determinsm can be ensured.
When disabled, pedestrians are simulated as ragdolls with more realistic simulation and collision but no determinism can be ensured.
- var_name: tile_stream_distance
type: float
doc: >
Expand Down Expand Up @@ -460,7 +460,7 @@
- var_name: id
type: int
doc: >
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.
The ID of the episode associated with this world. Episodes are different sessions of a simulation. These change every time a world is disabled or reloaded. Keeping track is useful to avoid possible issues.
- var_name: debug
type: carla.DebugHelper
doc: >
Expand All @@ -485,7 +485,7 @@
doc: >
Function with a snapshot as compulsory parameter that will be called when the client receives a tick.
doc: >
This method is used in [__asynchronous__ mode](https://carla.readthedocs.io/en/latest/adv_synchrony_timestep/). It starts callbacks from the client for the function defined as `callback`, and returns the ID of the callback. The function will be called everytime the server ticks. It requires a carla.WorldSnapshot as argument, which can be retrieved from __<font color="#7fb800">wait_for_tick()</font>__. Use __<font color="#7fb800">remove_on_tick()</font>__ to stop the callbacks.
This method is used in [__asynchronous__ mode](https://carla.readthedocs.io/en/latest/adv_synchrony_timestep/). It starts callbacks from the client for the function defined as `callback`, and returns the ID of the callback. The function will be called every time the server ticks. It requires a carla.WorldSnapshot as argument, which can be retrieved from __<font color="#7fb800">wait_for_tick()</font>__. Use __<font color="#7fb800">remove_on_tick()</font>__ to stop the callbacks.
# --------------------------------------
- def_name: remove_on_tick
params:
Expand Down Expand Up @@ -538,7 +538,7 @@
default: None
doc: >
The parent object that the spawned actor will follow around.
- param_name: attachment
- param_name: attachment_type
type: carla.AttachmentType
default: Rigid
doc: >
Expand All @@ -562,7 +562,7 @@
default: None
doc: >
The parent object that the spawned actor will follow around.
- param_name: attachment
- param_name: attachment_type
type: carla.AttachmentType
default: Rigid
doc: >
Expand Down Expand Up @@ -744,7 +744,7 @@
doc: >
New conditions to be applied.
doc: >
Changes the weather parameteres ruling the simulation to another ones defined in an object.
Changes the weather parameters ruling the simulation to another ones defined in an object.
# --------------------------------------
- def_name: cast_ray
return: list(carla.LabelledPoint)
Expand Down Expand Up @@ -831,7 +831,7 @@
Sets the seed to use for any random number generated in relation to pedestrians.
note: >
Should be set before pedestrians are spawned.
If you want to repeat the same exact bodies (blueprint) for each pedestrian, then use the same seed in the Python code (where the blueprint is choosen randomly) and here, otherwise the pedestrians will repeat the same paths but the bodies will be different.
If you want to repeat the same exact bodies (blueprint) for each pedestrian, then use the same seed in the Python code (where the blueprint is chosen randomly) and here, otherwise the pedestrians will repeat the same paths but the bodies will be different.
# --------------------------------------
- def_name: apply_color_texture_to_object
params:
Expand All @@ -842,7 +842,7 @@
- param_name: texture
type: TextureColor
doc: >
Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`.
Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`.
# --------------------------------------
- def_name: apply_float_color_texture_to_object
params:
Expand All @@ -853,7 +853,7 @@
- param_name: texture
type: TextureFloatColor
doc: >
Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`.
Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to `object_name`.
# --------------------------------------
- def_name: apply_textures_to_object
params:
Expand All @@ -879,7 +879,7 @@
- param_name: texture
type: TextureColor
doc: >
Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`.
Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`.
# --------------------------------------
- def_name: apply_float_color_texture_to_objects
params:
Expand All @@ -890,7 +890,7 @@
- param_name: texture
type: TextureFloatColor
doc: >
Applies a `texture` object in the field corresponfing to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`.
Applies a `texture` object in the field corresponding to `material_parameter` (normal, diffuse, etc) to the object in the scene corresponding to all objects in `objects_name_list`.
# --------------------------------------
- def_name: apply_textures_to_objects
params:
Expand Down
6 changes: 3 additions & 3 deletions PythonAPI/examples/V2XDemo.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,11 +685,11 @@ def __init__(self, width, height):
self._show_ackermann_info = False
self._ackermann_control = carla.VehicleAckermannControl()

def on_world_tick(self, timestamp):
def on_world_tick(self, world_snapshot):
self._server_clock.tick()
self.server_fps = self._server_clock.get_fps()
self.frame = timestamp.frame
self.simulation_time = timestamp.elapsed_seconds
self.frame = world_snapshot.frame
self.simulation_time = world_snapshot.elapsed_seconds

def tick(self, world, clock):
self._notifications.tick(world, clock)
Expand Down
8 changes: 4 additions & 4 deletions PythonAPI/examples/automatic_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,12 +282,12 @@ def __init__(self, width, height):
self._info_text = []
self._server_clock = pygame.time.Clock()

def on_world_tick(self, timestamp):
"""Gets informations from the world at every tick"""
def on_world_tick(self, world_snapshot):
"""Gets information from the world at every tick"""
self._server_clock.tick()
self.server_fps = self._server_clock.get_fps()
self.frame = timestamp.frame_count
self.simulation_time = timestamp.elapsed_seconds
self.frame = world_snapshot.frame
self.simulation_time = world_snapshot.elapsed_seconds

def tick(self, world, clock):
"""HUD method for every tick"""
Expand Down
Loading