Git Product home page Git Product logo

Comments (3)

berndgassmann avatar berndgassmann commented on May 24, 2024

Hi,
Thanks for raising this issue.

In general the "feature" of maxSpeedOnAcceleration should only limit the actual acceleration. So yes, your statement is totally correct. The suggested changes will enforce this.

I would even go a step further and state that, theoretically, the configuration with currentSpeed >= maxSpeedOnAcceleration && acceleration<0 should never be called (that's most probably why this was not considered by the code). But when looking into calculateTimeToCoverDistance where calculateTimeForDistance is called, I see this:
result = calculateTimeForDistance(
speedAfterResponseTime, maxSpeedOnAcceleration, aAfterResponseTime, remainingDistance, requiredTime);
where the the described configuration actually can happen!
So this line of code should also change to:
result = calculateTimeForDistance(
speedAfterResponseTime, std::numeric_limits::max(), aAfterResponseTime, remainingDistance, requiredTime);
because it considers the deceleration AFTER the response time where it doesn't matter what maxSpeedOnAcceleation value is provided.

So without having tested it, I'd say you are totally right and would rate this a bug to be fixed.

from ad-rss-lib.

Freiheit1992 avatar Freiheit1992 commented on May 24, 2024

Hi, thank you for your reply,

I notice that calculateTimeForDistance is called twice in calculateTimeToCoverDistance. For the 2nd calculateTimeForDistance, yes, it's in deceleration phase; but for the first one:

result = calculateTimeForDistance(
currentSpeed, maxSpeedOnAcceleration, aUntilResponseTime, distanceToCover, requiredTime);

maybe currentSpeed >= maxSpeedOnAcceleration && acceleration<0 is still possible?

from ad-rss-lib.

berndgassmann avatar berndgassmann commented on May 24, 2024

Hi,
no the first one cannot become negative, because it's the acceleration within the response time which is >=0. While response time the worst expected case is considered, where the accel_max parameter is an upper border of it. And in the calculations only that border is of relevance.
But for sure, I'll adapt both lines of code when fixing.

from ad-rss-lib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.