valhalla / valhalla

Open Source Routing Engine for OpenStreetMap
https://valhalla.github.io/valhalla/
Other
4.55k stars 687 forks source link

Custom Realtime Traffic Layer #4985

Open cmb87 opened 5 days ago

cmb87 commented 5 days ago

Hello everyone,

how hard is it to add another custom traffic tile? I want to duplicate the existing realtime traffic functionality and have a separate traffic.jar e.g. custom_traffic.jar. I think this could be very interesting if you have time dependent effects like traffic but also other time dependet effects like mobile network. My scenario is a last mile delivery robot, which needs to make routing decision based on traffic but also mobile network for the operator.

So far I duplicated traffictile.h and added a second GraphMemory entry graphtile.cc/h. I would naively copy the existing traffic structure and add another vehicle class in dynamic cost where the mobile network layer is queried. Is this a feasible approach, or am I just walking towards a dead end?

Thanks !!!

P.S: Great work dear Valhalla team!

chrstnbwnkl commented 4 days ago

To me it sounds like you are trying to battle multiple problems at once. If you only want to avoid certain edges based on some spatial variable like mobile network connection, I don't see why you'd need to create an entirely new costing sub-class. I'm guessing this would solve another problem like having an entirely new vehicle type for the autonomous vehicle?

Regarding live speed, I'm wondering why you'd want an additional live speed layer on top of the one Valhalla offers. How would it be used differently? If they both control the edge cost, I don't see why you wouldn't just combine multiple variables into a single live speed value.

cmb87 commented 4 days ago

The combination approach was a solution I thought about. I just thought that an additional layer would be the cleaner solution. The mobile network can be quite volatile, especially when there a sudden events where crowds of people load a single cell of the network. It's like avoiding a traffic jam, but more severe as it may mean the loss of the system if it cannot be teleoperated any longer. Would you still suggest to combine network and traffic in a single layer?

Especially, when I initialize the system and I don't know much about the mobile network conditions, it would be great to favor road segments, where information are available vs where are no information are present.

What would you suggest as minimal invasive modification to realize such operation?