carla/PythonAPI/docs/blueprint.yml

371 lines
12 KiB
YAML
Raw Normal View History

2019-05-03 18:18:02 +08:00
---
- module_name: carla
2019-05-03 18:18:02 +08:00
# - CLASSES ------------------------------
classes:
- class_name: ActorAttributeType
# - DESCRIPTION ------------------------
doc: >
2023-02-09 21:14:22 +08:00
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.
2019-05-03 18:18:02 +08:00
# - PROPERTIES -------------------------
instance_variables:
- var_name: Bool
- var_name: Int
- var_name: Float
- var_name: String
- var_name: RGBColor
2019-05-03 18:18:02 +08:00
- class_name: Color
# - DESCRIPTION ------------------------
doc: >
Class that defines a 32-bit RGBA color.
2019-05-03 18:18:02 +08:00
# - PROPERTIES -------------------------
instance_variables:
- var_name: r
type: int
2019-05-03 18:18:02 +08:00
doc: >
Red color (0-255).
2019-05-03 18:18:02 +08:00
- var_name: g
type: int
2019-05-03 18:18:02 +08:00
doc: >
Green color (0-255).
2019-05-03 18:18:02 +08:00
- var_name: b
type: int
2019-05-03 18:18:02 +08:00
doc: >
Blue color (0-255).
2019-05-03 18:18:02 +08:00
- var_name: a
type: int
2019-05-03 18:18:02 +08:00
doc: >
Alpha channel (0-255).
2019-05-03 18:18:02 +08:00
# - METHODS ----------------------------
methods:
2019-07-01 23:46:27 +08:00
- def_name: __init__
params:
- param_name: r
type: int
default: 0
- param_name: g
type: int
default: 0
- param_name: b
type: int
default: 0
- param_name: a
type: int
default: 255
doc: >
2023-02-09 21:14:22 +08:00
Initializes a color, black by default.
2019-07-01 23:46:27 +08:00
# --------------------------------------
2019-05-03 18:18:02 +08:00
- def_name: __eq__
params:
- param_name: other
type: carla.Color
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: __ne__
params:
- param_name: other
type: carla.Color
2019-05-03 18:18:02 +08:00
# --------------------------------------
2019-07-01 23:46:27 +08:00
- def_name: __str__
# --------------------------------------
2021-11-08 19:54:36 +08:00
- class_name: FloatColor
# - DESCRIPTION ------------------------
doc: >
Class that defines a float RGBA color.
# - PROPERTIES -------------------------
instance_variables:
- var_name: r
type: float
doc: >
Red color.
- var_name: g
type: float
doc: >
Green color.
- var_name: b
type: float
doc: >
Blue color.
- var_name: a
type: float
doc: >
Alpha channel.
# - METHODS ----------------------------
methods:
- def_name: __init__
params:
- param_name: r
type: float
default: 0
- param_name: g
type: float
default: 0
- param_name: b
type: float
default: 0
- param_name: a
type: float
default: 1.0
doc: >
2023-02-09 21:14:22 +08:00
Initializes a color, black by default.
2021-11-08 19:54:36 +08:00
# --------------------------------------
- def_name: __eq__
params:
- param_name: other
type: carla.FloatColor
# --------------------------------------
- def_name: __ne__
params:
- param_name: other
type: carla.FloatColor
# --------------------------------------
2023-02-09 21:14:22 +08:00
- class_name: OpticalFlowPixel
# - DESCRIPTION ------------------------
doc: >
Class that defines a 2 dimensional vector representing an optical flow pixel.
# - PROPERTIES -------------------------
instance_variables:
- var_name: x
type: float
doc: >
2023-02-09 21:14:22 +08:00
Optical flow in the x component.
- var_name: y
type: float
doc: >
Optical flow in the y component.
# - METHODS ----------------------------
methods:
- def_name: __init__
params:
- param_name: x
type: float
default: 0
- param_name: y
type: float
default: 0
doc: >
2023-02-09 21:14:22 +08:00
Initializes the Optical Flow Pixel. Zero by default.
# --------------------------------------
- def_name: __eq__
params:
- param_name: other
type: carla.OpticalFlowPixel
# --------------------------------------
- def_name: __ne__
params:
- param_name: other
type: carla.OpticalFlowPixel
# --------------------------------------
- def_name: __str__
# --------------------------------------
2019-05-03 18:18:02 +08:00
- class_name: ActorAttribute
# - DESCRIPTION ------------------------
doc: >
2023-02-09 21:14:22 +08:00
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.
2019-05-03 18:18:02 +08:00
# - PROPERTIES -------------------------
instance_variables:
- var_name: id
2019-07-01 23:46:27 +08:00
type: str
2019-05-03 18:18:02 +08:00
doc: >
2023-02-09 21:14:22 +08:00
The attribute's name and identifier in the library.
- var_name: is_modifiable
type: bool
2019-05-03 18:18:02 +08:00
doc: >
It is <b>True</b> if the attribute's value can be modified.
2019-05-03 18:18:02 +08:00
- var_name: recommended_values
2019-07-01 23:46:27 +08:00
type: list(str)
2019-05-03 18:18:02 +08:00
doc: >
2023-02-09 21:14:22 +08:00
A list of values suggested by those who designed the blueprint.
- var_name: type
type: carla.ActorAttributeType
2019-05-03 18:18:02 +08:00
doc: >
The attribute's parameter type.
2019-05-03 18:18:02 +08:00
# - METHODS ----------------------------
methods:
- def_name: as_bool
doc: >
2023-02-09 21:14:22 +08:00
Reads the attribute as boolean value.
# --------------------------------------
- def_name: as_color
doc: >
2023-02-09 21:14:22 +08:00
Reads the attribute as carla.Color.
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: as_float
doc: >
2023-02-09 21:14:22 +08:00
Reads the attribute as float.
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: as_int
doc: >
2023-02-09 21:14:22 +08:00
Reads the attribute as int.
# --------------------------------------
2019-05-03 18:18:02 +08:00
- def_name: as_str
doc: >
2023-02-09 21:14:22 +08:00
Reads the attribute as string.
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: __bool__
# --------------------------------------
- def_name: __float__
# --------------------------------------
- def_name: __int__
# --------------------------------------
- def_name: __str__
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: __eq__
return: bool
2019-07-01 23:46:27 +08:00
params:
- param_name: other
type: bool / int / float / str / carla.Color / carla.ActorAttribute
2019-05-03 18:18:02 +08:00
doc: >
2023-02-09 21:14:22 +08:00
Returns true if this actor's attribute and `other` are the same.
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: __ne__
return: bool
2019-07-01 23:46:27 +08:00
params:
- param_name: other
type: bool / int / float / str / carla.Color / carla.ActorAttribute
2019-05-03 18:18:02 +08:00
doc: >
2023-02-09 21:14:22 +08:00
Returns true if this actor's attribute and `other` are different.
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: __nonzero__
return: bool
2019-05-03 18:18:02 +08:00
doc: >
2023-02-09 21:14:22 +08:00
Returns true if this actor's attribute is not zero or null.
2019-07-01 23:46:27 +08:00
# --------------------------------------
2019-05-03 18:18:02 +08:00
- class_name: ActorBlueprint
# - DESCRIPTION ------------------------
doc: >
2023-02-09 21:14:22 +08:00
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.
2019-05-03 18:18:02 +08:00
# - PROPERTIES -------------------------
instance_variables:
- var_name: id
2019-07-01 23:46:27 +08:00
type: str
2019-05-03 18:18:02 +08:00
doc: >
The identifier of said blueprint inside the library. E.g. `walker.pedestrian.0001`.
2019-05-03 18:18:02 +08:00
- var_name: tags
2019-07-01 23:46:27 +08:00
type: list(str)
2019-05-03 18:18:02 +08:00
doc: >
A list of tags each blueprint has that helps describing them. E.g. `['0001', 'pedestrian', 'walker']`.
2019-05-03 18:18:02 +08:00
# - METHODS ----------------------------
methods:
- def_name: has_attribute
return: bool
2019-07-01 23:46:27 +08:00
params:
- param_name: id
2019-07-01 23:46:27 +08:00
type: str
doc: >
2023-02-09 21:14:22 +08:00
e.g. `gender` would return **True** for pedestrians' blueprints.
2019-05-03 18:18:02 +08:00
doc: >
2023-02-09 21:14:22 +08:00
Returns <b>True</b> if the blueprint contains the attribute `id`.
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: has_tag
return: bool
2019-07-01 23:46:27 +08:00
params:
- param_name: tag
2019-07-01 23:46:27 +08:00
type: str
doc: >
e.g. 'walker'
2019-05-03 18:18:02 +08:00
doc: >
Returns <b>True</b> if the blueprint has the specified `tag` listed.
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: match_tags
return: bool
2019-07-01 23:46:27 +08:00
params:
- param_name: wildcard_pattern
2019-07-01 23:46:27 +08:00
type: str
2019-05-03 18:18:02 +08:00
doc: >
Returns <b>True</b> if any of the tags listed for this blueprint matches `wildcard_pattern`. Matching follows [fnmatch](https://docs.python.org/2/library/fnmatch.html) standard.
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: get_attribute
2023-02-09 21:14:22 +08:00
return: carla.ActorAttribute
2019-07-01 23:46:27 +08:00
params:
- param_name: id
type: str
2019-05-03 18:18:02 +08:00
doc: >
2023-02-09 21:14:22 +08:00
Returns the actor's attribute with `id` as identifier if existing.
2019-07-01 23:46:27 +08:00
Return: carla.ActorAttribute
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: set_attribute
2023-02-09 21:14:22 +08:00
params:
2019-07-01 23:46:27 +08:00
- param_name: id
type: str
doc: >
2023-02-09 21:14:22 +08:00
The identifier for the attribute that is intended to be changed.
2019-07-01 23:46:27 +08:00
- param_name: value
type: str
doc: >
2023-02-09 21:14:22 +08:00
The new value for said attribute.
2019-05-03 18:18:02 +08:00
doc: >
2023-02-09 21:14:22 +08:00
If the `id` attribute is modifiable, changes its value to `value`.
2019-07-01 23:46:27 +08:00
# --------------------------------------
- def_name: __iter__
doc: >
2023-02-09 21:14:22 +08:00
Iterate over the carla.ActorAttribute that this blueprint has.
# --------------------------------------
- def_name: __len__
doc: >
2023-02-09 21:14:22 +08:00
Returns the amount of attributes for this blueprint.
# --------------------------------------
- def_name: __str__
# --------------------------------------
2019-05-03 18:18:02 +08:00
- class_name: BlueprintLibrary
# - DESCRIPTION ------------------------
doc: >
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.
2023-02-09 21:14:22 +08:00
[Here](bp_library.md) is a reference containing every available blueprint and its specifics.
2019-05-03 18:18:02 +08:00
# - METHODS ----------------------------
methods:
- 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
2023-02-09 21:14:22 +08:00
- def_name: filter_by_attribute
params:
- param_name: name
type: str
- param_name: value
type: str
doc: >
Filters a list of blueprints with a given attribute matching the `value` against 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: >
2023-02-09 21:14:22 +08:00
Returns the blueprint corresponding to that identifier.
# --------------------------------------
- def_name: __getitem__
params:
- param_name: pos
type: int
return: carla.ActorBlueprint
2019-05-03 18:18:02 +08:00
doc: >
2023-02-09 21:14:22 +08:00
Returns the blueprint stored in `pos` position inside the data structure containing them.
# --------------------------------------
- def_name: __iter__
doc: >
2023-02-09 21:14:22 +08:00
Iterate over the carla.ActorBlueprint stored in the library.
# --------------------------------------
- def_name: __len__
2023-02-09 21:14:22 +08:00
return: int
doc: >
2023-02-09 21:14:22 +08:00
Returns the amount of blueprints comprising the library.
# --------------------------------------
- def_name: __str__
2023-02-09 21:14:22 +08:00
return: string
doc: >
2023-02-09 21:14:22 +08:00
Parses the identifiers for every blueprint to string.
2019-05-03 18:18:02 +08:00
# --------------------------------------
...