pantor / ruckig

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

Target state is not reached exactly due to discrete cycle time #59

Closed githublth closed 2 years ago

githublth commented 2 years ago

hi, I have a question, input parameters as below:

image and target_velocity and target_acceleration is not zero. when reach the last cycle(time>duration) like described in the code image parametre output as below: image only target_acceleration is correct. I don't know if I understand it correctly, let me know. thanks!

pantor commented 2 years ago

The duration of the trajectory is not a multiple of your cycle time 0.001. There is a remaining duration after the exact position, velocity and acceleration are reached. In this time, the robot continues its motions with constant acceleration, as the robot cannot suddenly stop moving without violating its kinematic limits.

If you want to reach the target state at an exact multiple of your cycle time, you can set

input.duration_discretization = DurationDiscretization::Discrete;