pantor / ruckig

Motion Generation for Robots and Machines. Real-time. Jerk-constrained. Time-optimal.
https://ruckig.com
MIT License
734 stars 166 forks source link

No trajectory - (Reached target position in -9.25596e+61 [s].) #27

Closed Danielxyz123 closed 3 years ago

Danielxyz123 commented 3 years ago

There is no trajectory with these input parameters (for example):

Ruckig<1> otg {0.001};
InputParameter<1> input;
OutputParameter<1> output;

// Set input parameters
input.max_velocity = {2000};
input.max_acceleration = {18000};
input.max_jerk = { 190000};

input.current_position = {100};
input.current_velocity = {0};
input.current_acceleration = {0};

input.target_position = { 1000};
input.target_velocity = {0.0};
input.target_acceleration = {0.0};
pantor commented 3 years ago

Hi @Danielxyz123,

your trajectory is (currently) outside of Ruckigs region of numeric stability. While I haven't published the exact input requirements for numeric stability (yet), I plan to do so soon.

In the meantime, you can normalize your input with a constant factor to get input values closer to 1. So this trajectory with a factor of 0.01 is working fine:

input.max_velocity = {20};
input.max_acceleration = {180};
input.max_jerk = { 1900};

input.current_position = {1};
input.current_velocity = {0};
input.current_acceleration = {0};

input.target_position = { 10};
input.target_velocity = {0.0};
input.target_acceleration = {0.0};

Afterwards, you can just scale your output with 1/0.01. This input normalization was even integrated in Ruckig once, so maybe I'll add it back.

pantor commented 3 years ago

Anyway, I've found the root cause of this error and fixed it in the latest commit on the master branch. Can you confirm?

Also note to check the result of the update method. In case of errors, the values of the output class (e.g. the duration in the title of this issue) are invalid.

Danielxyz123 commented 3 years ago

Great, i tested some cases. Now it works just fine! Thanks a lot!