]> rtime.felk.cvut.cz Git - hubacji1/py-carla.git/blob - focus.py
Add remote simulation with recording
[hubacji1/py-carla.git] / focus.py
1 #!/usr/bin/env python3.7
2 """Focus spectator at specific coordinates."""
3 import carla
4 import sys
5 if __name__ == "__main__":
6     if len(sys.argv) != 2:
7         print("./focus X,Y,HEADING")
8         exit(1)
9     client = carla.Client("localhost", 2000)
10     client.set_timeout(9999)
11     world = client.get_world()
12     settings = world.get_settings()
13     x, y, h = [float(i) for i in sys.argv[1].replace(" ", "").split(",")]
14     sr = carla.Rotation(yaw=h)
15     sl = carla.Location(x=x, y=y, z=10) - 20 * sr.get_forward_vector()
16     world.get_spectator().set_transform(carla.Transform(sl, sr))