Open ahsan155 opened 9 months ago
I think, the co-simulation works without dynamic information exchange. I was just using the other script called python3 run_synchronization.py examples/Town04.sumocfg --sumo-gui
which is not the same as the one you mentioned, but im sure it works the same way.
In this case SUMO is responsible for the dynamic traffic modelling and it is just moves phisycally-static objects in CARLA. Therefore in that side you are not able to get the speed easily.
I think there is 2 possible solutions:
CARLA version: 0.9.15 Platform/OS: linux
I am running carla-sumo co-simulation. I am using the script 'spawn_npc_sumo.py' which is located in Co-Simulation/sumo to spawn vehicles in simulation. Inside this script, I tried to collect vehicles velocity inside the synchronization loop. The issue is that vehicles velocity keeps returning 0 even though vehicle is running. I know there is a way to collect velocity using sumo/traci. But I would like to collect velocity information using carla functionality. The synchronization loop:
while True: start = time.time() synchronization.tick()
So, how can I get non zero velocity using carla code?
Steps to reproduce: Just add the below code inside synchronization loop of the script spawn_npc_sumo.py
'for vehicle in world.get_actors().filter('vehicle.*'): velocity = vehicle.get_velocity() print(f"Vehicle {vehicle.id} velocity: {velocity.x}, {velocity.y}, {velocity.z}")'