carla/PythonAPI/docs/blueprint.yml

270 lines
9.5 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: >
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: >
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__
# --------------------------------------
2019-05-03 18:18:02 +08:00
- class_name: ActorAttribute
# - DESCRIPTION ------------------------
doc: >
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: >
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: >
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: >
Reads the attribute as boolean value.
# --------------------------------------
- def_name: as_color
doc: >
Reads the attribute as carla.Color.
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: as_float
doc: >
Reads the attribute as float.
2019-05-03 18:18:02 +08:00
# --------------------------------------
- def_name: as_int
doc: >
Reads the attribute as int.
# --------------------------------------
2019-05-03 18:18:02 +08:00
- def_name: as_str
doc: >
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: >
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: >
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: >
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: >
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: >
e.g. `gender` would return **True** for pedestrians' blueprints.
2019-05-03 18:18:02 +08:00
doc: >
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
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: >
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
2019-07-01 23:46:27 +08:00
params:
- param_name: id
type: str
doc: >
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: >
The new value for said attribute.
2019-05-03 18:18:02 +08:00
doc: >
If the `id` attribute is modifiable, changes its value to `value`.
2019-07-01 23:46:27 +08:00
# --------------------------------------
- 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__
# --------------------------------------
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.
2020-03-02 21:35:50 +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
# --------------------------------------
- def_name: find
params:
- param_name: id
type: str
return: carla.ActorBlueprint
doc: >
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: >
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.
2019-05-03 18:18:02 +08:00
# --------------------------------------
...