Lower speed using tracktype, smoothness and surface#955
Lower speed using tracktype, smoothness and surface#955ftrebien wants to merge 7 commits intoProject-OSRM:masterfrom
Conversation
|
A set of cucumber tests would help clarify what consequences this change would have, and make sure it does not cause regressions. |
|
I'm not sure it's a good idea to discard a way just because it has an unknown tracktype or smoothness. |
|
How was the actual speeds choosen? (60, 45, 30, 15, etc.) |
|
@emiltin is right. We need a couple of things to proceed with this PR:
|
|
Right, I'll write the cucumber tests as soon as I can. Is there any specific guideline? I've never really written one, so I'm using as an example this one: https://github.com/DennisOSRM/Project-OSRM/blob/master/features/car/maxspeed.feature I wonder how these tests are verified, do you run some automated system? Tracktype and smoothness both have a small, closed and stable set of values. These values are closely followed in practice: Major reasons not to follow practice include 2 types of edit accident (both edit mistakes): typos, and concatenation when joining ways. I think the decision here is one of project goal:
These situations are very rare (see taginfo). By being pessimist, I believe OSRM can aid in finding such mapping mistakes. Of course, I'm open to any of those approaches, whichever follows more closely OSRM philosophy. The "surface tag" does not have a closed and stable set of values. Surface is also less reliable for guessing speeds (particularly values such as surface=unpaved, which I've equated with "dirt" based on discussions on the tagging list such as this one: https://lists.openstreetmap.org/pipermail/tagging/2014-March/016811.html). However, surface can still be a good predictor in most cases (notable exceptions are paved, unpaved, ground and dirt; for these values I have assumed an "average" scenario, also a guess based on the description and related values). The suggested speeds (which are in kmph) are subjective, based on the descriptions and pictures in the wiki and on personal experience (assuming a low clearance, standard passenger car), and so they would definitely benefit from more opinions and scrutiny. One possible improvement (specially for developing countries) is to lower some of these speeds to just below the speed of residential ways. (30 would become 20, 15 would become 10, then 45 would make a little more sense if it became 40.) Another debatable point is whether we want to route through ways tagged with smoothness=horrible (described in the wiki as equivalent to smoothness=off_road_vehicles). I thought maybe the Humanitarian team may need this in some situations. To avoid gross guessing errors, I've formulated the following sanity questions to myself and then answered them:
|
|
I've written an extensive test suite and made some changes to the code. Is there a way to use GitHub to run the tests directly? (I may need to repeat the test.) Or do I have to install the entire software stack on my local machine? The 47 test scenarios fall in 4 groups:
There's also a routability scenario. Is there anything else you think should be tested? |
|
There was one change from the original profile. I was using an absolute speed limit, but while writing the tests I felt the need for preference values to get OSRM to find better routes when the alternative routes are very similar (say, a nearby way with "excellent" smoothness instead of a slighly shorter way with "good" smoothness, both of the same highway type). Now I'm considering both aspects: a preference value (that multiplies way speed calculated by the existing profile) and a maximum absolute speed. |
|
Please run test locally first to make sure they all pass (including all existing tests). |
|
I have not written any tests for the "surface" tag, as the assignments I made are at best a "guess". |
|
Even though surface speeds are simply assigned, they should probably be tested as well. The lua script is complex and many things potentially influence the final speed. |
|
Trying to build OSRM, I'm having a little problem with cmake: (...) Everything else is fine. Since LuaJIT does not come with Debian Wheezy, I've installed it following the instructions in the project site, but CMake seems unable to find it. This is my first time using CMake, any suggestions on how to get it to find the library on /usr/local/bin/? |
|
Some justification (opinions from other people) for lowering speed values at the "bad" end of the scale: https://lists.openstreetmap.org/pipermail/tagging/2014-March/017010.html |
|
On my side I think the job is done. Let me know if anything else is necessary. |
|
Thanks. A bunch of tests are still failing for me: I suggest reorganizing tests a bit. Instead of testing two surfaces against in each in each scenario, maybe use tables to test the resulting speed of different combinations of highway, surface, smoothness, tracktype, maxspeed etc. We probably also need to check that surface tags don't affect things like oneway and access. Ex make sure smoothness=excellent doesn't make a way with access=no routable. |
|
Great points @emiltin |
… constraints on direction maxspeeds
… constraints on direction maxspeeds
|
While rewriting the tests, I had to ask myself whether I would prefer having maxspeed override the safe speed derived from surface quality (surface/tracktype/smoothness). One could expect maxspeed to be a good predictor of a safe speed of travel, particularly on good quality surfaces. Considering that legal maximum speed is determined by the local traffic administration and surface quality is assessed by the local community:
|
|
If people most often tag stuff that lowers speed, doesn't it then make sense to use the lowest speed implied by maxspeed, surface, smoothness, etc? |
|
A way to specify the resulting speed in these kinds of tests would probably be useful and make tests easier to write/read. |
|
"If people most often tag stuff that lowers speed, doesn't it then make sense to use the lowest speed implied by maxspeed, surface, smoothness, etc?" Yes, it does, this is the logic that I followed. I was just explaining that we don't take the minimum of {highway speed, maxspeed, surface speed, smoothness speed, etc.}; instead, we take maxspeed if present, or highway speed if not, and then let this speed value be lowered by surface, smoothness, etc. This is a little different because highway speed is discarded from the minimum calculation when maxspeed is present. My main reason to do this is to keep as much of the current logic untouched as possible. I believe it works this way already because maxspeed is seen as some sort of "official speed", where the speed assigned to each highway is more like a speed guess. |
|
"A way to specify the resulting speed in these kinds of tests would probably be useful and make tests easier to write/read." Absolutely. The Cucumber tests could support an additional "average speed" column which would test against distance divided by time. Some conversion would be needed if speed included "kmph" or "mph". On routability tables, the tests could support average speed syntax too. |
|
Let me know if the tests are passing now or if there's anything else that needs to be fixed or improved. |
|
Did you run the tests yourself? |
|
No. I spent 2 whole days trying to set up the entire infrastructure (reading from OSRM's guides, and from OSRM's dependencies' guides), but I was unable to get OSRM to compile on Debian Wheezy. I wouldn't be able to spend any more days doing that, but I didn't want to give up the knowledge I've gathered after so many discussions in forums and mailing lists. |
|
I understand it can be frustating to get things to compile. But trying to change code and submitting pull requests without being able to run the result yourself is almost impossible. |
|
Well, Emil, if it takes you perhaps one or two minutes to run it, but it takes me days or even over a week to do the same, and all I want is to contribute a small change that pretty much consolidates the knowledge that I've gathered, isn't it worth a try? I really can't spend more time on this, so, if I get not help at all, maybe it's best to just forget about it entirely. It was well researched in my biased opinion. And even though I couldn't run the tests, I did run the Lua code on an interpreter to figure out the times to be tested. |
|
First, we appreciate your work and the pull request. But let me give some additional thoughts on this:
This is not a critical error. Instead of the JIT compiler the (somewhat) slower interpreter is used.
Let me comment more precisely on what you posted above:
A small and stable set of values is a great thing.
Our philosophy can be summed up with the following: Don't fix the data and don't start splitting hairs. If data is broken by edit mistakes, we expose these problems instead of glossing over. Even if this means that results obviously wrong. Showing issues means fixing issues. The we stay away from quibbling that many discussions on tagging turn into.
unstable value sets are usually a thing not to support. It as also an indicator for ongoing hair picking. What's the reasonable subset of smoothness values to support?
This is a fair point. Referencing pages in the wiki is a good building block to make a case for a proposed change set.
That's also a good point.
What's your answer to this question?
What's your answer to this question?
Ok, sounds reasonable.
Makes, sense too. Can you elaborate a bit more on the process?
|
|
In the hope of supporting the discussion, I've tried to create a simplified verison at: 634ba93. It's still based on ftrebien's PR and input. Surface, tracktype and smoothness are considered. Only common tag values are handled. Each value is assigned a max speed, for example surface=pebblestone => max 40 km/h, and smoothness=horrible => 20 km/h. These values are simply assigned by looking at the photos at the wiki, and can of course be adjusted. The default speed for the way type is then lowered if mandated by any of the surface tags. For example, a way with highway=primary would usually use 65 km/h. But if it has surface=pebblestone, this will be lowered to 40 km/h. If it also has smoothness=horrible, it would instead use 20 km/h, since this is lower that 40. I've also tried to modify the test to make them a bit clearer. I'm in the process of added the ability to test for average speed in cucumber, but it's not complete. So some tests are marked as @todo, but the idea should be clear. This approach doesn't multiply anything, or do other advanced combination of the surface tags. As such it wouldn't handle all edge cases, but at least it's pretty easy to follow what's going on. |
|
my simplified version mentioned above can be found in the branch feature/surfaces: https://github.com/DennisOSRM/Project-OSRM/tree/feature/surfaces |
|
Thanks @emiltin. Will check it out. |
This already includes some adjustments from replies to this post: https://www.mail-archive.com/[email protected]/msg00393.html