Skip to content

Add support for two other bicycle types: RACINGBIKE and MTB - #138

Merged
karussell merged 8 commits into
graphhopper:masterfrom
ratrun:master
Jan 7, 2014
Merged

karussell merged 8 commits into
graphhopper:masterfrom
ratrun:master

Conversation

@ratrun

@ratrun ratrun commented Jan 1, 2014

Copy link
Copy Markdown
Contributor

This pull request adds support for mountainbike and racingbike routing. Please note that the mountainbike routing prefers ways on which it is likely that a bicycles are not permitted!

ratrun added 2 commits January 1, 2014 10:24
…bike).

The BicycleFlagEncoders now utilise a common BikeFlagCommonEncoder and only specify the beicycle type specific settings.
Adding of the new vehicle types in the web application.
…bike).

The BicycleFlagEncoders now utilise a common BikeFlagCommonEncoder and only specify the beicycle type specific settings.
Adding of the new vehicle types in the web application.
Adding of MTB and RACINGBIKE
@ratrun

ratrun commented Jan 1, 2014

Copy link
Copy Markdown
Contributor Author

This current implementation works for me. Anyhow, the implementation could be optimized such that common bits in the flags are defined, which are shared between the different bicycle types. The current implementation duplicates e.g. the acceptBit, safeWayBit and unpavedBit bit for every encoder. On the other hand, maybe in the theses bits are do not get the same values any longer, and then such optimization would need to be reverted.

@karussell

Copy link
Copy Markdown
Member

Thanks! Nice!

Regarding the tests: would you mind to define an 'AbstractBikeFlagEncoderTester' with an abstract createFlagEncoder where then the BikeFlagEncoderTest is extended as well as the MTBFlagEncoderTest. See AbstractGraphStorageTester which has an abstract createGraph method. Then it is easily possible to overwrite test methods with a different expected result but test methods with identical results are not needed to be duplicated.

BTW: Where did you get the nice pictures or did you draw them on your own :) ?

ratrun added 3 commits January 2, 2014 18:35
…ateFlagEncoder where then the BikeFlagEncoderTest is extended as well as the MTBFlagEncoderTest. Then it is easily possible to overwrite test methods with a different expected result but test methods with identical results are not needed to be duplicated.
… and extension of testKremsBikeRelation() I detected a bug in the usage of the RelationCode bits: The bits used were not added to the bits for the ways. This resulted in different routes, depending on the list of the configured vehicle types. Now this bug is fixed, but as a side effect it is not possible to activate three encoderes in parallel, because then we would exceed the used bits.
… in changeset 4332356 was wrong. The bug that the configured vehicles influenced the result of each others was caused by using the WayBitMask instead of the RelBitMask in handleWayTags of the EncodingManager.

Additionally the SafeWayBit is commented now, as it is nowhere used.
-->With this version it is now possible to configure the combiantion of e.g. BIKE,MTB,RACINGBIKE.
@karussell

Copy link
Copy Markdown
Member

Thanks - I'll check regarding the test!

But I don't think I can accept the icons as it is not clear if they are free to use ...

@karussell

Copy link
Copy Markdown
Member

This looks really good!

Would you finally add the standard license headers to every new file and please do not hesitate to add you as the author of a new class! Not '@author User' :)

Then I would like to have the icons removed - I can create some if you like.

@karussell

Copy link
Copy Markdown
Member

@NopMap

NopMap commented Jan 4, 2014

Copy link
Copy Markdown
Contributor

The pull request for elevation data also contains an advanced bike encoder which is elevation sensitive. I hope we have no redundant work here.

I assume that these bicycle encoders are not aware of elevation differences?

@karussell

Copy link
Copy Markdown
Member

Yes, probably we have duplicate work here. But as this PR introduces less changes of the system it is safer for me to include it. Also the test coverage is good.

@ratrun

ratrun commented Jan 5, 2014

Copy link
Copy Markdown
Contributor Author

Thank you for the pics. You are an artist! I'll take them and also adopt the headers as suggested.

Am 04.01.2014 20:25, schrieb Peter:

Have a look or edit them to your needs:
http://graphhopper.com/public/pics/

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

@ratrun

ratrun commented Jan 5, 2014

Copy link
Copy Markdown
Contributor Author

The suggested changes are now in.

@karussell

Copy link
Copy Markdown
Member

Thanks :) ! Will investigate some trouble with world wide preparation of the new bike option (not tested the racing+mtb option). I would really have this online but it now seems to take forever (at least 10 times longer) to do CH-preparation ...

@ratrun

ratrun commented Jan 6, 2014

Copy link
Copy Markdown
Contributor Author

I'm sorry for the troubles. Just a stupid question: Did you test the world wide CH with #132 ? I must confess that I have concentrated on the combination BIKE, MTB, RACINGBIKE and therefore not used CH. I guess that the slow down eventually is already present in #132.

@karussell

Copy link
Copy Markdown
Member

I guess that the slow down eventually is already present in #132.

Exactly. Indeed the first commit causes the slow down - but no need to sorry!

ratrun@e1f5531

I'll find out the cause in two or three days (sadly the contraction stuff for world wide takes hours to try out every change), I'll merge here then.

karussell pushed a commit that referenced this pull request Jan 7, 2014
@karussell
karussell merged commit 465bed5 into graphhopper:master Jan 7, 2014
@karussell

Copy link
Copy Markdown
Member

What needs to be updated: either the speed factor for e.g. racing bike should be set to 1 instead 2 (which would increase the necessary bits for that encoder)

OR there can be only multiples of 2 used as speed values. E.g. all the '1' values like setTrackTypeSpeed("grade2", 1); are currently converted to 0 if I'm not wrong.

@ratrun

ratrun commented Jan 7, 2014

Copy link
Copy Markdown
Contributor Author

Thanks for detecting this, you are right. On the other hand, if we keep the way how the currently speed is detected, it does not make much sense to define speed lower compared to PUSHING_SECTION_SPEED (4 km/h). I need to think about this issue a bit. I'm going to write a testcase also for the racingbike. I want to avoid that an international unpaved cycleway gets pushed so high that it is choosen with the racing bike encoder.

@karussell

Copy link
Copy Markdown
Member

I need to think about this issue a bit.

Sure :)

Also I'm thinking about throwing an exception if precision of a value is lost. Should I? i.e. in EncodedValue.setValue: if ((long) (value/factor)) * factor != value then throw ExceptionXY. This way such mistakes will be faster to detect. WDYT?

@ratrun

ratrun commented Jan 8, 2014

Copy link
Copy Markdown
Contributor Author

I would not throw an exception in case that the encoded speed gets rounded and would consider this as an normal effect of rounding.

@ratrun

ratrun commented Jan 8, 2014

Copy link
Copy Markdown
Contributor Author

I have fixed the issue with speed, which got rounded in push 58df80d .

@karussell

Copy link
Copy Markdown
Member

Thanks!

I cannot fetch this commit somehow - would you just create another pull request? No matter how small and even: the smaller the better. plus: change the license header once more please :)

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