pantor / ruckig

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

ghost command generated by ruckig #145

Closed jessicaleu24 closed 1 year ago

jessicaleu24 commented 1 year ago

Hi,

I'm using ruckig to control a single joint. However, I have observed that ruckig generates "ghost command" for other joints at the same time (theoretically, these joints should not move at all, since the input_parameter.current_position = input_parameter.target_position). Any reason as to why?

Thank you!

pantor commented 1 year ago

Hey @jessicaleu24,

can you provide a complete example (e.g. the input parameters) for these "ghost commands"? I assume that all current and target velocities and accelerations are zero in your case?

jessicaleu24 commented 1 year ago

HI

"I assume that all current and target velocities and accelerations are zero in your case?" -> correct

it is a 6 dof robot with input_parameter.current_position = [0 0.5 0 0 0 0] and input_parameter.target_position = [0 0 0 0 0 0] ruckig::Ruckig otg{0.000001} (0.000001 second) for some reason, the output command the first joint to quickly move to around 0.1 and comes back (so something like 0.0 ->0.1-> 0.0)

pantor commented 1 year ago

For me, these parameters

inp.current_position = [0, 0.5, 0, 0, 0, 0]
inp.target_position = [0] * 6
inp.max_velocity = [1000] * 6
inp.max_acceleration = [10000] * 6
inp.max_jerk = [10000] * 6

otg = Ruckig(inp.degrees_of_freedom, 0.000001)

or similar values result in a trajectory without any undesired motions.

otg_trajectory

Can you provide the exact input parameter (including the limits) or maybe even a standalone C++ or Python script?

jessicaleu24 commented 1 year ago

hi, not sure how to reopen this ticket here is one of the setup when the ghost command happens

J1 J2 J3 J4 J5 J6 vel_limit1 vel_limit2 vel_limit3 vel_limit4 vel_limit5 vel_limit6 acc_limit1 acc_limit2 acc_limit3 acc_limit4 acc_limit5 acc_limit6 jerk_limit1 jerk_limit2 jerk_limit3 jerk_limit4 jerk_limit5 jerk_limit6
0 0 0.2618 0 0 0 2.6704 4.71238898038 4.71238898038 4.71238898038 5.75958653158 7.330382849 20 500 500 500 500 500 20 1000 1000 1000 1000 1000
0 0 -0.2618 0 0 0 2.6704 4.71238898038 4.71238898038 4.71238898038 5.75958653158 7.330382849 20 500 500 500 500 500 20 1000 1000 1000 1000 1000

(the ghost command did not show up when I lower the vel_limit

pantor commented 1 year ago

Unfortunately I still can't reproduce the issue with the given command.

Can you copy the exact output of print(input_parameter) (Python) or std::cout << input_parameter.to_string() << std::endl; (C++)? Or better even uploading a minimal working Python or C++ script that shows the ghost commands. Thanks!

jessicaleu24 commented 1 year ago

here is the input when the ghost command happens (J3 moving -0.2618 -> 0.2618)

inp.current_position = [-2.817385524393703e-20, 0.03213189153211701, -0.224397151083723, 0, 0, 0, 0, 0, 0, 0] inp.current_velocity = [-4.695642540656168e-19, 1.287437771650503, 1.847073487610664, 0, 0, 0, 0, 0, 0, 0] inp.current_acceleration = [0, 14.72032560410805, 60.78975574464604, 0, 0, 0, 0, 0, 0, 0] inp.target_position = [0, 0, 0.2618, 0, 0, 0, 0, 0, 0, 0] inp.target_velocity = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] inp.target_acceleration = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0] inp.max_velocity = [2.6704, 4.71238898038, 4.71238898038, 4.71238898038, 5.75958653158, 7.330382849, 1, 1, 1, 1] inp.max_acceleration = [20, 500, 500, 500, 500, 500, 1, 1, 1, 1] inp.max_jerk = [20, 1000, 1000, 1000, 1000, 1000, 1, 1, 1, 1]

pantor commented 1 year ago

This is the trajectory that I get. Given your input, both J2 and J3 are moving. All other joints are behaving as expected.

otg_trajectory

Note that J2 has a initial velocity and acceleration != 0.