diff --git a/CHANGELOG.md b/CHANGELOG.md index a361dd37a..f4672927e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## Latest Changes * Prevent from segfault on failing SignalReference identification when loading OpenDrive files - * Added vehicle doors to the recorder + * Added vehicle doors to the recorder + * Added functions to get actor' components transform ## CARLA 0.9.15 diff --git a/PythonAPI/examples/get_component_test.py b/PythonAPI/examples/get_component_test.py new file mode 100644 index 000000000..099fc7b10 --- /dev/null +++ b/PythonAPI/examples/get_component_test.py @@ -0,0 +1,34 @@ +import glob +import os +import sys + +try: + sys.path.append(glob.glob('../carla/dist/carla-*%d.%d-%s.egg' % ( + sys.version_info.major, + sys.version_info.minor, + 'win-amd64' if os.name == 'nt' else 'linux-x86_64'))[0]) +except IndexError: + pass + + +# ============================================================================== +# -- imports ------------------------------------------------------------------- +# ============================================================================== + + +import carla + +client = carla.Client('localhost', 2000) +world = client.get_world() + +location = carla.Location(200.0, 200.0, 200.0) +rotation = carla.Rotation(0.0, 0.0, 0.0) +transform = carla.Transform(location, rotation) + +bp_library = world.get_blueprint_library() +bp_audi = bp_library.find('vehicle.audi.tt') +audi = world.spawn_actor(bp_audi, transform) + +component_transform = audi.get_component_world_transform('front-blinker-r-1') +print(component_transform) +