Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [sumo-user] Relative distance in ring road

Thanks Jakob, I was able to generate a perfect ring road by setting spider.arm to a large number. 

As a follow-up question, is there a way to set to a single direction (one-way) road, using similar commands? I did not find a command like this by using netgenerate.

Thank you!

Best, 

Jakob Erdmann <namdre.sumo@xxxxxxxxx> 于2023年5月1日周一 11:58写道:
you generate circles with arbitrary level of detail using

netgenerate --spider --spider.omit-center --spider.circle-number 1 --spider.space-radius RADIUS --spider.arm-number DETAIL -R -o circle.net.xml

regards,
Jakob


Am Mo., 1. Mai 2023 um 10:00 Uhr schrieb Ruud van Gaal <r.vangaal@xxxxxxxxxx>:
Hi Cindy,

I used the 'repeat' attribute of the 'route' command before to do loops, instead of using re-routers; that was much easier. That may affect the outcome of vehicle.getdistance().

    <route id="r_ego" repeat="10000" edges="a b c d"  />

An alternative is to somehow find out the circle perimeter and modulo the distance: veh_distance = relative_distance % perimiter.
One other alternative is to consider the ring road a pure circle, then take both vehicle's forward vectors, generate a circle through those two points and calculate the circular distance. Mathematically perhaps a bit more unstable than just using the x/y coordinates and calculating a distance. I would go for the first method though: try to cut off 1 full perimeter if the distance seems too large. The hard part is then perhaps figuring out the perimeter.

Kind regards,
Ruud


On Mon, May 1, 2023 at 6:20 AM Chen Di <dichen981@xxxxxxxxx> wrote:
Hi,

I have drawn a ring road following this tutorial, where gives me a circle that is not perfect (not smooth and the radius at different position may vary a bit). I also had re-routers so that vehicles drive for multiple rounds.

I need to compute the relative distance between vehicles. I tried the function vehice.getdistance(). However, this will give me some errors in calculation. For example, if vehicle A in its second round is close to vehicle B in its third round, then the relative distance is a large value that contains a perimeter of the ring road. 

I also thought about using x,y coordinates and the angle, and convert it to distance. However, this seems not accurate, given that my ring road is not a perfect circle.

I am wondering if there are any good ways to compute relative distance correctly in this case. Thanks!

Best,
Cindy
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user
_______________________________________________
sumo-user mailing list
sumo-user@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/sumo-user

Back to the top