abstreet
abstreet copied to clipboard
Cyclists should use empty parking lanes
Start simple: if the lane is totally empty when the cyclist has to pick a turn, then use it. We could either "lock it" while the cyclist is there and force anybody trying to park to go a bit farther, or just allow it and not attempt to model any conflict between the cyclist and an actively parking car.
But this already gets interesting... how should this concept be exposed at the map_model
layer? Should there be a Turn
? How do methods like constraints.can_use
and map.get_turns_from_lane
handle this? Considering the parking lane for routing could be strange -- what if we have a one-way road with parking on both sides. We don't want a bike to route contraflow.
One approach to side-step this complexity is to treat it as a special case in opportunistically_lanechange
at the routing level, which needs to change anyway to check the parking state. Still some parts of the sim layer will need to lookup the turn... could it be worth some kind of lazy instantiation there? Or a concept of virtual turns?
And then at the sim layer, do we lazily create a Queue
for the parking lane once it's first used? Is it worth trying to garbage collect this when no agents are on it?
(The answers to some of these questions could potentially be useful for someday modeling time-based turn restrictions)
We don't want a bike to route contraflow.
In several of the European cities I lived in, this is actually a common pattern, and in a few cases has led to changes where the municipal regulations were modified to reflect that.
Even more, another pattern is not just the case for bikes, and completely legal: In a narrow 2-lane street, parking can be allowed in one lane. The other direction has the right of way and the parking-allowed direction has to yield, but they can also do that by popping into a gap between the parking cars, instead of having to wait at the beginning of the lane.
I got an implementation started! It's slightly tricky, because we lazily create a
Turn
to & from the parking lane when a bike tries to use it. I need to figure out how to filter these "conditional" turns out from most of the map queries used for figuring out how lanes link up.
this is actually a common pattern, and in a few cases has led to changes where the municipal regulations were modified to reflect that.
Thanks, noted! I'm going to get the simplest case working solidly first before attempting contraflow movement through parking lanes. In reality, two cyclists going opposite directions could simultaneously use one parking lane, but A/B Street can only model this right now using two separate (possibly skinny) lanes. Contraflow usage maybe should also be reflected in routing; there could be cases where a bike should always prefer a shortcut through a one-way road using the parking.
they can also do that by popping into a gap between the parking cars
This is another thing that would be nice to implement, but very hard, so I'll hold off for now.