pantor / ruckig

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

error in time synchronization: 0.000000 #106

Closed mqnc closed 2 years ago

mqnc commented 2 years ago

Hi! I encountered the aforementioned error. Here are my input parameters:

inp.current_position = [1.570796326794897, -0.7853981633974483, 1.570796326794897, -2.356194490192345, -1.570796326794897, 0]
inp.current_velocity = [0, 0, 0, 0, 0, 0]
inp.current_acceleration = [0, 0, 0, 0, 0, 0]
inp.target_position = [1.329224180107117, -1.860725548727889, 2.084440302845179, -2.282429484289127, -0.5282717423818638, 0.6502926543734557]
inp.target_velocity = [-0.3363008405858447, -1.497, 0.7150613316808525, 0.102690785470124, 1.45133409988134, 0.9052946264340856]
inp.target_acceleration = [0, 0, 0, 0, 0, 0]
inp.max_velocity = [3, 3, 5, 10, 10, 10]
inp.max_acceleration = [30, 30, 50, 100, 100, 100]
inp.max_jerk = [30, 30, 50, 100, 100, 100]

and I get:

terminate called after throwing an instance of 'std::runtime_error'
  what():  [ruckig] error in time synchronization: 0.000000

Is this my fault or yours? ;)

UPDATE: I think this only happens with input.duration_discretization = ruckig::DurationDiscretization::Discrete; which makes it smell like your fault! :D

pantor commented 2 years ago

Hey @mqnc! What's the control cycle of the Ruckig instance?

mqnc commented 2 years ago

I was going to say "there is no control cycle yet, it happens during invocation of the calculate method before sampling" but of course, if ruckig is supposed to round towards the next full step, it needs to know the sampling rate during planning... How do I specify that?

pantor commented 2 years ago

Ok, this should be catched now and should return an Error::InvalidInput with the latest commit.

You can specify a control cycle just as shown in the tutorial:

Ruckig<6> ruckig {0.001}; // Number DoFs; control cycle in [s]
mqnc commented 2 years ago

Thanks! So it was my fault after all :P