Update python_api.md

This commit is contained in:
nsubiron 2018-10-22 14:35:48 +02:00
parent 44710c760d
commit 571f9363e1
4 changed files with 87 additions and 17 deletions

View File

@ -39,9 +39,9 @@
- `id`
- `tags`
- `contains_tag(tag)`
- `has_tag(tag)`
- `match_tags(wildcard_pattern)`
- `contains_attribute(key)`
- `has_attribute(key)`
- `get_attribute(key)`
- `set_attribute(key, value)`
- `__len__()`
@ -58,8 +58,8 @@
- `as_float()`
- `as_str()`
- `as_color()`
- `__eq__()`
- `__ne__()`
- `__eq__(other)`
- `__ne__(other)`
- `__nonzero__()`
- `__bool__()`
- `__int__()`
@ -96,19 +96,25 @@
- `apply_control(vehicle_control)`
- `set_autopilot(enabled=True)`
## `carla.TrafficLight(carla.Actor)`
- `state`
## `carla.Sensor(carla.Actor)`
- `is_listening`
- `listen(callback_function)`
- `stop()`
## `carla.Image`
## `carla.SensorData`
- `frame_number`
- `transform`
## `carla.Image(carla.SensorData)`
- `width`
- `height`
- `type`
- `fov`
- `raw_data`
- `convert(color_converter)`
@ -118,10 +124,8 @@
- `__getitem__(pos)`
- `__setitem__(pos, color)`
## `carla.LidarMeasurement`
## `carla.LidarMeasurement(carla.SensorData)`
- `frame_number`
- `transform`
- `horizontal_angle`
- `channels`
- `raw_data`
@ -132,6 +136,12 @@
- `__getitem__(pos)`
- `__setitem__(pos, location)`
## `carla.CollisionEvent(carla.SensorData)`
- `actor`
- `other_actor`
- `normal_impulse`
## `carla.VehicleControl`
- `throttle`
@ -139,8 +149,8 @@
- `brake`
- `hand_brake`
- `reverse`
- `__eq__()`
- `__ne__()`
- `__eq__(other)`
- `__ne__(other)`
## `carla.WeatherParameters`
@ -150,25 +160,69 @@
- `wind_intensity`
- `sun_azimuth_angle`
- `sun_altitude_angle`
- `__eq__()`
- `__ne__()`
- `__eq__(other)`
- `__ne__(other)`
Static presets
- `carla.WeatherParameters.ClearNoon`
- `carla.WeatherParameters.CloudyNoon`
- `carla.WeatherParameters.WetNoon`
- `carla.WeatherParameters.WetCloudyNoon`
- `carla.WeatherParameters.MidRainyNoon`
- `carla.WeatherParameters.HardRainNoon`
- `carla.WeatherParameters.SoftRainNoon`
- `carla.WeatherParameters.ClearSunset`
- `carla.WeatherParameters.CloudySunset`
- `carla.WeatherParameters.WetSunset`
- `carla.WeatherParameters.WetCloudySunset`
- `carla.WeatherParameters.MidRainSunset`
- `carla.WeatherParameters.HardRainSunset`
- `carla.WeatherParameters.SoftRainSunset`
## `carla.Vector3D`
- `x`
- `y`
- `z`
- `__add__(other)`
- `__sub__(other)`
- `__eq__(other)`
- `__ne__(other)`
## `carla.Location`
- `x`
- `y`
- `z`
- `__add__(other)`
- `__sub__(other)`
- `__eq__(other)`
- `__ne__(other)`
## `carla.Rotation`
- `pitch`
- `yaw`
- `roll`
- `__eq__(other)`
- `__ne__(other)`
## `carla.Transform`
- `location`
- `rotation`
- `__eq__(other)`
- `__ne__(other)`
## `carla.Timestamp`
- `frame_count`
- `elapsed_seconds`
- `delta_seconds`
- `platform_timestamp`
- `__eq__(other)`
- `__ne__(other)`
## `carla.Color`
@ -176,6 +230,8 @@
- `g`
- `b`
- `a`
- `__eq__(other)`
- `__ne__(other)`
## `carla.ColorConverter`
@ -183,3 +239,17 @@
- `Depth`
- `LogarithmicDepth`
- `CityScapesPalette`
## `carla.ActorAttributeType`
- `Bool`
- `Int`
- `Float`
- `RGBColor`
## `carla.TrafficLightState`
- `Unknown`
- `Red`
- `Yellow`
- `Green`

View File

@ -169,7 +169,7 @@ class World(object):
def _get_random_blueprint(self):
bp = random.choice(self.world.get_blueprint_library().filter('vehicle'))
if bp.contains_attribute('color'):
if bp.has_attribute('color'):
color = random.choice(bp.get_attribute('color').recommended_values)
bp.set_attribute('color', color)
return bp

View File

@ -135,9 +135,9 @@ void export_blueprint() {
class_<cc::ActorBlueprint>("ActorBlueprint", no_init)
.add_property("id", CALL_RETURNING_COPY(cc::ActorBlueprint, GetId))
.add_property("tags", &cc::ActorBlueprint::GetTags)
.def("contains_tag", &cc::ActorBlueprint::ContainsTag)
.def("has_tag", &cc::ActorBlueprint::ContainsTag)
.def("match_tags", &cc::ActorBlueprint::MatchTags)
.def("contains_attribute", &cc::ActorBlueprint::ContainsAttribute)
.def("has_attribute", &cc::ActorBlueprint::ContainsAttribute)
.def("get_attribute", CALL_RETURNING_COPY_1(cc::ActorBlueprint, GetAttribute, const std::string &))
.def("set_attribute", &cc::ActorBlueprint::SetAttribute)
.def("__len__", &cc::ActorBlueprint::size)

View File

@ -89,8 +89,8 @@ void export_world() {
.def("get_weather", CONST_CALL_WITHOUT_GIL(cc::World, GetWeather))
.def("set_weather", &cc::World::SetWeather)
.def("get_actors", CONST_CALL_WITHOUT_GIL(cc::World, GetActors))
.def("try_spawn_actor", SPAWN_ACTOR_WITHOUT_GIL(TrySpawnActor))
.def("spawn_actor", SPAWN_ACTOR_WITHOUT_GIL(SpawnActor))
.def("try_spawn_actor", SPAWN_ACTOR_WITHOUT_GIL(TrySpawnActor))
.def("wait_for_tick", &WaitForTick, (arg("seconds")=1.0))
.def("on_tick", &OnTick, (arg("callback")))
.def(self_ns::str(self_ns::self))