sumo icon indicating copy to clipboard operation
sumo copied to clipboard

Setting up a vehicle to stop midway using the traci interface

Open ywq178 opened this issue 1 year ago • 7 comments

Add your issue description here. After I call traci.vehicle.setParkingAreaStop() and traci.vehicle.setStop() at a certain moment. Printing traci.vehicle.getRoadID() and traci.vehicle.getDrivingDistance() before the vehicle moves has no effect. If possible, upload an example that shows your problem. pythonProject1.zip

SUMO-version: 1.19 operating system: windows 10

ywq178 avatar Jan 09 '24 12:01 ywq178

Your download link lets Github return "NOT FOUND"...?

m-kro avatar Jan 09 '24 13:01 m-kro

pythonProject1.zip

ywq178 avatar Jan 09 '24 13:01 ywq178

I have re-uploaded it.

ywq178 avatar Jan 09 '24 13:01 ywq178

You have chosen a problematic border case with your stop settings. The vehicle is already at (lane E0_0 position 18m) because the parking area is defined up to that point. Sumo gets confused by the second stop command traci.vehicle.setStop('d1','E0',pos=18, laneIndex=0, duration=100, flags=0).

If it is not extremely important, I advise to shift the second stop a little downstream (pos > 18) and it should work as expected.

m-kro avatar Jan 10 '24 10:01 m-kro

You have chosen a problematic border case with your stop settings. The vehicle is already at (lane E0_0 position 18m) because the parking area is defined up to that point. Sumo gets confused by the second stop command traci.vehicle.setStop('d1','E0',pos=18, laneIndex=0, duration=100, flags=0).

If it is not extremely important, I advise to shift the second stop a little downstream (pos > 18) and it should work as expected.

Thank you for your reply. The reason I did this is that I wanted to use traci.vehicle.getDrivingDistance to calculate the distance from the vehicle to a certain edge along the route during the parking area, but I found that I couldn't achieve it. Do you have any good ideas?

ywq178 avatar Jan 10 '24 11:01 ywq178

An idea (still to be implemented!) would be to compute the distance from a reference point of the current stop on the network (only on request / if wished by the TraCI client). Then there wouldn't be any need for a second stop on the road network.

m-kro avatar Jan 16 '24 14:01 m-kro

An idea (still to be implemented!) would be to compute the distance from a reference point of the current stop on the network (only on request / if wished by the TraCI client). Then there wouldn't be any need for a second stop on the road network.

That's a good idea! Also, I thought of a way to do this. Add a vehicle of the same type to an adjacent lane in a parking area and set up the same route and parking position. Get distance data based on the added vehicle, and remove the vehicle after getting the distance data. (It's a bit clumsy though :) )

ywq178 avatar Jan 17 '24 07:01 ywq178