pantor / ruckig

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

ErrorSynchronizationCalculation goes away by lowering max jerk #96

Closed fricher closed 2 years ago

fricher commented 2 years ago

Hi @pantor

I get an ErrorSynchronizationCalculation with the following input

inp.current_position = [0.2473592757796861, 0.2921606775204735, 0.7758663276711127, 0, 3.141592653589793, 0]
inp.current_velocity = [-0.2426115138900957, 0.2200706500820608, -0.01891492763905089, 0, 0, 0]
inp.current_acceleration = [0.01877538437863763, -0.6573642866096158, 0.5, 0, 0, 0]
inp.target_position = [0.2308075286416321, 0.3066442218484541, 0.7733155040940536, 0, 3.141592653589793, 0]
inp.target_velocity = [0, 0, 0, 0, 0, 0]
inp.target_acceleration = [0, 0, 0, 0, 0, 0]
inp.max_velocity = [0.25, 0.25, 0.25, 0.35, 0.35, 0.35]
inp.max_acceleration = [2.5, 2.5, 2.5, 3.5, 3.5, 3.5]
inp.max_jerk = [62.5, 62.5, 62.5, 87.5, 87.5, 87.5]

But it works fine with a lower max jerk, e.g.:

inp.max_jerk = [32.5, 32.5, 32.5, 47.5, 47.5, 47.5]

Is this expected ?

Thanks for your help !

pantor commented 2 years ago

Hi @fricher,

no, this definitely smells like a bug. As I'm not able to reproduce this error, I might need some more information:

fricher commented 2 years ago

Hello @pantor , sorry for not answering sooner;

The problem seems to actually come from inp.duration_discretization = ruckig::DurationDiscretization::Discrete; I'm sorry I failed to mention this in my first post. Updating to master didn't help.

With delta_time=0.004 and DurationDiscretization::Continuous, update succeeds and the trajectory duration is 0.136745

With DurationDiscretization::Discrete and after enabling throw_error, I get this exception:

what():  [ruckig] error in step 2 in dof: 1 for t sync: 0.140000 input: 
inp.current_position = [0.2473592757796861, 0.2921606775204735, 0.7758663276711127, 0, 3.141592653589793, 0]
inp.current_velocity = [-0.2426115138900957, 0.2200706500820608, -0.01891492763905089, 0, 0, 0]
inp.current_acceleration = [0.01877538437863763, -0.6573642866096158, 0.5, 0, 0, 0]
inp.target_position = [0.2308075286416321, 0.3066442218484541, 0.7733155040940536, 0, 3.141592653589793, 0]
inp.target_velocity = [0, 0, 0, 0, 0, 0]
inp.target_acceleration = [0, 0, 0, 0, 0, 0]
inp.max_velocity = [0.25, 0.25, 0.25, 0.35, 0.35, 0.35]
inp.max_acceleration = [2.5, 2.5, 2.5, 3.5, 3.5, 3.5]
inp.max_jerk = [62.5, 62.5, 62.5, 87.5, 87.5, 87.5]

in calculator_target.hpp:374

pantor commented 2 years ago

Thanks for clearing that up, I can reproduce this issue now. Can you please try again using the latest commit from the master branch?