From 2752f1b81bd784f17e71c4f2f3beaa6fc38eb270 Mon Sep 17 00:00:00 2001 From: Marie Burer Date: Wed, 3 Sep 2025 12:59:29 -0500 Subject: [PATCH] changed the spectator to always spawn behind (x-direction) the ego vehicle --- carla_sim/simulation.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/carla_sim/simulation.py b/carla_sim/simulation.py index c73b803..156ee12 100644 --- a/carla_sim/simulation.py +++ b/carla_sim/simulation.py @@ -48,6 +48,12 @@ def run_simulation(spawn_config, weather_params, ev_tf = tools.list_to_transform(spawn_config['ev']['start']) ev_end = tools.list_to_transform(spawn_config['ev']['end']).location + spec_loc = carla.Location(ev_tf.location.x-80, ev_tf.y, 100) + spectator = world.get_spectator() + spectator.set_transform(carla.Transform( + spec_loc, + carla.Rotation(pitch=-35, yaw=0, roll=0))) + vehicle = world.spawn_actor(vehicle_bp, ev_tf) agent = BehaviorAgent(vehicle, behavior='normal') agent.set_destination(ev_end)