Skip to content

Reading relations and improved bike handling - #132

Merged
karussell merged 24 commits into
graphhopper:masterfrom
ratrun:ratrunexperiments
Dec 23, 2013
Merged

karussell merged 24 commits into
graphhopper:masterfrom
ratrun:ratrunexperiments

Conversation

@ratrun

@ratrun ratrun commented Dec 16, 2013

Copy link
Copy Markdown
Contributor

This tries to solve #76 and also #84 and improved the bicycle route routing by adding bonus and subtract malus speed values based on the value of the "network" tag. This bicycle routing now finds routes, which I believe are better compared to the current master version. Additionally I have made a hack for improved tuning instructions specifically for bicycles. These instructions contain information if the chosen edge is unpaved or paved, and if it is a wheeler edge. This part of the implementation needs some cleanup, because I put some bicycle specific code into the generic/car minded instruction parts as I could not find another way. Can somebody please point me to instructions how to push my branch to git? I'm completely new to git and don't know if somebody needs to give me "push" rights.

@karussell

Copy link
Copy Markdown
Member

Thanks!

  • Would you mind to clean things a bit? E.g. why XmlReader vs. existing OSMInputFile? Is it used somewhere? And "Personal GraphHopperWeb changes -> do not commit?" :)
  • Regarding: "This throws an exception, but boosting with 8 is an error as it is higher than OUTSTANDING_NICE" -> catch the exception and assertTrue(false) that the normal way is not used.
  • There should be more unit tests for relation handling. E.g. some small artificial osm.xml which shows that 1. relations are correctly parsed and reduce or increase some speed value etc. This is a very important but also complex issue so I need them, but I can help you with that (which will make it a bit slower though)
  • Will it improve biking trails and also hiking?
  • (Info for me: very recent build, tests pass, not sure why travis does not report it)

…t with our boosting.

-> now the previously commented test case can be enabled.
Additional a test for exceeding maximum negative boosting added.
@ratrun

ratrun commented Dec 17, 2013

Copy link
Copy Markdown
Contributor Author

