From 84d4b7c5b9f25bfd4c0365f43296f160d698042f Mon Sep 17 00:00:00 2001 From: nsubiron Date: Thu, 13 Jun 2019 12:19:10 +0200 Subject: [PATCH] PythonAPI: allow finding single actor by id --- Docs/python_api.md | 1 + PythonAPI/carla/source/libcarla/World.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/Docs/python_api.md b/Docs/python_api.md index df901644d..1812deff0 100644 --- a/Docs/python_api.md +++ b/Docs/python_api.md @@ -35,6 +35,7 @@ - `apply_settings(world_settings)` - `get_weather()` - `set_weather(weather_parameters)` +- `get_actor(actor_id) -> carla.Actor` - `get_actors(actor_ids=None) -> carla.ActorList` - `spawn_actor(blueprint, transform, attach_to=None)` - `try_spawn_actor(blueprint, transform, attach_to=None, attachment_type=carla.AttachmentType.Rigid)` diff --git a/PythonAPI/carla/source/libcarla/World.cpp b/PythonAPI/carla/source/libcarla/World.cpp index 20a1cd8b8..6243f7a9d 100644 --- a/PythonAPI/carla/source/libcarla/World.cpp +++ b/PythonAPI/carla/source/libcarla/World.cpp @@ -135,6 +135,7 @@ void export_world() { .def("apply_settings", &cc::World::ApplySettings) .def("get_weather", CONST_CALL_WITHOUT_GIL(cc::World, GetWeather)) .def("set_weather", &cc::World::SetWeather) + .def("get_actor", CONST_CALL_WITHOUT_GIL_1(cc::World, GetActor, carla::ActorId), (arg("actor_id"))) .def("get_actors", CONST_CALL_WITHOUT_GIL(cc::World, GetActors)) .def("get_actors", &GetActorsById, (arg("actor_ids"))) .def("spawn_actor", SPAWN_ACTOR_WITHOUT_GIL(SpawnActor))