sergi-e/p098-api (#2638)

* Python API iteration p098

* New order enum

* Fixed order getters setters

* New python api md

* New iteration, dunder coded

* PythonAPI/docs/doc_gen.py

* fix method_name
This commit is contained in:
sergi.e 2020-03-30 11:18:13 +02:00 committed by GitHub
parent 35c346c170
commit 239c4c5acd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 1113 additions and 1121 deletions

File diff suppressed because it is too large Load Diff

View File

@ -31,11 +31,6 @@
# - METHODS ----------------------------
methods:
- def_name: __str__
return: str
doc: >
Parses a summary of this actor's information to string.
# --------------------------------------
- def_name: add_impulse
params:
- param_name: impulse
@ -116,6 +111,8 @@
doc: >
Sets the actor's velocity vector.
# --------------------------------------
- def_name: __str__
# --------------------------------------
- class_name: VehicleLightState
# - DESCRIPTION ------------------------
doc: >
@ -148,6 +145,7 @@
- var_name: All
doc: >
All lights on
- class_name: Vehicle
parent: carla.Actor
# - DESCRIPTION ------------------------
@ -161,20 +159,6 @@
The vehicle's collider volume.
# - METHODS ----------------------------
methods:
- def_name: get_light_state
return: carla.VehicleLightState
doc: >
Returns a flag representing the vehicle light state,
this represents which lights are active or not
# --------------------------------------
- def_name: set_light_state
params:
- param_name: light_state
type: carla.VehicleLightState
doc: >
Sets the light state of a vehicle using a VehicleLightState flag,
this represents which lights are active or not
# --------------------------------------
- def_name: apply_control
params:
- param_name: control
@ -189,11 +173,22 @@
doc: >
Applies a physics control object in the next tick containing the parameters that define the vehicle as a corporeal body. E.g.: moment of inertia, mass, drag coefficient and many more.
# --------------------------------------
- def_name: is_at_traffic_light
return: bool
doc: >
Vehicles will be affected by a traffic light when the light is red and the vehicle is inside its bounding box. The client returns whether a traffic light is affecting this vehicle according to last tick (it does not call the simulator).
# --------------------------------------
- def_name: get_control
return: carla.VehicleControl
doc: >
The client returns the control applied in the last tick. The method does not call the simulator.
# --------------------------------------
- def_name: get_light_state
return: carla.VehicleLightState
doc: >
Returns a flag representing the vehicle light state,
this represents which lights are active or not
# --------------------------------------
- def_name: get_physics_control
return: carla.VehiclePhysicsControl
doc: >
@ -216,11 +211,6 @@
The client returns the state of the traffic light affecting this vehicle according to last tick. The method does not call the simulator.
If no traffic light is currently affecting the vehicle, returns <b>green</b>.
# --------------------------------------
- def_name: is_at_traffic_light
return: bool
doc: >
Vehicles will be affected by a traffic light when the light is red and the vehicle is inside its bounding box. The client returns whether a traffic light is affecting this vehicle according to last tick (it does not call the simulator).
# --------------------------------------
- def_name: set_autopilot
params:
- param_name: enabled
@ -229,8 +219,15 @@
doc: >
Turns on/off this vehicle's server-side autopilot. When autopilot mode is on, the vehicle will be conducted by the traffic manager client-side.
# --------------------------------------
- def_name: set_light_state
params:
- param_name: light_state
type: carla.VehicleLightState
doc: >
Sets the light state of a vehicle using a VehicleLightState flag,
this represents which lights are active or not
# --------------------------------------
- def_name: __str__
return: str
# --------------------------------------
- class_name: Walker
@ -266,7 +263,6 @@
The client returns the control applied to this walker during last tick. The method does not call the simulator.
# --------------------------------------
- def_name: __str__
return: str
# --------------------------------------
- class_name: WalkerAIController
@ -276,6 +272,13 @@
Class that conducts AI control for a walker. The controllers are defined as actors, but they are quite different from the rest. They need to be attached to a parent actor during their creation, which is the walker they will be controlling (take a look at carla.World if you are yet to learn on how to spawn actors). They also need for a special blueprint (already defined in carla.BlueprintLibrary as "controller.ai.walker"). This is an empty blueprint, as the AI controller will be invisible in the simulation but will follow its parent around to dictate every step of the way.
# - METHODS ----------------------------
methods:
- def_name: go_to_location
params:
- param_name: destination
type: carla.Location
doc: >
Sets the destination that the pedestrian will reach.
# --------------------------------------
- def_name: start
doc: >
Enables AI control for its parent walker.
@ -284,13 +287,6 @@
doc: >
Disables AI control for its parent walker.
# --------------------------------------
- def_name: go_to_location
params:
- param_name: destination
type: carla.Location
doc: >
Sets the destination that the pedestrian will reach.
# --------------------------------------
- def_name: set_max_speed
params:
- param_name: speed
@ -322,9 +318,9 @@
All possible states for traffic lights. These can either change at a specific time step or be changed manually. Take a look at this [recipe](ref_code_recipes.md#traffic-lights-recipe) to see an example.
# - PROPERTIES -------------------------
instance_variables:
- var_name: Green
- var_name: Red
- var_name: Yellow
- var_name: Green
- var_name: 'Off'
- var_name: Unknown
# --------------------------------------
@ -356,10 +352,10 @@
doc: >
The client returns <b>True</b> if a traffic light is frozen according to last tick. The method does not call the simulator.
# --------------------------------------
- def_name: get_pole_index
return: int
- def_name: get_elapsed_time
return: float
doc: >
Returns the index of the pole that identifies it as part of the traffic light group of a junction.
The client returns the time in seconds since current light state started according to last tick. The method does not call the simulator.
# --------------------------------------
- def_name: get_group_traffic_lights
return: list(carla.TrafficLight)
@ -368,10 +364,10 @@
note: >
This function calls the simulator.
# --------------------------------------
- def_name: get_elapsed_time
return: float
- def_name: get_pole_index
return: int
doc: >
The client returns the time in seconds since current light state started according to last tick. The method does not call the simulator.
Returns the index of the pole that identifies it as part of the traffic light group of a junction.
# --------------------------------------
- def_name: get_state
return: carla.TrafficLightState

View File

@ -1,6 +1,6 @@
---
- module_name: carla
doc: >
# - CLASSES ------------------------------
classes:
- class_name: ActorAttributeType
@ -12,8 +12,8 @@
- var_name: Bool
- var_name: Int
- var_name: Float
- var_name: RGBColor
- var_name: String
- var_name: RGBColor
- class_name: Color
# - DESCRIPTION ------------------------
@ -79,18 +79,18 @@
type: str
doc: >
The attribute's name and identifier in the library.
- var_name: type
type: carla.ActorAttributeType
doc: >
The attribute's parameter type.
- var_name: recommended_values
type: list(str)
doc: >
A list of values suggested by those who designed the blueprint.
- var_name: is_modifiable
type: bool
doc: >
It is <b>True</b> if the attribute's value can be modified.
- var_name: recommended_values
type: list(str)
doc: >
A list of values suggested by those who designed the blueprint.
- var_name: type
type: carla.ActorAttributeType
doc: >
The attribute's parameter type.
# - METHODS ----------------------------
methods:
- def_name: as_bool
@ -101,33 +101,25 @@
doc: >
Reads the attribute as carla.Color.
# --------------------------------------
- def_name: as_int
doc: >
Reads the attribute as int.
# --------------------------------------
- def_name: as_float
doc: >
Reads the attribute as float.
# --------------------------------------
- def_name: as_int
doc: >
Reads the attribute as int.
# --------------------------------------
- def_name: as_str
doc: >
Reads the attribute as string.
# --------------------------------------
- def_name: __bool__
doc: >
Internal method to manage the attribute as bool.
# --------------------------------------
- def_name: __int__
doc: >
Internal method to manage the attribute as int.
# --------------------------------------
- def_name: __float__
doc: >
Internal method to manage the attribute as float.
# --------------------------------------
- def_name: __int__
# --------------------------------------
- def_name: __str__
doc: >
Parses the attribute ID and its value to string.
# --------------------------------------
- def_name: __eq__
return: bool
@ -167,18 +159,6 @@
A list of tags each blueprint has that helps describing them. E.g. `['0001', 'pedestrian', 'walker']`.
# - METHODS ----------------------------
methods:
- def_name: __iter__
doc: >
Allows iteration within this class.
# --------------------------------------
- def_name: __len__
doc: >
Returns the amount of attributes for this blueprint.
# --------------------------------------
- def_name: __str__
doc: >
Parses the information of this blueprint to string.
# --------------------------------------
- def_name: has_attribute
return: bool
params:
@ -229,6 +209,16 @@
doc: >
If the `id` attribute is modifiable, changes its value to `value`.
# --------------------------------------
- def_name: __iter__
doc: >
Allows iteration within this class' attributes.
# --------------------------------------
- def_name: __len__
doc: >
Returns the amount of attributes for this blueprint.
# --------------------------------------
- def_name: __str__
# --------------------------------------
- class_name: BlueprintLibrary
# - DESCRIPTION ------------------------
@ -238,28 +228,6 @@
[Here](bp_library.md) is a reference containing every available blueprint and its specifics.
# - METHODS ----------------------------
methods:
- def_name: __getitem__
params:
- param_name: pos
type: int
return: carla.ActorBlueprint
doc: >
Returns the blueprint stored in `pos` position inside the data structure containing them.
# --------------------------------------
- def_name: __iter__
doc: >
Method that allows iteration of this class.
# --------------------------------------
- def_name: __len__
return: int
doc: >
Returns the amount of blueprints comprising the library.
# --------------------------------------
- def_name: __str__
return: string
doc: >
Parses the identifiers for every blueprint to string.
# --------------------------------------
- def_name: filter
params:
- param_name: wildcard_pattern
@ -276,4 +244,26 @@
doc: >
Returns the blueprint corresponding to that identifier.
# --------------------------------------
- def_name: __getitem__
params:
- param_name: pos
type: int
return: carla.ActorBlueprint
doc: >
Returns the blueprint stored in `pos` position inside the data structure containing them.
# --------------------------------------
- def_name: __iter__
doc: >
Method that allows iteration within the blueprints provided.
# --------------------------------------
- def_name: __len__
return: int
doc: >
Returns the amount of blueprints comprising the library.
# --------------------------------------
- def_name: __str__
return: string
doc: >
Parses the identifiers for every blueprint to string.
# --------------------------------------
...

View File

@ -40,17 +40,7 @@
- param_name: commands
type: list
doc: >
A list of commands to execute in batch. Each command is different and has its own parameters. These are supported so far:
[SpawnActor](#command.SpawnActor)
[DestroyActor](#command.DestroyActor)
[ApplyVehicleControl](#command.ApplyVehicleControl)
[ApplyWalkerControl](#command.ApplyWalkerControl)
[ApplyTransform](#command.ApplyTransform)
[ApplyVelocity](#command.ApplyVelocity)
[ApplyAngularVelocity](#command.ApplyAngularVelocity)
[ApplyImpulse](#command.ApplyImpulse)
[SetSimulatePhysics](#command.SetSimulatePhysics)
[SetAutopilot](#command.SetAutopilot)
A list of commands to execute in batch. Each command is different and has its own parameters. They appear listed at the bottom of this page.
doc: >
Executes a list of commands on a single simulation step and retrieves no information. If you need information about the response of each command, use the **<font color="#7fb800">apply_batch_sync()</font>** function right below this one.
[Here](https://github.com/carla-simulator/carla/blob/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L126) is an example on how to delete the actors that appear in carla.ActorList all at once.
@ -70,36 +60,16 @@
doc: >
Executes a list of commands on a single simulation step, blocks until the commands are linked, and returns a list of <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/10c5f6a482a21abfd00220c68c7f12b4110b7f63/PythonAPI/examples/spawn_npc.py#L112-L116) is an example of it being used to spawn actors.
# --------------------------------------
- def_name: get_available_maps
- def_name: generate_opendrive_world
params:
return: list(str)
- param_name: opendrive
type: str
doc: >
Content of an OpenDRIVE file as `string`.
doc: >
Returns a list of strings containing the paths of the maps available on server. These paths are dynamic, they will be created during the simulation and so you will not find them when looking up in your files. One of the possible returns for this method would be:
['/Game/Carla/Maps/Town01',
'/Game/Carla/Maps/Town02',
'/Game/Carla/Maps/Town03',
'/Game/Carla/Maps/Town04',
'/Game/Carla/Maps/Town05',
'/Game/Carla/Maps/Town06',
'/Game/Carla/Maps/Town07']
# --------------------------------------
- def_name: get_client_version
params:
return: str
doc: >
Returns the client libcarla version by consulting it in the "Version.h" file. Both client and server can use different libcarla versions but some issues may arise regarding unexpected incompatibilities.
# --------------------------------------
- def_name: get_server_version
params:
return: str
doc: >
Returns the server libcarla version by consulting it in the "Version.h" file. Both client and server should use the same libcarla version.
# --------------------------------------
- def_name: get_world
params:
return: carla.World
doc: >
Returns the world object currently active in the simulation. This world will be later used for example to load maps.
Loads a new world with a basic 3D topology generated from the content of an OpenDRIVE file. This content is passed as a `string` parameter.
It is similar to `client.load_world(map_name)` but allows for custom OpenDRIVE maps in server side.
Cars can drive around the map, but there are no graphics besides the road and sidewalks.
# --------------------------------------
- def_name: load_world
params:
@ -111,17 +81,6 @@
doc: >
Creates a new world with default settings using `map_name` map. All actors in the current world will be destroyed.
# --------------------------------------
- def_name: get_trafficmanager
params:
- param_name: client_connection
type: int
default: 8000
doc: >
Port that will be used by the traffic manager. Default is `8000`.
return: carla.TrafficManager
doc: >
Returns an instance of the traffic manager related to the specified port. If it does not exist, this will be created.
# --------------------------------------
- def_name: reload_world
params:
raises: RuntimeError when corresponding.
@ -152,36 +111,6 @@
Load a new world with default settings using `map_name` map. All actors
present in the current world will be destroyed, __but__ traffic manager instances will stay alive.
# --------------------------------------
- def_name: generate_opendrive_world
params:
- param_name: opendrive
type: str
doc: >
Content of an OpenDRIVE file as `string`.
doc: >
Loads a new world with a basic 3D topology generated from the content of an OpenDRIVE file. This content is passed as a `string` parameter.
It is similar to `client.load_world(map_name)` but allows for custom OpenDRIVE maps in server side.
Cars can drive around the map, but there are no graphics besides the road and sidewalks.
# --------------------------------------
- def_name: set_replayer_time_factor
params:
- param_name: time_factor
type: float
default: 1.0
doc: >
1.0 means normal time speed. Greater than 1.0 means fast motion (2.0 would be double speed) and lesser means slow motion (0.5 would be half speed).
doc: >
When used, the time speed of the reenacted simulation is modified at will. It can be used several times while a playback is in curse.
# --------------------------------------
- def_name: set_timeout
params:
- param_name: seconds
type: float
doc: >
New timeout value in seconds. Default is 5 seconds.
doc: >
Sets in seconds the maxixum time a network call is allowed before blocking it and raising a timeout exceeded error.
# --------------------------------------
- def_name: show_recorder_actors_blocked
params:
- param_name: filename
@ -256,16 +185,121 @@
doc: >
Stops the recording in progress. If you specified a path in `filename`, the recording will be there. If not, look inside `CarlaUE4/Saved/`.
# --------------------------------------
- def_name: get_available_maps
params:
return: list(str)
doc: >
Returns a list of strings containing the paths of the maps available on server. These paths are dynamic, they will be created during the simulation and so you will not find them when looking up in your files. One of the possible returns for this method would be:
['/Game/Carla/Maps/Town01',
'/Game/Carla/Maps/Town02',
'/Game/Carla/Maps/Town03',
'/Game/Carla/Maps/Town04',
'/Game/Carla/Maps/Town05',
'/Game/Carla/Maps/Town06',
'/Game/Carla/Maps/Town07']
# --------------------------------------
- def_name: get_client_version
params:
return: str
doc: >
Returns the client libcarla version by consulting it in the "Version.h" file. Both client and server can use different libcarla versions but some issues may arise regarding unexpected incompatibilities.
# --------------------------------------
- def_name: get_server_version
params:
return: str
doc: >
Returns the server libcarla version by consulting it in the "Version.h" file. Both client and server should use the same libcarla version.
# --------------------------------------
- def_name: get_trafficmanager
params:
- param_name: client_connection
type: int
default: 8000
doc: >
Port that will be used by the traffic manager. Default is `8000`.
return: carla.TrafficManager
doc: >
Returns an instance of the traffic manager related to the specified port. If it does not exist, this will be created.
# --------------------------------------
- def_name: get_world
params:
return: carla.World
doc: >
Returns the world object currently active in the simulation. This world will be later used for example to load maps.
# --------------------------------------
- def_name: set_replayer_time_factor
params:
- param_name: time_factor
type: float
default: 1.0
doc: >
1.0 means normal time speed. Greater than 1.0 means fast motion (2.0 would be double speed) and lesser means slow motion (0.5 would be half speed).
doc: >
When used, the time speed of the reenacted simulation is modified at will. It can be used several times while a playback is in curse.
# --------------------------------------
- def_name: set_timeout
params:
- param_name: seconds
type: float
doc: >
New timeout value in seconds. Default is 5 seconds.
doc: >
Sets in seconds the maxixum time a network call is allowed before blocking it and raising a timeout exceeded error.
# --------------------------------------
- class_name: TrafficManager
# - DESCRIPTION ------------------------
doc: >
The traffic manager is a module built on top of the CARLA API in C++. It handles any group of vehicles set to autopilot mode to populate the simulation with realistic urban traffic conditions and give the chance to user to customize some behaviours. The architecture of the traffic manager is divided in five different goal-oriented stages and a PID controller where the information flows until eventually, a carla.VehicleControl is applied to every vehicle registered in a traffic manager.
In order to learn more, visit the [documentation](../traffic_manager) regarding this module.
In order to learn more, visit the [documentation](adv_traffic_manager.md) regarding this module.
# - PROPERTIES -------------------------
instance_variables:
# - METHODS ----------------------------
methods:
- def_name: auto_lane_change
params:
- param_name: actor
type: carla.Actor
doc: >
The vehicle whose settings are changed.
- param_name: enable
type: bool
doc: >
__True__ is default and enables lane changes. __False__ will disable them.
doc: >
Turns on or off lane changing behaviour for a vehicle.
# --------------------------------------
- def_name: collision_detection
params:
- param_name: reference_actor
type: carla.Actor
doc: >
Vehicle that is going to ignore collisions.
- param_name: other_actor
type: carla.Actor
doc: >
The actor that `reference_actor` is going to ignore collisions with.
- param_name: detect_collision
type: bool
doc: >
__True__ is default and enables collisions. __False will disable them.
doc: >
Tunes on/off collisions between a vehicle and another specific actor. In order to ignore all other vehicles, traffic lights or walkers, use the specific __ignore__ methods described in this same section.
# --------------------------------------
- def_name: distance_to_leading_vehicle
params:
- param_name: actor
type: carla.Actor
doc: >
Vehicle whose minimum distance is being changed.
- param_name: distance
type: float
doc: >
Meters between both vehicles.
doc: >
Sets the minimum distance in meters that a vehicle has to keep with the others. The distance is in meters and will affect the minimum moving distance. It is computed from front to back of the vehicle objects.
# --------------------------------------
- def_name: force_lane_change
params:
- param_name: actor
@ -279,6 +313,39 @@
doc: >
Forces a vehicle to change either to the lane on its left or right, if existing, as indicated in `direction`. This method applies the lane change no matter what, disregarding possible collisions.
# --------------------------------------
- def_name: global_distance_to_leading_vehicle
params:
- param_name: distance
type: float
doc: >
Meters between vehicles.
doc: >
Sets the minimum distance in meters that vehicles have to keep with the rest. The distance is in meters and will affect the minimum moving distance. It is computed from center to center of the vehicle objects.
# --------------------------------------
- def_name: global_percentage_speed_difference
params:
- param_name: percentage
type: float
doc: >
Percentage difference between intended speed and the current limit.
doc: >
Sets the difference the vehicle's intended speed and its current speed limit. Speed limits can be exceeded by setting the `perc` to a negative value.
Default is 30. Exceeding a speed limit can be done using negative percentages.
# --------------------------------------
- def_name: ignore_lights_percentage
params:
- param_name: actor
type: carla.Actor
doc: >
The actor that is going to ignore traffic lights.
- param_name: perc
type: float
doc: >
Between 0 and 100. Amount of times traffic lights will be ignored.
doc: >
During the traffic light stage, which runs every frame, this method sets the percent chance that traffic lights will be ignored for a vehicle.
# --------------------------------------
- def_name: ignore_vehicles_percentage
params:
- param_name: actor
@ -305,86 +372,10 @@
doc: >
During the collision detection stage, which runs every frame, this method sets a percent chance that collisions with walkers will be ignored for a vehicle.
# --------------------------------------
- def_name: ignore_lights_percentage
params:
- param_name: actor
type: carla.Actor
doc: >
The actor that is going to ignore traffic lights.
- param_name: perc
type: float
doc: >
Between 0 and 100. Amount of times traffic lights will be ignored.
doc: >
During the traffic light stage, which runs every frame, this method sets the percent chance that traffic lights will be ignored for a vehicle.
# --------------------------------------
- def_name: reset_traffic_lights
doc: >
Resets every traffic light in the map to its initial state.
# --------------------------------------
- def_name: auto_lane_change
params:
- param_name: actor
type: carla.Actor
doc: >
The vehicle whose settings are changed.
- param_name: enable
type: bool
doc: >
__True__ is default and enables lane changes. __False__ will disable them.
doc: >
Turns on or off lane changing behaviour for a vehicle.
# --------------------------------------
- def_name: distance_to_leading_vehicle
params:
- param_name: actor
type: carla.Actor
doc: >
Vehicle whose minimum distance is being changed.
- param_name: distance
type: float
doc: >
Meters between both vehicles.
doc: >
Sets the minimum distance in meters that a vehicle has to keep with the others. The distance is in meters and will affect the minimum moving distance. It is computed from front to back of the vehicle objects.
# --------------------------------------
- def_name: collision_detection
params:
- param_name: reference_actor
type: carla.Actor
doc: >
Vehicle that is going to ignore collisions.
- param_name: other_actor
type: carla.Actor
doc: >
The actor that `reference_actor` is going to ignore collisions with.
- param_name: detect_collision
type: bool
doc: >
__True__ is default and enables collisions. __False will disable them.
doc: >
Tunes on/off collisions between a vehicle and another specific actor. In order to ignore all other vehicles, traffic lights or walkers, use the specific __ignore__ methods described in this same section.
# --------------------------------------
- def_name: global_percentage_speed_difference
params:
- param_name: percentage
type: float
doc: >
Percentage difference between intended speed and the current limit.
doc: >
Sets the difference the vehicle's intended speed and its current speed limit. Speed limits can be exceeded by setting the `perc` to a negative value.
Default is 30. Exceeding a speed limit can be done using negative percentages.
# --------------------------------------
- def_name: global_distance_to_leading_vehicle
params:
- param_name: distance
type: float
doc: >
Meters between vehicles.
doc: >
Sets the minimum distance in meters that vehicles have to keep with the rest. The distance is in meters and will affect the minimum moving distance. It is computed from center to center of the vehicle objects.
# --------------------------------------
- def_name: vehicle_percentage_speed_difference
params:
- param_name: actor

View File

@ -1,6 +1,6 @@
---
- module_name: command
doc: >
classes:
- class_name: Response
# - DESCRIPTION ------------------------

View File

@ -1,6 +1,6 @@
---
- module_name: carla
doc: >
# - CLASSES ------------------------------
classes:
- class_name: VehicleControl
@ -59,13 +59,13 @@
default: 0.0
- param_name: hand_brake
type: bool
default: True
default: False
- param_name: reverse
type: bool
default: True
default: False
- param_name: manual_gear_shift
type: bool
default: True
default: False
- param_name: gear
type: int
default: 0
@ -74,6 +74,7 @@
params:
- param_name: other
type: carla.VehicleControl
# --------------------------------------
- def_name: __ne__
params:
- param_name: other

View File

@ -257,6 +257,42 @@ def gen_doc_method_def(method, is_indx=False, with_self=True):
param = param[:-2] # delete the last ', '
return join([method_name, parentheses(param)])
def gen_doc_dunder_def(dunder, is_indx=False, with_self=True):
"""Return python def as it should be written in docs"""
param = ''
dunder_name = dunder['def_name']
if valid_dic_val(dunder, 'static'):
with_self = False
# to correclty render methods like __init__ in md
if dunder_name[0] == '_':
dunder_name = '\\' + dunder_name
if is_indx:
dunder_name = bold(dunder_name)
else:
dunder_name = bold(color(COLOR_METHOD, dunder_name))
if with_self:
if not 'params' in dunder or dunder['params'] is None:
dunder['params'] = []
dunder['params'].insert(0, {'param_name': 'self'})
if valid_dic_val(dunder, 'params'):
for p in dunder['params']:
default = join(['=', str(p['type'])]) if 'type' in p else ''
if is_indx:
param = join([param, bold(p['param_name']), default, ', '])
else:
param = join([param, color(COLOR_PARAM, bold(p['param_name']) + create_hyperlinks(default)), ', '])
if with_self:
dunder['params'] = dunder['params'][1:]
if not dunder['params']: # if is empty delete it
del dunder['params']
param = param[:-2] # delete the last ', '
return join([dunder_name, parentheses(param)])
def gen_inst_var_indx(inst_var, class_key):
inst_var_name = inst_var['var_name']
@ -347,6 +383,38 @@ def add_doc_method(md, method, class_key):
md.list_pop()
def add_doc_dunder(md, dunder, class_key):
dunder_name = dunder['def_name']
dunder_key = join([class_key, dunder_name], '.')
dunder_def = gen_doc_dunder_def(dunder, False)
md.list_pushn(join([html_key(dunder_key), dunder_def]))
# Dunder doc
if valid_dic_val(dunder, 'doc'):
md.textn(create_hyperlinks(md.prettify_doc(dunder['doc'])))
# Return doc
if valid_dic_val(dunder, 'return'):
md.list_push(bold('Return:') + ' ')
md.textn(italic(create_hyperlinks(dunder['return'])))
md.list_pop()
md.list_pop()
def add_doc_dunder_param(md, param):
param_name = param['param_name']
param_type = ''
if valid_dic_val(param, 'type'):
param_type = create_hyperlinks(param['type'])
param_type = '' if not param_type else parentheses(italic(param_type))
md.list_push(code(param_name))
if param_type:
md.text(' ' + param_type)
md.new_line()
else:
md.new_line()
md.list_pop()
def add_doc_inst_var(md, inst_var, class_key):
var_name = inst_var['var_name']
@ -466,9 +534,21 @@ class Documentation:
add_doc_inst_var(md, inst_var, class_key)
# Generate method doc (if any)
if valid_dic_val(cl, 'methods'):
md.title_html(3, 'Methods')
method_list = list()
dunder_list = list()
for method in cl['methods']:
method_name = method['def_name']
if method_name[0] == '_' and method_name != '__init__':
dunder_list.append(method)
else:
method_list.append(method)
md.title_html(3, 'Methods')
for method in method_list:
add_doc_method(md, method, class_key)
if len(dunder_list)>0:
md.title_html(3, 'Dunder methods')
for method in dunder_list:
add_doc_dunder(md, method, class_key)
md.separator()
return md.data().strip()

View File

@ -30,29 +30,21 @@
params:
- param_name: other
type: carla.Vector2D
doc: >
Defines addition between 2D vectors and applies it to this.
# --------------------------------------
- def_name: __sub__
params:
- param_name: other
type: carla.Vector2D
doc: >
Defines substraction between 2D vectors and applies it to this.
# --------------------------------------
- def_name: __mul__
params:
- param_name: other
type: carla.Vector2D
doc: >
Defines multiplication between 2D vectors and applies it to this.
# --------------------------------------
- def_name: __truediv__
params:
- param_name: other
type: carla.Vector2D
doc: >
Defines division between 2D vectors and applies it to this.
# --------------------------------------
- def_name: __eq__
return: bool
@ -60,7 +52,7 @@
- param_name: other
type: carla.Vector2D
doc: >
Returns true if values for every axis are equal.
Returns __True__ if values for every axis are equal.
# --------------------------------------
- def_name: __ne__
return: bool
@ -68,7 +60,7 @@
- param_name: bool
type: carla.Vector2D
doc: >
Returns true if the value for any axis is different.
Returns __True__ if the value for any axis is different.
# --------------------------------------
- def_name: __str__
return: str
@ -112,29 +104,21 @@
params:
- param_name: other
type: carla.Vector3D
doc: >
Defines addition between 3D vectors and applies it to this.
# --------------------------------------
- def_name: __sub__
params:
- param_name: other
type: carla.Vector3D
doc: >
Defines substraction between 3D vectors and applies it to this.
# --------------------------------------
- def_name: __mul__
params:
- param_name: other
type: carla.Vector3D
doc: >
Defines multiplication between 3D vectors and applies it to this.
# --------------------------------------
- def_name: __truediv__
params:
- param_name: other
type: carla.Vector3D
doc: >
Defines division between 3D vectors and applies it to this.
# --------------------------------------
- def_name: __eq__
params:
@ -142,7 +126,7 @@
type: carla.Vector3D
return: bool
doc: >
Returns true if values for every axis are equal.
Returns __True__ if values for every axis are equal.
# --------------------------------------
- def_name: __ne__
params:
@ -150,7 +134,7 @@
type: carla.Vector3D
return: bool
doc: >
Returns true if the value for any axis is different.
Returns __True__ if the value for any axis is different.
# --------------------------------------
- def_name: __str__
return: str
@ -191,31 +175,6 @@
type: float
default: 0.0
# --------------------------------------
- def_name: __eq__
return: bool
params:
- param_name: other
type: carla.Location
doc: >
The other point to be compared with.
doc: >
Returns true if both locations are the same point in space.
# --------------------------------------
- def_name: __ne__
return: bool
params:
- param_name: other
type: carla.Location
doc: >
The other point to be compared with.
doc: >
Returns true if both locations are different points in space.
# --------------------------------------
- def_name: __str__
return: str
doc: >
Parses the axis' values to string.
# --------------------------------------
- def_name: distance
params:
- param_name: location
@ -226,6 +185,27 @@
doc: >
Returns Euclidean distance in meters from this location to another one.
# --------------------------------------
- def_name: __eq__
return: bool
params:
- param_name: other
type: carla.Location
doc: >
Returns __True__ if both locations are the same point in space.
# --------------------------------------
- def_name: __ne__
return: bool
params:
- param_name: other
type: carla.Location
doc: >
Returns __True__ if both locations are different points in space.
# --------------------------------------
- def_name: __str__
return: str
doc: >
Parses the axis' values to string.
# --------------------------------------
- class_name: Rotation
# - DESCRIPTION ------------------------
@ -280,20 +260,16 @@
params:
- param_name: other
type: carla.Rotation
doc: >
The other rotation to be compared with.
doc: >
Returns true if both rotations represent the same orientation of each axis.
Returns __True__ if both rotations represent the same orientation of each axis.
# --------------------------------------
- def_name: __ne__
params:
- param_name: other
type: carla.Rotation
doc: >
The other rotation to be compared with.
return: bool
doc: >
Returns true if both rotations represent the same orientation of each axis.
Returns __True__ if both rotations represent the same orientation for every axis.
# --------------------------------------
- def_name: __str__
doc: >
@ -323,32 +299,6 @@
- param_name: rotation
type: carla.Rotation
# --------------------------------------
- def_name: __eq__
return: bool
params:
- param_name: other
type: carla.Transform
doc: >
Returns true if both location and rotation are equal for this and `other`.
# --------------------------------------
- def_name: __ne__
return: bool
params:
- param_name: other
type: carla.Transform
doc: >
Returns true if any location and rotation are not equal for this and `other`.
# --------------------------------------
- def_name: __str__
return: str
doc: >
Parses both location and rotation to string.
# --------------------------------------
- def_name: get_forward_vector
return: carla.Vector3D
doc: >
Computes a forward vector using its rotation.
# --------------------------------------
- def_name: transform
params:
- param_name: in_point
@ -358,6 +308,32 @@
doc: >
Translates a 3D point from global to local coordinates using the current transformation as frame of reference.
# --------------------------------------
- def_name: get_forward_vector
return: carla.Vector3D
doc: >
Computes a forward vector using its rotation.
# --------------------------------------
- def_name: __eq__
return: bool
params:
- param_name: other
type: carla.Transform
doc: >
Returns __True__ if both location and rotation are equal for this and `other`.
# --------------------------------------
- def_name: __ne__
return: bool
params:
- param_name: other
type: carla.Transform
doc: >
Returns __True__ if any location and rotation are not equal for this and `other`.
# --------------------------------------
- def_name: __str__
return: str
doc: >
Parses both location and rotation to string.
# --------------------------------------
- class_name: BoundingBox
# - DESCRIPTION ------------------------
@ -365,16 +341,16 @@
Helper class defining a box location and its dimensions that will later be used by carla.DebugHelper or a carla.Client to draw shapes and detect collisions. Bounding boxes normally act for object colliders. Check out this [recipe](ref_code_recipes.md#debug-bounding-box-recipe) where the user takes a snapshot of the world and then proceeds to draw bounding boxes for traffic lights.
# - PROPERTIES -------------------------
instance_variables:
- var_name: location
type: carla.Location
doc: >
The center of the bounding box relative to its parent actor.
- var_name: extent
type: carla.Vector3D
doc: >
Vector from the center of the box to one vertex. The value in each axis equals half the size of the box for that axis.
`extent.x * 2` would return the size of the box in the X-axis.
- var_name: location
type: carla.Location
doc: >
The center of the bounding box relative to its parent actor.
# - METHODS ----------------------------
methods:
- def_name: __init__
@ -482,6 +458,5 @@
type: carla.GeoLocation
# --------------------------------------
- def_name: __str__
params:
# --------------------------------------
...

View File

@ -1,6 +1,5 @@
---
- module_name: carla
doc: >
# - CLASSES ------------------------------
classes:
- class_name: LaneType
@ -11,46 +10,46 @@
instance_variables:
- var_name: NONE
doc: >
- var_name: Bidirectional
doc: >
- var_name: Biking
doc: >
- var_name: Border
doc: >
- var_name: Driving
doc: >
- var_name: Entry
doc: >
- var_name: Exit
doc: >
- var_name: Median
doc: >
- var_name: OffRamp
doc: >
- var_name: OnRamp
doc: >
- var_name: Parking
doc: >
- var_name: Rail
doc: >
- var_name: Restricted
doc: >
- var_name: RoadWorks
- var_name: Stop
doc: >
- var_name: Shoulder
doc: >
- var_name: Biking
doc: >
- var_name: Sidewalk
doc: >
- var_name: Border
doc: >
- var_name: Restricted
doc: >
- var_name: Parking
doc: >
- var_name: Bidirectional
doc: >
- var_name: Median
doc: >
- var_name: Special1
doc: >
- var_name: Special2
doc: >
- var_name: Special3
doc: >
- var_name: Stop
- var_name: RoadWorks
doc: >
- var_name: Tram
doc: >
- var_name: Rail
doc: >
- var_name: Entry
doc: >
- var_name: Exit
doc: >
- var_name: OffRamp
doc: >
- var_name: OnRamp
doc: >
- var_name: Any
doc: >
Every type except for NONE.
@ -64,15 +63,15 @@
- var_name: NONE
doc: >
Traffic rules do not allow turning right or left, only going straight.
- var_name: Both
doc: >
Traffic rules allow turning either right or left.
- var_name: Left
doc: >
Traffic rules allow turning left.
- var_name: Right
doc: >
Traffic rules allow turning right.
- var_name: Left
doc: >
Traffic rules allow turning left.
- var_name: Both
doc: >
Traffic rules allow turning either right or left.
- class_name: LaneMarkingColor
# - DESCRIPTION ------------------------
@ -106,25 +105,25 @@
instance_variables:
- var_name: NONE
doc: >
- var_name: BottsDots
- var_name: Other
doc: >
- var_name: Broken
doc: >
- var_name: BrokenBroken
doc: >
- var_name: BrokenSolid
doc: >
- var_name: Curb
doc: >
- var_name: Grass
doc: >
- var_name: Solid
doc: >
- var_name: SolidBroken
doc: >
- var_name: SolidSolid
doc: >
- var_name: Other
- var_name: SolidBroken
doc: >
- var_name: BrokenSolid
doc: >
- var_name: BrokenBroken
doc: >
- var_name: BottsDots
doc: >
- var_name: Grass
doc: >
- var_name: Curb
doc: >
- class_name: Map
@ -163,6 +162,27 @@
doc: >
Returns a list of waypoints with a certain distance between them for every lane and centered inside of it. Waypoints are not listed in any particular order. Remember that waypoints closer than 2cm within the same road, section and lane will have the same identificator.
# --------------------------------------
- def_name: save_to_disk
params:
- param_name: path
doc: >
Path where the file will be saved.
doc: >
Saves the .xodr OpenDRIVE file of the current map to disk.
# --------------------------------------
- def_name: to_opendrive
doc: >
Returns the .xodr OpenDRIVe file of the current map as string.
return: str
# --------------------------------------
- def_name: transform_to_geolocation
params:
- param_name: location
type: carla.Location
return: carla.GeoLocation
doc: >
Converts a given `location`, a point in the simulation, to a carla.GeoLocation, which represents world coordinates. The geographical location of the map is defined inside OpenDRIVE within the tag <b><georeference></b>.
# --------------------------------------
- def_name: get_spawn_points
return: list(carla.Transform)
doc: >
@ -212,27 +232,6 @@
Specify the length from the road start
return: carla.Waypoint
# --------------------------------------
- def_name: save_to_disk
params:
- param_name: path
doc: >
Path where the file will be saved.
doc: >
Saves the .xodr OpenDRIVE file of the current map to disk.
# --------------------------------------
- def_name: to_opendrive
doc: >
Returns the .xodr OpenDRIVe file of the current map as string.
return: str
# --------------------------------------
- def_name: transform_to_geolocation
params:
- param_name: location
type: carla.Location
return: carla.GeoLocation
doc: >
Converts a given `location`, a point in the simulation, to a carla.GeoLocation, which represents world coordinates. The geographical location of the map is defined inside OpenDRIVE within the tag <b><georeference></b>.
# --------------------------------------
- def_name: __str__
# --------------------------------------
@ -316,20 +315,6 @@
The left lane marking information based on the direction of the Waypoint.
# - METHODS ----------------------------
methods:
- def_name: get_left_lane
return: carla.Waypoint
doc: >
Generates a Waypoint at the center of the left lane based on the direction of the current Waypoint, taking into account if the lane change is allowed in this location.
Will return <b>None</b> if the lane does not exist
# --------------------------------------
- def_name: get_right_lane
return: carla.Waypoint
doc: >
Generates a waypoint at the center of the right lane based on the direction of the current waypoint, taking into account if the lane change is allowed in this location.
Will return <b>None</b> if the lane does not exist.
# --------------------------------------
- def_name: next
params:
- param_name: distance
@ -408,6 +393,20 @@
doc: >
Returns a list of landmarks in the road of a specified type from the current waypoint until the specified distance.
# --------------------------------------
- def_name: get_left_lane
return: carla.Waypoint
doc: >
Generates a Waypoint at the center of the left lane based on the direction of the current Waypoint, taking into account if the lane change is allowed in this location.
Will return <b>None</b> if the lane does not exist
# --------------------------------------
- def_name: get_right_lane
return: carla.Waypoint
doc: >
Generates a waypoint at the center of the right lane based on the direction of the current waypoint, taking into account if the lane change is allowed in this location.
Will return <b>None</b> if the lane does not exist.
# --------------------------------------
- def_name: __str__
# --------------------------------------

View File

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

View File

@ -53,7 +53,7 @@
parent: carla.SensorData
# - DESCRIPTION ------------------------
doc: >
Class that defines an image of 32-bit BGRA colors that will be used as initial data retrieved by camera sensors. There are different camera sensors (currently three, RGB, depth and semantic segmentation) and each of these makes different use for the images. Learn more about them [here](/cameras_and_sensors/).
Class that defines an image of 32-bit BGRA colors that will be used as initial data retrieved by camera sensors. There are different camera sensors (currently three, RGB, depth and semantic segmentation) and each of these makes different use for the images. Learn more about them [here](ref_sensors.md).
# - PROPERTIES -------------------------
instance_variables:
- var_name: fov
@ -93,15 +93,15 @@
doc: >
Saves the image to disk using a converter pattern stated as `color_converter`. The default conversion pattern is <b>Raw</b> that will make no changes to the image.
# --------------------------------------
- def_name: __len__
# --------------------------------------
- def_name: __iter__
# --------------------------------------
- def_name: __getitem__
params:
- param_name: pos
type: int
# --------------------------------------
- def_name: __iter__
# --------------------------------------
- def_name: __len__
# --------------------------------------
- def_name: __setitem__
params:
- param_name: pos
@ -116,7 +116,7 @@
parent: carla.SensorData
# - DESCRIPTION ------------------------
doc: >
Class that defines the lidar data retrieved by a <b>sensor.lidar.ray_cast</b>. This essentially simulates a rotating lidar using ray-casting. Learn more about this [here](/cameras_and_sensors/#sensorlidarray_cast).
Class that defines the lidar data retrieved by a <b>sensor.lidar.ray_cast</b>. This essentially simulates a rotating lidar using ray-casting. Learn more about this [here](ref_sensors.md#lidar-raycast-sensor).
# - PROPERTIES -------------------------
instance_variables:
- var_name: channels
@ -133,13 +133,6 @@
List of 3D points received as data.
# - METHODS ----------------------------
methods:
- def_name: get_point_count
params:
- param_name: channel
type: int
doc: >
Retrieves the number of points sorted by channel that are generated by this measure. Sorting by channel allows to identify the original channel for every point.
# --------------------------------------
- def_name: save_to_disk
params:
- param_name: path
@ -147,15 +140,22 @@
doc: >
Saves the point cloud to disk as a <b>.ply</b> file describing data from 3D scanners. The files generated are ready to be used within [MeshLab](http://www.meshlab.net/), an open source system for processing said files. Just take into account that axis may differ from Unreal Engine and so, need to be reallocated.
# --------------------------------------
- def_name: __len__
# --------------------------------------
- def_name: __iter__
- def_name: get_point_count
params:
- param_name: channel
type: int
doc: >
Retrieves the number of points sorted by channel that are generated by this measure. Sorting by channel allows to identify the original channel for every point.
# --------------------------------------
- def_name: __getitem__
params:
- param_name: pos
type: int
# --------------------------------------
- def_name: __iter__
# --------------------------------------
- def_name: __len__
# --------------------------------------
- def_name: __setitem__
params:
- param_name: pos
@ -170,7 +170,7 @@
parent: carla.SensorData
# - DESCRIPTION ------------------------
doc: >
Class that defines a collision data for <b>sensor.other.collision</b>. The sensor creates one of this for every collision detected which may be many for one simulation step. Learn more about this [here](/cameras_and_sensors/#sensorothercollision).
Class that defines a collision data for <b>sensor.other.collision</b>. The sensor creates one of this for every collision detected which may be many for one simulation step. Learn more about this [here](ref_sensors.md#collision-detector).
# - PROPERTIES -------------------------
instance_variables:
- var_name: actor
@ -190,7 +190,7 @@
parent: carla.SensorData
# - DESCRIPTION ------------------------
doc: >
Class that defines the obstacle data for <b>sensor.other.obstacle</b>. Learn more about this [here](/cameras_and_sensors/#sensorotherobstacle).
Class that defines the obstacle data for <b>sensor.other.obstacle</b>. Learn more about this [here](ref_sensors.md#obstacle-detector).
# - PROPERTIES -------------------------
instance_variables:
- var_name: actor
@ -214,7 +214,7 @@
parent: carla.SensorData
# - DESCRIPTION ------------------------
doc: >
Class that defines lanes invasion for <b>sensor.other.lane_invasion</b>. It works only client-side and is dependant on OpenDRIVE to provide reliable information. The sensor creates one of this every time there is a lane invasion, which may be more than once per simulation step. Learn more about this [here](/cameras_and_sensors/#sensorotherlane_invasion).
Class that defines lanes invasion for <b>sensor.other.lane_invasion</b>. It works only client-side and is dependant on OpenDRIVE to provide reliable information. The sensor creates one of this every time there is a lane invasion, which may be more than once per simulation step. Learn more about this [here](ref_sensors.md#lane-invasion-detector).
# - PROPERTIES -------------------------
instance_variables:
- var_name: actor
@ -282,7 +282,7 @@
parent: carla.SensorData
# - DESCRIPTION ------------------------
doc: >
Class that defines and gathers the measures registered by a <b>sensor.other.radar</b>, representing a wall of points in front of the sensor with a distance, angle and velocity in relation to it. The data consists of a carla.RadarDetection array.
Class that defines and gathers the measures registered by a <b>sensor.other.radar</b>, representing a wall of points in front of the sensor with a distance, angle and velocity in relation to it. The data consists of a carla.RadarDetection array. Learn more about this [here](ref_sensors.md#radar-sensor).
# - PROPERTIES -------------------------
instance_variables:
- var_name: raw_data
@ -295,15 +295,15 @@
doc: >
Retrieves the number of entries generated, same as **<font color="#7fb800">\__str__()</font>**.
# --------------------------------------
- def_name: __len__
# --------------------------------------
- def_name: __iter__
# --------------------------------------
- def_name: __getitem__
params:
- param_name: pos
type: int
# --------------------------------------
- def_name: __iter__
# --------------------------------------
- def_name: __len__
# --------------------------------------
- def_name: __setitem__
params:
- param_name: pos

View File

@ -1,6 +1,5 @@
---
- module_name: carla
doc: >
# - CLASSES ------------------------------
classes:
@ -24,31 +23,6 @@
Precise moment in time when snapshot was taken. This class works in seconds as given by the operative system.
# - METHODS ----------------------------
methods:
- def_name: __eq__
return: bool
params:
- param_name: other
type: carla.WorldSnapshot
doc: >
Returns <b>True</b> if both **<font color="#f8805a">timestamp</font>** are the same.
# --------------------------------------
- def_name: __iter__
doc: >
Method that enables iteration for this class using **<font color="#f8805a">timestamp</font>** as reference value.
# --------------------------------------
- def_name: __ne__
return: bool
params:
- param_name: other
type: carla.WorldSnapshot
doc: >
Returns <b>True</b> if both **<font color="#f8805a">timestamp</font>** are different.
# --------------------------------------
- def_name: __len__
return: int
doc: >
Returns the amount of carla.ActorSnapshot present in this snapshot.
# --------------------------------------
- def_name: find
return: carla.ActorSnapshot
params:
@ -65,7 +39,32 @@
doc: >
Given a certain actor ID, checks if there is a snapshot corresponding it and so, if the actor was present at that moment.
# --------------------------------------
- def_name: __iter__
doc: >
Method that enables iteration for this class using **<font color="#f8805a">timestamp</font>** as reference value.
# --------------------------------------
- def_name: __len__
return: int
doc: >
Returns the amount of carla.ActorSnapshot present in this snapshot.
# --------------------------------------
- def_name: __eq__
return: bool
params:
- param_name: other
type: carla.WorldSnapshot
doc: >
Returns __True__ if both **<font color="#f8805a">timestamp</font>** are the same.
# --------------------------------------
- def_name: __ne__
return: bool
params:
- param_name: other
type: carla.WorldSnapshot
doc: >
Returns <b>True</b> if both **<font color="#f8805a">timestamp</font>** are different.
# --------------------------------------
- class_name: ActorSnapshot
# - DESCRIPTION ------------------------
doc: >

View File

@ -1,6 +1,6 @@
---
- module_name: carla
doc: >
# - CLASSES ------------------------------
classes:
- class_name: WeatherParameters
@ -89,6 +89,21 @@
default: 0.0
doc: >
0 is an arbitrary North, 180 its corresponding South.
- param_name: fog_density
type: float
default: 0.0
doc: >
Density of the fog, from 0 to 100.
- param_name: fog_distance
type: float
default: 0.0
doc: >
Distance where the fog starts in meters.
- param_name: wetness
type: float
default: 0.0
doc: >
Humidity percentages of the road, from 0 to 100.
note: >
ClearNoon, CloudyNoon, WetNoon, WetCloudyNoon, SoftRainNoon, MidRainyNoon, HardRainNoon, ClearSunset, CloudySunset, WetSunset, WetCloudySunset, SoftRainSunset, MidRainSunset, HardRainSunset.
doc: >
@ -109,6 +124,5 @@
Returns <b>True</b> if both objects' variables are different.
# --------------------------------------
- def_name: __str__
doc: >
# --------------------------------------
...

View File

@ -1,6 +1,6 @@
---
- module_name: carla
doc: >
# - CLASSES ------------------------------
classes:
- class_name: Timestamp
@ -37,22 +37,18 @@
type: float
- param_name: platform_timestamp
type: float
doc: >
# --------------------------------------
- def_name: __eq__
params:
- param_name: other
type: carla.Timestamp
doc: >
# --------------------------------------
- def_name: __ne__
params:
- param_name: other
type: carla.Timestamp
doc: >
# --------------------------------------
- def_name: __str__
doc: >
# --------------------------------------
- class_name: ActorList
@ -61,29 +57,6 @@
A class that contains every actor present on the scene and provides access to them. The list is automatically created and updated by the server and it can be returned using carla.World.
# - METHODS ----------------------------
methods:
- def_name: __getitem__
return: carla.Actor
params:
- param_name: pos
type: int
doc: >
Returns the actor corresponding to `pos` position in the list.
# --------------------------------------
- def_name: __iter__
doc: >
Allows the iteration for this object.
# --------------------------------------
- def_name: __len__
return: int
doc: >
Returns the amount of actors listed.
# --------------------------------------
- def_name: __str__
return: str
doc: >
Parses to the ID for every actor listed.
# --------------------------------------
- def_name: filter
return: list
params:
@ -100,6 +73,28 @@
doc: >
Finds an actor using its identifier and returns it or <b>None</b> if it is not present.
# --------------------------------------
- def_name: __getitem__
return: carla.Actor
params:
- param_name: pos
type: int
doc: >
Returns the actor corresponding to `pos` position in the list.
# --------------------------------------
- def_name: __iter__
doc: >
Allows the iteration for the actors in this object.
# --------------------------------------
- def_name: __len__
return: int
doc: >
Returns the amount of actors listed.
# --------------------------------------
- def_name: __str__
return: str
doc: >
Parses to the ID for every actor listed.
# --------------------------------------
- class_name: WorldSettings
# - DESCRIPTION ------------------------
@ -198,11 +193,6 @@
Responsible for creating different shapes for debugging. Take a look at its class to learn more about it.
# - METHODS ----------------------------
methods:
- def_name: __str__
return: string
doc: >
The content of the world is parsed and printed as a brief report of its current state.
# --------------------------------------
- def_name: apply_settings
return: int
params:
@ -211,6 +201,89 @@
doc: >
This method applies settings contained in an object to the simulation running and returns the ID of the frame they were implemented.
# --------------------------------------
- def_name: on_tick
return: int
params:
- param_name: callback
type: carla.WorldSnapshot
doc: >
A defined function with a snapshot as compulsory parameter that will be called every tick.
doc: >
The method will start callbacks for a defined function `callback`. It will return the ID for this callback so it can be removed with **<font color="#7fb800">remove_on_tick()</font>**.
# --------------------------------------
- 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 **<font color="#7fb800">on_tick()</font>**.
# --------------------------------------
- def_name: tick
return: int
doc: >
This only has effect on synchronous mode, when both client and server move together. The method tells the server when to step to the next frame and returns the id of the newly started frame.
# --------------------------------------
- def_name: wait_for_tick
return: carla.WorldSnapshot
params:
- param_name: seconds
type: float
default: 10.0
doc: >
Maximum time in seconds the server should wait for a tick. It is set to 10.0 by default.
doc: >
The client tells the server to block calling thread until a **<font color="#7fb800">world_tick()</font>** is received.
# --------------------------------------
- def_name: spawn_actor
return: carla.Actor
params:
- param_name: blueprint
type: carla.ActorBlueprint
doc: >
The reference from which the actor will be created.
- param_name: transform
type: carla.Transform
doc: >
Contains the location and orientation the actor will be spawned with.
- param_name: attach_to
type: carla.Actor
default: None
doc: >
The parent object that the spawned actor will follow around.
- param_name: attachment
type: carla.AttachmentType
default: Rigid
doc: >
Determines how fixed and rigorous should be the changes in position according to its parent object.
doc: >
The method will create, return and spawn an actor into the world. The actor will need an available blueprint to be created and a transform (location and rotation). It can also be attached to a parent with a certain attachment type.
# --------------------------------------
- def_name: try_spawn_actor
return: carla.Actor
params:
- param_name: blueprint
type: carla.ActorBlueprint
doc: >
The reference from which the actor will be created.
- param_name: transform
type: carla.Transform
doc: >
Contains the location and orientation the actor will be spawned with.
- param_name: attach_to
type: carla.Actor
default: None
doc: >
The parent object that the spawned actor will follow around.
- param_name: attachment
type: carla.AttachmentType
default: Rigid
doc: >
Determines how fixed and rigorous should be the changes in position according to its parent object.
doc: >
Same as **<font color="#7fb800">spawn_actor()</font>** but returns <b>None</b> on failure instead of throwing an exception.
# --------------------------------------
- def_name: get_actor
return: carla.Actor
params:
@ -245,6 +318,11 @@
doc: >
This can only be used with walkers. It retrieves a random location to be used as a destination using the **<font color="#7fb800">go_to_location()</font>** method in carla.WalkerAIController. This location will be part of a sidewalk. Roads, crosswalks and grass zones are excluded. The method does not take into consideration locations of existing actors so if a collision happens when trying to spawn an actor, it will return an error. Take a look at [`spawn_npc.py`](https://github.com/carla-simulator/carla/blob/e73ad54d182e743b50690ca00f1709b08b16528c/PythonAPI/examples/spawn_npc.py#L179) for an example.
# --------------------------------------
- def_name: get_settings
return: carla.WorldSettings
doc: >
Returns an object containing some data about the simulation such as synchrony between client and server or rendering mode.
# --------------------------------------
- def_name: get_snapshot
return: carla.WorldSnapshot
doc: >
@ -255,35 +333,11 @@
doc: >
Returns the spectator actor. The spectator is a special type of actor created by Unreal Engine, usually with ID=0, that acts as a camera and controls the view in the simulator window.
# --------------------------------------
- def_name: get_settings
return: carla.WorldSettings
doc: >
Returns an object containing some data about the simulation such as synchrony between client and server or rendering mode.
# --------------------------------------
- def_name: get_weather
return: carla.WeatherParameters
doc: >
Retrieves an object containing weather parameters currently active in the simulation, mainly cloudiness, precipitation, wind and sun position.
# --------------------------------------
- def_name: on_tick
return: int
params:
- param_name: callback
type: carla.WorldSnapshot
doc: >
A defined function with a snapshot as compulsory parameter that will be called every tick.
doc: >
The method will start callbacks for a defined function `callback`. It will return the ID for this callback so it can be removed with **<font color="#7fb800">remove_on_tick()</font>**.
# --------------------------------------
- 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 **<font color="#7fb800">on_tick()</font>**.
# --------------------------------------
- def_name: set_weather
params:
- param_name: weather
@ -292,71 +346,13 @@
New conditions to be applied.
doc: >
Changes the weather parameteres ruling the simulation to another ones defined in an object.
# --------------------------------------
- def_name: spawn_actor
return: carla.Actor
params:
- param_name: blueprint
type: carla.ActorBlueprint
doc: >
The reference from which the actor will be created.
- param_name: transform
type: carla.Transform
doc: >
Contains the location and orientation the actor will be spawned with.
- param_name: attach_to
type: carla.Actor
default: None
doc: >
The parent object that the spawned actor will follow around.
- param_name: attachment
type: carla.AttachmentType
default: Rigid
doc: >
Determines how fixed and rigorous should be the changes in position according to its parent object.
# --------------------------------------
- def_name: __str__
return:
string
doc: >
The method will create, return and spawn an actor into the world. The actor will need an available blueprint to be created and a transform (location and rotation). It can also be attached to a parent with a certain attachment type.
# --------------------------------------
- def_name: tick
return: int
doc: >
This only has effect on synchronous mode, when both client and server move together. The method tells the server when to step to the next frame and returns the id of the newly started frame.
# --------------------------------------
- def_name: try_spawn_actor
return: carla.Actor
params:
- param_name: blueprint
type: carla.ActorBlueprint
doc: >
The reference from which the actor will be created.
- param_name: transform
type: carla.Transform
doc: >
Contains the location and orientation the actor will be spawned with.
- param_name: attach_to
type: carla.Actor
default: None
doc: >
The parent object that the spawned actor will follow around.
- param_name: attachment
type: carla.AttachmentType
default: Rigid
doc: >
Determines how fixed and rigorous should be the changes in position according to its parent object.
doc: >
Same as **<font color="#7fb800">spawn_actor()</font>** but returns <b>None</b> on failure instead of throwing an exception.
# --------------------------------------
- def_name: wait_for_tick
return: carla.WorldSnapshot
params:
- param_name: seconds
type: float
default: 10.0
doc: >
Maximum time in seconds the server should wait for a tick. It is set to 10.0 by default.
doc: >
The client tells the server to block calling thread until a **<font color="#7fb800">world_tick()</font>** is received.
# --------------------------------------
The content of the world is parsed and printed as a brief report of its current state.
# --------------------------------------
- class_name: DebugHelper
# - DESCRIPTION ------------------------
@ -364,58 +360,6 @@
Helper class part of carla.World that defines methods for creating debug shapes. By default, shapes last one second. They can be permanent, but take into account the resources needed to do so. Check out this [recipe](ref_code_recipes.md#debug-bounding-box-recipe) where the user takes a snapshot of the world and then proceeds to draw bounding boxes for traffic lights.
# - METHODS ----------------------------
methods:
- def_name: draw_point
params:
- param_name: location
type: carla.Location
doc: >
Spot in the coordinate system to center the object.
- param_name: size
type: float
default: 0.1f
doc: >
Density of the point.
- param_name: color
type: carla.Color
default: (255,0,0)
doc: >
RGB code to color the object. Red by default.
- param_name: life_time
type: float
default: -1.0f
doc: >
Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes.
doc: >
Draws a point `location`.
# --------------------------------------
- def_name: draw_line
params:
- param_name: begin
type: carla.Location
doc: >
Point in the coordinate system where the line starts.
- param_name: end
type: carla.Location
doc: >
Spot in the coordinate system where the line ends.
- param_name: thickness
type: float
default: 0.1f
doc: >
Density of the line.
- param_name: color
type: carla.Color
default: (255,0,0)
doc: >
RGB code to color the object. Red by default.
- param_name: life_time
type: float
default: -1.0f
doc: >
Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes.
doc: >
Draws a line in between `begin` and `end`.
# --------------------------------------
- def_name: draw_arrow
params:
- param_name: begin
@ -479,6 +423,58 @@
Draws a box, ussually to act for object colliders.
# --------------------------------------
- def_name: draw_line
params:
- param_name: begin
type: carla.Location
doc: >
Point in the coordinate system where the line starts.
- param_name: end
type: carla.Location
doc: >
Spot in the coordinate system where the line ends.
- param_name: thickness
type: float
default: 0.1f
doc: >
Density of the line.
- param_name: color
type: carla.Color
default: (255,0,0)
doc: >
RGB code to color the object. Red by default.
- param_name: life_time
type: float
default: -1.0f
doc: >
Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes.
doc: >
Draws a line in between `begin` and `end`.
# --------------------------------------
- def_name: draw_point
params:
- param_name: location
type: carla.Location
doc: >
Spot in the coordinate system to center the object.
- param_name: size
type: float
default: 0.1f
doc: >
Density of the point.
- param_name: color
type: carla.Color
default: (255,0,0)
doc: >
RGB code to color the object. Red by default.
- param_name: life_time
type: float
default: -1.0f
doc: >
Lifespan in seconds for the shape. By default it only lasts one frame. Set this to 0 for permanent shapes.
doc: >
Draws a point `location`.
# --------------------------------------
- def_name: draw_string
params:
- param_name: location