navit-gps / navit

The open source (GPL v2) turn-by-turn navigation software for many OS
http://www.navit-project.org
Other
557 stars 175 forks source link

Navit dont use city higway with limited speed. Add city vehicle #974

Open gefin opened 4 years ago

gefin commented 4 years ago

I suggest to add a vehicleprofile named "car city" with the flag maxspeed_handling="2" The idea is that cities like Munich have a city highway around. It has a speed limit of 50 t0 60 kmh. There are no traffic lights so except the main times this is the fastest route.

With the standard setting navit don't use this highway the most time.

It is save to disable max speed handling because the traffic lights slow down the other streets very hard. I use this setting for years.

mvglasow commented 4 years ago

Is maxspeed_handling="2" the equivalent of saying “ignore speed limits”? Or what does it do?

As somebody who uses Navit in Munich on a daily basis, I feel it already gravitates towards the B2R more than I would like it to (traffic can get quite heavy there even on a Sunday afternoon). But then again, forecasting traffic conditions is out of scope here (this would be a case for the traffic plugin).

I am not entirely happy with two different profiles for the same type of vehicle (the only difference being the environment in which we are routing). Combined with the setting to ignore speed limits, that feels a bit hackish to me.

As far as I know, there is route_weight, which should already give preference to trunk in the default car profile. If not, we might want to tweak that, whether in the city or elsewhere.

Another shortcoming of Navit is that our routing algorithm currently assumes all traffic lights to be green when we get there. I would suggest fixing that.

We could do this by adding a penalty for each segment which has a traffic light, roughly equivalent to the average time we expect to spend waiting at a traffic light—say, 30 seconds for each traffic light on the segment. If the traffic light is at the start or end node, assume half that time for each segment. Sometimes we may hit more than one traffic light belonging to the same intersection, causing Navit to assume twice the delay—but as the delay is just an approximation anyway, I do not consider this a major issue.

Not sure how easy it is to extract traffic light information from the map during routing, but once we have that information, incorporating the delay in time calculations should not be too hard.

gefin commented 4 years ago

" Is maxspeed_handling="2" the equivalent of saying “ignore speed limits”? Or what does it do? "

It says "ignore speed limits, Use route_wight only."

The idea to add a traffic-light penalty while routing is very good.

By the way...I like to drive with maxspeed_handling="2" in the city. With the default setting navit try to lead me at every exit from B2R.(7 times from A94 to Renatastraße.

Is it possible to change maxspeed_handling with a OSD Button?

mvglasow commented 4 years ago

With the default setting navit try to lead me at every exit from B2R.(7 times from A94 to Renatastraße.

Same here, not only on B2R (e.g. northbound from Donnersbergerbrücke to Dachauer Straße) but also on motorways, thus not exclusively an inner-city problem. This seems to happen when the ramps are nearly parallel to the road and the road bends slightly to the right (so the ramps appear marginally shorter). Penalizing traffic lights would probably solve cases involving traffic lights; for the rest we could also try a less favorable route_weight for ramps. The only thing I don’t have an idea for yet are cases involving connecting carriageways (as commonly found at major motorway intersections).

As for changing maxspeed_handling via the OSD:

That would give you a command like vehicleprofile[@name=="car"].maxspeed_handling=2. I haven’t tested this; you might want to try it out in an enable_expression (which will show certain controls only if the condition is true). enable_expression='vehicleprofile[@name=="car"].maxspeed_handling==2' should cause the OSD item to show only if maxspeed handling for the car profile is 2 (if not, the expression is likely incorrect).

See also https://wiki.navit-project.org/index.php/OSD#command and https://wiki.navit-project.org/index.php/Command_interface for more details.

However, changing maxspeed_handling on the fly likely will not change the current route unless you recalculate it (there’s also a command for that).

gefin commented 4 years ago

Thank you. I get this error. Error on line 156 char 103: 'car"].maxspeed_handling' is not a valid name: '"' at line 156, char 103 May be "car" is not escaped well. I tried something, but dont find the right syntax.

mvglasow commented 4 years ago

Looks like you used a single quote at the start of car; try a double quote. Not sure if single quotes work in Navit commands, but using double quotes in commands and using single quotes for the XML atributes works.

gefin commented 4 years ago

I tried single and double quote. Also tried to escape the quotes. It did not work. In the sample from my last post i used double quote. The single quote in the error message is part of the error message.

mvglasow commented 4 years ago

Can you post the entire line? Enclosed in a code block so spaces are preserved, or a with hint where character 103 is.

It looks like Navit is not looking for car, but car"].maxspeed_handling, for whatever reason. If we can rule out incorrect use of quotes, then maybe my guess at the correct expression was wrong (in which case I recommend asking on IRC), or there’s a bug in Navit’s expression parsing. You’re venturing into territories I have not explored to this day, therefore I might not be much help here…

gefin commented 4 years ago

1.txt I used this line

mvglasow commented 4 years ago
<osd enable_expression='vehicleprofile[@name=="car"].maxspeed_handling==2' enabled="yes" type="compass"/>

Character 103 is the closing double quote of type="compass". The quotes look correct. My guess is it’s one of the following:

Anyways, I recommend you ask on IRC; others might know more about this than I do.