ruckig icon indicating copy to clipboard operation
ruckig copied to clipboard

Optimization of time precision problem

Open Ydaos opened this issue 6 months ago • 1 comments

This kinematics state can't find profile. In fact exist nice solution 'ReachedLimits::VEL', but it solve t[6] = -5.5511151231257827e-17 less than zero so function 'profile->check' return false.

Ruckig<1> otg(0.01);  // control cycle
InputParameter<1> input;
OutputParameter<1> output;

input.current_position = { -3.446 };
input.current_velocity = { 0.551 };
input.current_acceleration = { 2.159 };

input.target_position = { 1.382 };
input.target_velocity = { 2.516 };
input.target_acceleration = { -2.2 };

input.max_velocity = { 3.0 };
input.max_acceleration = { 4.0 };
input.max_jerk = { 5.0 };

Maybe we should add these code in funciton 'profile->check<>'

bool check(double jf, double vMax, double vMin, double aMax, double aMin) {
        for (size_t i = 0; i < 7; ++i) {
            if (abs(t[i]) < t_precision) {
                t[i] = 0;
            }
        }

      ......
}

Ydaos avatar May 08 '25 05:05 Ydaos

Thanks for the report. There are quite a few numerical issues in the community version - these issues are fixed in the Pro version. I think your suggestion is not the way forward, as it allows trajectories which are actually infeasible to be returned.

You case is in some way special: The target acceleration is just on the border of being reachable. I think it's fine that Ruckig isn't able to find a trajectory, as the floating point input that Ruckig sees is actually infeasible, but that the check in the validate_input method doesn't catch this issue.

pantor avatar May 16 '25 14:05 pantor