1 year ago

#343701

test-img

RyanChen.YLC

Why dt2 in limit_jerk in ros controller

I'm now reading ros controller source codes and trying to customize my own controller.

And I have a question about the limit_jerk in speed_limiter.cpp, which isn't a coding problem, maybe physics or numerical analysis, but I still need some help.

limit_jerk function is shown below:

double SpeedLimiter::limit_jerk(double& v, double v0, double v1, double dt)
    {
        const double tmp = v;
        if (has_jerk_limits)
        {
            const double dv  = v  - v0;
            const double dv0 = v0 - v1;
            const double dt2 = 2. * dt * dt; // why 2?
            const double da_min = min_jerk * dt2;
            const double da_max = max_jerk * dt2;
            const double da = clamp(dv - dv0, da_min, da_max);
            v = v0 + dv0 + da;
        }
        return tmp != 0.0 ? v / tmp : 1.0;
    }

Something confuses me is that dt2 = 2. *dt *dt, I don't get that what it is 2. instead of 1. by applying difference methods.

Thanks.

controller

physics

ros

numerical-methods

0 Answers

Your Answer

Accepted video resources