2018-07-30 20:28:51 +08:00
|
|
|
<h1>Python API Reference</h1>
|
2018-07-29 01:29:31 +08:00
|
|
|
|
|
|
|
!!! important
|
|
|
|
Versions prior to 0.9.0 have a very different API. For the documentation of
|
|
|
|
the stable version please switch to the
|
|
|
|
[stable branch](https://carla.readthedocs.io/en/stable/).
|
|
|
|
|
|
|
|
## `carla.Client`
|
|
|
|
|
|
|
|
- `Client(host, port, worker_threads=0)`
|
2018-10-01 20:29:11 +08:00
|
|
|
- `set_timeout(float_seconds)`
|
2018-07-29 01:29:31 +08:00
|
|
|
- `get_client_version()`
|
|
|
|
- `get_server_version()`
|
|
|
|
- `ping()`
|
|
|
|
- `get_world()`
|
|
|
|
|
|
|
|
## `carla.World`
|
|
|
|
|
|
|
|
- `get_blueprint_library()`
|
2018-07-29 17:28:16 +08:00
|
|
|
- `get_spectator()`
|
2018-07-29 01:29:31 +08:00
|
|
|
- `spawn_actor(blueprint, transform, attach_to=None)`
|
|
|
|
- `try_spawn_actor(blueprint, transform, attach_to=None)`
|
|
|
|
|
|
|
|
## `carla.BlueprintLibrary`
|
|
|
|
|
|
|
|
- `find(id)`
|
|
|
|
- `filter(wildcard_pattern)`
|
|
|
|
- `__getitem__(pos)`
|
|
|
|
- `__len__()`
|
|
|
|
- `__iter__()`
|
|
|
|
|
|
|
|
## `carla.ActorBlueprint`
|
|
|
|
|
|
|
|
- `id`
|
|
|
|
- `tags`
|
|
|
|
- `contains_tag(tag)`
|
|
|
|
- `match_tags(wildcard_pattern)`
|
|
|
|
- `contains_attribute(key)`
|
|
|
|
- `get_attribute(key)`
|
|
|
|
- `set_attribute(key, value)`
|
2018-08-29 22:23:32 +08:00
|
|
|
- `__len__`
|
|
|
|
- `__iter__`
|
2018-07-29 01:29:31 +08:00
|
|
|
|
|
|
|
## `carla.ActorAttribute`
|
|
|
|
|
2018-08-29 22:23:32 +08:00
|
|
|
- `id`
|
2018-07-29 01:29:31 +08:00
|
|
|
- `type`
|
|
|
|
- `recommended_values`
|
2018-08-29 22:23:32 +08:00
|
|
|
- `is_modifiable`
|
2018-07-29 01:29:31 +08:00
|
|
|
- `as_bool()`
|
|
|
|
- `as_int()`
|
|
|
|
- `as_float()`
|
|
|
|
- `as_str()`
|
|
|
|
- `as_color()`
|
|
|
|
- `__eq__()`
|
|
|
|
- `__ne__()`
|
|
|
|
- `__nonzero__()`
|
|
|
|
- `__bool__()`
|
|
|
|
- `__int__()`
|
|
|
|
- `__float__()`
|
|
|
|
- `__str__()`
|
|
|
|
|
|
|
|
## `carla.Actor`
|
|
|
|
|
|
|
|
- `id`
|
|
|
|
- `type_id`
|
|
|
|
- `get_world()`
|
|
|
|
- `get_location()`
|
|
|
|
- `get_transform()`
|
|
|
|
- `set_location(location)`
|
|
|
|
- `set_transform(transform)`
|
|
|
|
- `destroy()`
|
|
|
|
|
|
|
|
## `carla.Vehicle(carla.Actor)`
|
|
|
|
|
|
|
|
- `apply_control(vehicle_control)`
|
|
|
|
- `set_autopilot(enabled=True)`
|
|
|
|
|
|
|
|
## `carla.Sensor(carla.Actor)`
|
|
|
|
|
|
|
|
- `listen(callback_function)`
|
|
|
|
|
|
|
|
## `carla.Image`
|
|
|
|
|
|
|
|
- `frame_number`
|
|
|
|
- `width`
|
|
|
|
- `height`
|
|
|
|
- `type`
|
|
|
|
- `fov`
|
|
|
|
- `raw_data`
|
|
|
|
|
|
|
|
## `carla.VehicleControl`
|
|
|
|
|
|
|
|
- `throttle`
|
|
|
|
- `steer`
|
|
|
|
- `brake`
|
|
|
|
- `hand_brake`
|
|
|
|
- `reverse`
|
|
|
|
|
|
|
|
## `carla.Location`
|
|
|
|
|
|
|
|
- `x`
|
|
|
|
- `y`
|
|
|
|
- `z`
|
|
|
|
|
|
|
|
## `carla.Rotation`
|
|
|
|
|
|
|
|
- `pitch`
|
|
|
|
- `yaw`
|
|
|
|
- `roll`
|
|
|
|
|
|
|
|
## `carla.Transform`
|
|
|
|
|
|
|
|
- `location`
|
|
|
|
- `rotation`
|
|
|
|
|
|
|
|
## `carla.Color`
|
|
|
|
|
|
|
|
- `r`
|
|
|
|
- `g`
|
|
|
|
- `b`
|