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 fixed control cycle #42

Closed mdhom closed 3 years ago

mdhom commented 3 years ago

Hey, i want to use your library in a non-realtime environment, so i need to get the status of the trajectory at points with flexible distance in time to each other. I am not sure how to use your (python-)library here. I could imagine that using the Trajectory.at_time i could accomplish this, but then i am not sure how to implement changes in target_position, target_velocity on the fly. My thoughts would generate something like that:

  1. run update on Ruckig instance once with the target values of the beginning
  2. cyclically run at_time as long as target values haven't changed
  3. whenever target values change, run update once
  4. proceed with step 2

Could you give me a little hint how to setup this best? Thanks!

pantor commented 3 years ago

Yes, that should be good. Just as you've written, you need to call update after changing the input values, and then you can use the trajectory duration and the at_time method of the output parameters. Note that in Python the at_time method returns the new kinematic state as a tuple instead of using references like the C++ version.

mdhom commented 3 years ago

ok perfect, thanks. just another question: the duration of the trajectory i get after calling update on the fly, is it the new total duration (including all the time passed since the first call)?

pantor commented 3 years ago

Yes, it is the total duration from current to target state as in the input parameters.

mdhom commented 3 years ago

ok great, thanks. if you're ok, i'd like to provide an extra python example with this behaviour the next days?

pantor commented 3 years ago

Sure, just open a PR for that.