thanks for your feedback.

  • I have removed the file XmlReader, it probably came from wrong
    handling of git, I don't know where I got it from. The "Personal
    GraphHopperWeb changes" containes personal changed in the web
    project which I used during testing. I didn't intend to push this
    up, this happend because of my lacking git experience. I`ll need to
    find out how to revert this change via git.
  • I made a change such that boosting exceeding the limits does not
    throw an exception any longer, because the maximum and minimum speed
    levels are checked and limited. I have enabled the one testcase you
    found and also made another with negative boositing.
  • Regarding your request about more unit tests with a small OSM file:
    I could do that, but I believe that issue cycleways are disfavored for bicycles #124 (additional
    weigthing, not only speed) should be decided first. I have marked
    the dependency at the FIXME location. I'll try to write the
    requested tests in case that you decide to merge my speed boosting
    code / relation handling things before cycleways are disfavored for bicycles #124. If on the other hand
    you decide to solve cycleways are disfavored for bicycles #124 first, then I would prefer to wait for your
    changes and write such a test after I have merged the boosting code
    to this new extended weighting.

—
Reply to this email directly or view it on GitHub
#132 (comment).

Am 16.12.2013 22:43, schrieb Peter:

Thanks!

  • Would you mind to clean things a bit? E.g. why XmlReader vs.
    existing OSMInputFile? Is it used somewhere? And "Personal
    GraphHopperWeb changes -> do not commit?" :)
  • Regarding: "This throws an exception, but boosting with 8 is an
    error as it is higher than OUTSTANDING_NICE" -> catch the
    exception and assertTrue(false) that the normal way is not used.
  • There should be more unit tests for relation handling. E.g. some
    small artificial osm.xml which shows that 1. relations are
    correctly parsed and reduce or increase some speed value etc

—
Reply to this email directly or view it on GitHub
#132 (comment).

Revert personal change in nbactions.xml, introduced in change e1f5531 Austria cycleway routing works now far better compared to the origina…
@karussell

Copy link
Copy Markdown
Member

First, we should concentrate on one thing and add tests. Then introducing another weight for bike and additional tests would be cool but should be done in a separate pull request. I.e. make every change as small and robust as possible ;)

…ll distances are shorter comared to before.

Anyhow, one test still fails and I don't have an idea why. The failed test output is as following:
Failed tests: 
  RoutingAlgorithmIT.testMonacoBike:161 FOUND 1 ERRORS.
astarbi|SHORTEST returns path not matching the expected points of 84	 Returned was 94	 (expected distance 1671.0, was 1671.983439569666) from:468-966  43.73068455771767,7.421283689825812, to:49-482  43.72768520610984,7.418755948656445.
 expected:<0> but was:<1>
@ratrun

ratrun commented Dec 19, 2013

Copy link
Copy Markdown
Contributor Author

In a first attempt to create a test for the route relation handling I
tried to make the testMonocoBike Test pass, see

github.com/ratrun/graphhopper/commit/2da7423eda9e8b7f7a85505fb9633a6177c5c57d

With this change the one run for the "astarbi" algorithm fails and I
don't have many ideas why. The failed test output is as following:

Failed tests:
RoutingAlgorithmIT.testMonacoBike:161 FOUND 1 ERRORS.
astarbi|SHORTEST returns path not matching the expected points of 84
Returned was 94 (expected distance 1671.0, was 1671.983439569666)
from:468-966 43.73068455771767,7.421283689825812, to:49-482
43.72768520610984,7.418755948656445.
expected:<0> but was:<1>

Could it be that by chance there is one other possibility , which nearly
has the same distance, but 10 points more?

Here is the code, which detects the problem:

// There are real world instances where A-B-C is identical to A-C (in
meter precision).
if (Math.abs(pointList.getSize() - pointCount) > 4)

Am 17.12.2013 20:56, schrieb Peter:

First, we should concentrate on one thing and add tests while
implementing things. Then introducing another weight for bike and
additional tests would be cool but should be done in a separate pull
request.

—
Reply to this email directly or view it on GitHub
#132 (comment).

@karussell

Copy link
Copy Markdown
Member

Were you able to understand this? To plot the route change the config.properties to use BIKE and no CH then do:

./graphhopper.sh web core/files/monaco.osm.gz

and go to the browser with the necessary points. And append &algorithm=astarbi&vehicle=bike to the URL.

In general there are too many unrelated changes.

auf Strasse

Why introduce this? What if a street has "straße" already in its name?

  •        add("footway");
    
  •        add("pedestrian");
    

We should not introduce illegal roads for the normal BikeFlagEncoder

if (way.hasTag("mtb", intended))

  •        return acceptBit;
    

The encoder should only accept normal trails, no mountainbikes

Would you mind to do the following: remove ALL unrelated changes like the above and probably more?

BUT I don't want that you throw away those useful changes. Instead we should create a MountainBikeFlagEncoder which e.g. could extend BikeFlagEncoder and could allow a bit dirty and illegal things etc ;). This should be done in a separate issue/pullrequest.

BTW: what is this :) ?

FIXME: Multiple Encoderes!!!!!!!

@ratrun

ratrun commented Dec 20, 2013

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback.

In the meantime I verified with the browser method that there are really
two nearly identical long, but different routes for the first test of
"testMonacoBike". The "dijkstrabi" algorithm chooses "Avenue de
Fontvielle", and astarbi the "Tunnel Rocher Fontvielle" and both route
result in 1.67km distance. These two solutions do have different
location points.

Regarding "Auf Strasse": In case that a road has a name, than just this
name is shown. The type of the way with a name is shown only in case
that it does not fall into the "road" category. From my perspective the
change also improves the instructions for cars. In case that it is
bicycle routing, additionally the German word "Schiebestrecke" is added
in case that the way gets classified as a "wheeler".

Regarding the wheeler ways "footway", "pedestrian" and "steps": Here I
don't agree with you: Such ways can legally be used, one just needs to
get off the bike (German:Schiebestrecke). Here I assume 4 km/h, maybe
this is too optimistic and should be reduced to 2 or 3km/h, but they
should not be avoided at all costs. In general my changes try to get
better routing results for an average bicyclist, whereas your settings
are focused on roadcycling. Both methods are valid.

I suggest to make the type of the bicycle class configurable with the
following settings - see http://wiki.openstreetmap.org/wiki/Class:bicycle

mtb, touring,roadcycling

Following types could be added in the future: commute,trailer,
non_experienced

Can you agree with this? Is this bicycle routing class on the same level
as BIKE,CAR,FOOT or just a subtype of BIKE? Another totally different
option would be to make all speed/allowed/not allowed values for the
different road type configurable, but I believe that this would become
far too complicated.

Maybe you are right by critisising that currently there are too many
unrelated changes. On the other hand, the changes for the turn
instructions are already separated in two separate commits (39ad3d0
ratrun@39ad3d0
and 6b4f4de
ratrun@6b4f4de).
So I could take them out rather easily. If possible I would like to keep
the changes within the BikeEncoder, which turned the routes into better
fitted four touring cycling.

Regarding the comment: "Multiple Encoderes!!!!!!!": Hopefully this just
can get removed: I was asking myself if it would be possible that the
encoding CAR and BICYCLE are active at the same time. In case that this
cannot happen, which I assume, then the comment can be deleted.

Am 19.12.2013 20:35, schrieb Peter:

Were you able to understand this? To plot the route change the config
to use BIKE and no CH then do:

./graphhopper.sh web core/files/monaco.osm.gz

and go to the browser with the necessary points.

In general there are too many unrelated changes.

auf Strasse

Why introduce this? What if a street has "straße" already in its name?

  * add("footway");
  * add("pedestrian");

We should not introduce illegal roads for the normal BikeFlagEncoder

if (way.hasTag("mtb", intended))

  * return acceptBit;

The encoder should only accept normal trails, no mountainbikes

Would you mind to do the following: remove ALL unrelated changes like
the above and probably more?

BUT I don't want that you throw away those useful changes. Instead we
should create a MountainBikeFlagEncoder which e.g. could extend
BikeFlagEncoder and could allow a bit dirty and illegal things etc ;).
This should be done in a separate issue/pullrequest.

BTW: what is this :) ?

FIXME: Multiple Encoderes!!!!!!!

—
Reply to this email directly or view it on GitHub
#132 (comment).

@karussell

Copy link
Copy Markdown
Member

These two solutions do have different location points.

oh, this is crazy :)
Probably change the start+end a bit that one of them is preferred?

The type of the way with a name is shown only in case that it does not fall into the "road" category.

Ok, makes sense!

Such ways can legally be used, one just needs to get off the bike (German:Schiebestrecke).

Oh, sure. Now I agree :) ! Regarding the instructions - maybe we should enhance this even more but different issue (#80)

I suggest to make the type of the bicycle class configurable
Can you agree with this?

I completely agree but not for this issue, ok?

I suggest to make the type of the bicycle class configurable

Ok, but although this configuration is probably a better solution (than extending) there is a problem of a configurable encoder: if I change the configuration which effects the flag storage etc then no error is thrown when a different configured encoder is used while reading

Hopefully this just can get removed: I was asking myself if it would be possible that the encoding CAR and BICYCLE are active at the same time.

Multiple encoders can be active at the same time - that is the idea behind the encoding manager. Only if chShortcuts is enabled (which is by default) this cannot happen.

So would you mind to

  • try to make sure it works for multiple encoders (and ask me what is unclear and what you are trying, or even better provide a simple unit test which confirms that it is not working now, so I can have a look)
  • take only out the changes regarding MTB, the other changes are good IMO.

…different routes with the same length, but different amount of locations were found. Now I moced the starting point a bit and now the algorithms "astarbi" and "dijkstrabi" give the same result.
Renaming of instruction "wheeler" into "pushing section", this seems to be the right translation.
Introduction of OSM file "krems" which is used for route relation testing.
Adding of some more BikeFalgEncoder Tests.
@ratrun

ratrun commented Dec 20, 2013

Copy link
Copy Markdown
Contributor Author

I have included a new osm file (krems) for two bicycle relation tests.
The issue about the FIXME "Multiple Encoderes!!!!!!!" was not an issue at all because this was located in code which never got executed., It was deleted in change 8c3ffee.

I believe that now I have included all discussed issues, please review.

Conflicts fixed:
	core/src/main/java/com/graphhopper/routing/Path.java
	core/src/main/java/com/graphhopper/util/Instruction.java
	core/src/main/java/com/graphhopper/util/InstructionUtil.java
	core/src/test/java/com/graphhopper/util/InstructionListTest.java
Conflicts fixed:
	core/src/main/java/com/graphhopper/routing/Path.java
	core/src/main/java/com/graphhopper/util/Instruction.java
	core/src/main/java/com/graphhopper/util/InstructionUtil.java
	core/src/test/java/com/graphhopper/util/InstructionListTest.java
@karussell

Copy link
Copy Markdown
Member

Thanks - I'll have a look!

@karussell

Copy link
Copy Markdown
Member

Indeed this produces better routes for my local area. But I need to fix the multi encoder thing as well as adding more unit tests before merging.

@karussell

Copy link
Copy Markdown
Member

In order to do the merge I need to know what relation tags are necessary to get '18' or '-18'?

flags=encoder.handleWayTags( allowed, way, 18 );
assertEquals(763, flags);
flags=encoder.handleWayTags( allowed, way, -18 );
assertEquals(707, flags);

Ok, I think here you are just testing the max+min speed limitation

@karussell

Copy link
Copy Markdown
Member

There is a minor obstacle (update: the mismatch of the routing and images is just because if outdated routing files, I just meant the strange detour for ~150 meter)

change-obstacle

for this route which should look like:

no-obstacle

Can we tune this somehow? See the branch issue_132 where I integrated your pull request.

@ratrun would you mind to ping me via email?

@ghost ghost assigned karussell Dec 22, 2013
karussell pushed a commit that referenced this pull request Dec 22, 2013
karussell pushed a commit that referenced this pull request Dec 22, 2013
… using relation flags); some minor fixes
karussell pushed a commit that referenced this pull request Dec 23, 2013
@karussell
karussell merged commit d3c753e into graphhopper:master Dec 23, 2013
@karussell

Copy link
Copy Markdown
Member

I merged your branch - thanks again!

Would you mind to look into the issue I mentioned?

@ratrun

ratrun commented Dec 23, 2013

Copy link
Copy Markdown
Contributor Author

There are no relation tags, which result in a relation code of 18 and
-18. These two tests are just artificial in case that somebody changes
the code somehow such that these codes do get used.
I introduced these two tests because at the beginning I got an exception
as the resulting speed could not be encoded.

Am 22.12.2013 17:16, schrieb Peter:

In order to do the merge I need to know what relation tags are
necessary to get '18' or '-18'?

flags=encoder.handleWayTags( allowed, way, 18 );
assertEquals(763, flags);
flags=encoder.handleWayTags( allowed, way, -18 );
  • assertEquals(707, flags);

—
Reply to this email directly or view it on GitHub
#132 (comment).

@ratrun

ratrun commented Dec 23, 2013

Copy link
Copy Markdown
Contributor Author

The result cyclepath for this case is correct. It comes from
"bicycle"="yes".

Am 22.12.2013 20:26, schrieb Peter:

Also I'm getting now cyclepath instead pushing section for the last
test here:

| map.clear();
map.put("highway", "footway");
map.put("bicycle", "yes");
map.put("surface", "grass");
wayType = encodeDecodeWayType("", way);
assertEquals("pushing section, unpaved", wayType);
|

—
Reply to this email directly or view it on GitHub
#132 (comment).

@ratrun

ratrun commented Dec 23, 2013

Copy link
Copy Markdown
Contributor Author

This detour is choosen because the HIGHWAY_SPEED for secondary is
defined rather low with 16 and therefore the slightly longer
highway=service with speed 20 is considered faster. The specifc example
additionally contains a "service=parking_aisle" tag on the parking
aisle. I'm going to specially check for this combination, because
usually one always needs to be very carful and slow down with the bike
at such locations.

Am 23.12.2013 00:23, schrieb Peter:

There is a minor obstacle

change-obstacle
https://f.cloud.github.com/assets/129644/1798638/0736d398-6b60-11e3-83c2-da326cfccd2a.png

for this route
http://graphhopper.com/maps/?point=50.038689%2C11.548412&point=50.03986%2C11.547081&vehicle=bike
which should look like:

no-obstacle
https://f.cloud.github.com/assets/129644/1798637/fee4085a-6b5f-11e3-9ac8-b34fcc53cc70.png

Can we tune this somehow?

—
Reply to this email directly or view it on GitHub
#132 (comment).

@ratrun

ratrun commented Dec 23, 2013

Copy link
Copy Markdown
Contributor Author

Please take a look at

github.com/ratrun/graphhopper/commit/7cf52f203984e7e65776f41f3504d7f718ba3523

  • this fixes the discovered detour issue.

@karussell

Copy link
Copy Markdown
Member

Indeed this fixes the problem - thanks! (and +1 that you confirmed the change via test :) !)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants