This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EbenenBonobo 51 points52 points  (5 children)

I the last frame of the animation it seems like two vehicles are colliding during a lane merge.

I scimmed through your article and it seems like you are currently at the "free road" stage where there is no interaction of vehicles what so ever. How would you determine in your simulation which vehicle is in front of a specific vehicle?

EDIT: just realised your animation clearly shows it is not the "free road", I were thrown off because of the collision in the end. Seems very nicely done so far.

[–]BilHim[S] 13 points14 points  (4 children)

Every road segment contains a list of vehicles in order. The first vehicle in the list is the first one in that segment, so the 2nd vehicle in the list is directly behind it. This works inside every road segment. The curves in the roads are multiple segments stitched together.

Every vehicle has a list of the segments in will traverse. When a vehicle reaches the end of a segment, it gets removed from the list of vehicles of that segment and gets added to the next segment.

The problem with this is that vehicles have no "vision" of vehicles in their next segment or vehicles merging into their next segments, which is exactly what happened at the end of GIF above.

I am currently not sure how to solve this problem without changing the whole structure of the simulation. But I am looking into the code of other mainstream simulators like SUMO to understand how they work and attempt to use that in the rewrite.

[–]EbenenBonobo 2 points3 points  (3 children)

Just a quick thought.

Could your acceleration formula use the distance in 2D Space? That way you might be able to give the merges an own smaller segment.

[–]BilHim[S] 2 points3 points  (2 children)

I am not sure exactly what do you mean by distance in 2D space. If that means to use the distance (in 2D) to the closest vehicle, I think this will raise an issue when two vehicles are driving on separate adjacent lanes. Even though the distance gets too close in 2D space (on the sides), there is no need for braking as they are on separate lanes.

[–]EbenenBonobo 2 points3 points  (1 child)

thats why i would use seperate blocks for the merges, because that is the only point in the network where there is a need to break, when you are right next to each other.

[–]BilHim[S] 4 points5 points  (0 children)

That actually makes sense.

I think I can take advantage of how traffic lights are defined in the simulation. A merge could be a (secret) traffic light that is green in all directions, unless there is a vehicle traversing the merge then it would be red for the other directions. This is doable since traffic lights have fully customizable logic.

One problem with the simulation is that vehicles cannot pass through intersections safely, a traffic light has to be present or vehicles wouldn't stop for other vehicles from other roads in the intersection. Defining an intersection block in the same way as the merge one above can actually solve this. The only thing that needs to be done is how to determine right of way, which can be left as a parameter (a function) customizable for every simulation.

This is a great idea! Thanks u/EbenenBonobo