Created
November 8, 2022 12:24
-
-
Save donghee/6dbe0135eeca418bea3da2964d37f77d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import carla | |
import random | |
client = carla.Client('127.0.0.1', 2000) | |
client.set_timeout(2.0) | |
world = client.get_world() | |
people = [] | |
for i in range(2): | |
blueprint = random.choice(world.get_blueprint_library().filter('walker.*')) | |
spawn_points = world.get_map().get_spawn_points() | |
spawn_point = random.choice(spawn_points) if spawn_points else carla.Transform() | |
print(spawn_point) | |
person = world.try_spawn_actor(blueprint, spawn_point) | |
people.append(person) | |
for ped in people: | |
bones = ped.get_bones() | |
new_pose = [] | |
for bone in bones.bone_transforms: | |
if bone.name == "crl_foreArm__L": | |
bone.relative.rotation.pitch -= 90 | |
new_pose.append((bone.name, bone.relative)) | |
elif bone.name == "crl_foreArm__R": | |
bone.relative.rotation.pitch -= 90 | |
new_pose.append((bone.name, bone.relative)) | |
control = carla.WalkerBoneControlIn() | |
control.bone_transforms = new_pose | |
ped.set_bones(control) | |
ped.blend_pose(0.5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment