-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using segment cost instead of distance when processing bicycle kinematic model. #704
Comments
The same problem exists with the driving profiles when we change the It seems the |
Haven't looked into car profiles, but it could it be due to how the engine handles urban speed limit? A quick search of the codebase didn't land any clues as to how it is converted into an actual value or gets used tbh. Probably somewhere around ProcessWaySection, which has two implementations: in StdPath and in KinematicPath. |
@alex-the-new-guy |
@ALL |
https://github.com/alex-the-new-guy/brouter_kc You can spin up it as usual, just add More or less my test route. Segment is E35_N55 |
@alex-the-new-guy Something to the car profiles: the logic used here is already done when |
I assume there would be many scenarios where ETA based on/involving CF would be (much) worse than it is now. If such a profile would rather use CF based on assumed speed to address it, it would prioritize speed as decisive parameter for routing. That would be great if it is the intention, like road bikes or commuting. But it would be bad for leisure/long distance scenarios. Imagine as illustration 10 km long cases:
Based on OSM data, how would using CF affect calculated ETA of each of these segnents? Personally, for long distance travelling routes (60-140 km), when the kinematic model is adjusted (mass, power) on known routes to match their known ETA (technical, biological and cultural pauses included) and estimated ETA, I get consistently very good ETA with current ETA model. I often do not believe the provided ETA when on the route, but realising in the end that it was much closer to real value than my own gut estimation. I assume that for short routes, few way segments and any algorithm, there will be many random ETA variations for particular cases, that are rather well averaged for long routes. |
Sorry I don't have the clarity of mind to answer you properly rn, but here is something hopefully helpful. Thing is, the current algorithm would think that the three choices you've provided would take the same time, since speed calculation is just distance based. Basically what I'm proposing would calculate speed as max_speed/CF. Since it affects tire roll resistance, CF actually as fairly limited influence, especially at lower values and higher speeds. At 15 kph, your energy probably goes 50/50 into overcoming rolling resistance, which kinematic CF influences and overcoming air resistance, which kinematic CF does not influence. Also, CF that's being fed into the kinematic model for time estimation is not sort of segment CF you build in your profile, but total segment CF which also includes initial cost, turn cost and so on. Things like same surface and so on, but different CF due to road class, is a problem, yes. Can be solved with calculating kinematic CF separately based on a set of surface quality tags or something, preferably configurable with profile. For implementing which I don't have time rn. Dunno. Regarding that, the whole "CF stack" calculation should be considered. From my experience, what influences them most is surface quality and so on, not so much road classes, which means they correlate with speed halfway decently. |
Here is a patch that introduces the ability to dynamically scale rolling resistance based on the properties of the way segment: quaelnix@7ba2f14 |
@quaelnix I made some test with both logics using an old track as sample (green line, the track has some stop points, routes don't have): You find three parts where the two routings differ - the parts with unpaved areas. This has a cf level 1 and cf level 2. And it comes more to the origin speed. |
@afischerdev while we're at it, speed in computeKinematic is just set to max_speed. It can be computed from route and kinematic model parameters, see: see https://www.desmos.com/calculator/sewl51eeag It's an equation and a half, but I guess nothing that can't be implemented |
@alex-the-new-guy, that is not true: brouter/brouter-core/src/main/java/btools/router/StdPath.java Lines 230 to 231 in 109782d
|
My bad
…On Mon, Jun 3, 2024, 10:26 quaelnix ***@***.***> wrote:
@alex-the-new-guy <https://github.com/alex-the-new-guy>, that is not true:
https://github.com/abrensch/brouter/blob/109782d36225e743138923aa9feecd702171c9bf/brouter-core/src/main/java/btools/router/StdPath.java#L230-L231
—
Reply to this email directly, view it on GitHub
<#704 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A27XGOMJOH56O26LHS2N2LTZFQLDDAVCNFSM6AAAAABIOLCAAKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCNBUGQ3DKNJVHE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
A reasonably good estimate can only be expected if the parameters of the kinematic model are well tuned with regard to personal fitness ( brouter/misc/profiles2/gravel.brf Lines 15 to 20 in 584a2a8
My mixed-terrain bicycle commute is at least 30 km long and the travel time estimate is basically always closer than 1 minute to the true time if I enter somewhat proper values for above parameters. |
Ok, so don't get me wrong, but I think I have some data to prove you wrong. Also, sorry for labels in russian, it's for my thesis, and I don't have time to fuss with labels I can throw the code to github next week, but it still needs quite a bit of tweaking This graph shows expected (orange), real (blue) and expected (adjusted for power) Rolling resistance force should be constant independent of your speed and what not, it only depends on segment characteristics and your tyres and what not Now, this is using my custom profile and cf for kinematic Basically, rolling resistance actually should be near zero in "good" segments (and basically everywhere if you're not using the mod), which are also prioritized by the routing engine. You not noticing the issue could be the routing actively avoiding segments where effective rolling resistance should be high. |
Your data indeed looks really good, but it lacks the parts where According to this, rolling resistance has about as much power as air resistance at speeds around 15kph. In my case, I was going up to 30kph@300w on a paved road, then hit wet mud and speed dropped to below 10kph@150w with no incline. So 5kph section between 4 and 7 km is me going trough a swamp basically. And even if it's dry, I get consistently lower speed than brouter predicts there, since the ground there is soft and even a 2.25 xc tire feels like it's sinking into it a bit. This is very much an extreme case, but would be nice to be able to set up the profile to handle it. And if brouter uses your implementation with a separate rolling resistance modifier variable, which I think I've stated is very much superior to mine, it wold probably be the case of "better have it not need it, than need it not have it". I think people who would care about more or less detailed accounting for rolling resistance would probably also care enough to adjust their power and drag coefficient. Speaking of touching brakes and what not: Or maybe compute time with KinematicPath? Speaking of calculating speed from road conditions Not that it matters much for overall performance IMO, though I obviously haven't done any profiling proper. And also maybe probably would be a simpler piece of code than Newton method implementation Also, I have a gut feeling I might have offended you somehow. If that is true, I would like to apologize and this was never my intention. |
The reason why the estimated speed is below the actual speed on climbs and above the actual speed on decends is that BRouter assumes a constant power over the entire length of the route, whereas the actual power output was as follows:
The lag between the estimated speed and the true speed when the incline changes is caused by this exponential filter: brouter/brouter-core/src/main/java/btools/router/StdPath.java Lines 201 to 202 in 109782d
The current implementation does take the downhill force into account, but it is somewhat hidden:
Correct.
If you add this into the way context of the profile text:
the speed will be limited to 7 kph on muddy segments.
Not at all. I think this is a very worthwhile discussion, and I am not against adding the possibility of dynamic adjustment of rolling resistance. I just do not think there should be an inherent coupling between rolling resistance and segment cost. It should be up to the profile creator to decide whether or not to link segment cost and rolling resistance. |
I think we agree on that. I had to get something to work for my thesis in a very limited amount of time. This is an ass-backwards solution, but I didn't want to mess with profile interpreter. Now, for the other stuff. This is your route 1 adjusted for power Basically, you don't have any places on your route where rolling resistance contributes to resistance power significantly, slow speed is always due to air or incline, which is why I don't think your results are conclusive. Simply put, coefficient of rolling resistance is about 0.01 in most cases, and at decent speed or decent incline, the forces generated by those are huge compared to it, which is why your data matches. In my data, elevation difference is maybe 5m over the whole route, so incline is not a significant factor.
I have a rather elaborate profile which takes the grading of how wet it is out there, which does a way better job of calculating speed than just limiting it to 7. It gives decently accurate results BTW speaking of route comparing scripts, I do think those would be worthwhile additions to the package, maybe we could combine ours and turn them into something? But here again comes the question of link between cost factor and rolling resistance linking, since the way route is built is using section cost, which is not something related to speed. Would something like this work when tuning profile for building route with lowest travel time?
|
I think it would be very tricky to estimate the rolling resistance from available surface related OSM data, especially as using smoothness is rare and the mapping is incomplete. Real state is very variable for the same or similar mapping, and is further weather dependent. It would have its own random errors, different to the errors of current ETA. Saying that, it is indeed interesting option and can be good to have it in the sleave. |
Yes, but on a negative incline the kinematic model no longer works, because every time the max speed exceeds the limit: brouter/brouter-core/src/main/java/btools/router/StdPath.java Lines 230 to 231 in 109782d
you effectively lower the average power below the value that was set in bikerPower . On the first route the difference between the bikerPower and the actual average power used in the kinematic model is as high as 18 %.
I agree, but it shows that it works well unless you are driving on sand or mud or going down steep hills and that - aside from that - not knowing the momentary power is the most significant contributor to the speed difference.
It is possible to set the cost based on the estimated speed, see this profile: https://github.com/simdens/brouter_profile/blob/master/longdistance.brf
Aside from the fact that I do not think it makes sense to model turning costs as rolling resistance, it is also not possible with the current code, as you can not access the turncost inside of the profile.
I do not think it is possible to accurately predict the route with the shortest ride time without taking into account that you are not pedaling at a constant power. And even if you do take this into account, as Best Bike Split does, you are still usually going to fail on MTB trails. |
I have noticed that travel time estimates BRouter produces are sometimes several (2-2.5x consistently) times lower than actual travel time. At least partially the reason for this is that my commute is partially offroad, which kinematic model just does not handle at all, as far as I understand.
(I'm on an ~1-2 month old version which I use for my personal project though)
What I have done is:
Honestly, took me a whole lot of 15 minutes to implement (I don't know Java) and the results are looking great. Within 2-5 minutes on ~45min mixed-terrain bicycle commute.
The text was updated successfully, but these errors were encountered: