Open Yitian-Xian opened 1 year ago
Hey @Yitian-Xian,
I just noticed that your last response got lost in my mailbox. I hope you've resolved your issues, and I apologize for the delay in getting back to you 😅. If it's okay with you, I'll provide an answer here so that others can also refer to it. However, please remember that I'm not part of the @frankaemika team but an end user. So, there's a chance I may have misunderstood certain aspects.
Regarding your question above and the following question in the email:
Does this mean that gravity is always compensated in simulation, so we don't need to include the gravity term when calculating the torque? I've reviewed all the examples in the franka_example_controllers package and have yet to find any of them, including the gravity term.
You are correct in observing that gravity compensation is applied in the simulation (specifically, franka_gazebo). You can see it in the code snippet here:
As a result, if you also account for gravity when calculating the desired torque (e.g., tau_d), as seen in the cartesian_impedance_example_controller
code snippet here:
You would essentially be adding the gravity component twice. From what I recall in my conversation with @gollth, he explained that gravity compensation is handled within the franka control unit for the real robot, leading to the same conclusion.
An important point to note is that, for the simulation, when tau_external
is calculated, you do need to include the gravity component:
This is because the code snippet mentioned above applies the gravity component just before the control is applied to the simulation. Consequently, the value returned by the self->effort member doesn't include the gravity.
If there are any inaccuracies in my response, @gollth, @marcbone, or @Maverobot, please correct me 👍🏻.
Thanks @rickstaa, you nailed it perfectly =)
Hello, may I know why there is no gravity term when computing 'tau_d'?
This term is added by tau_d << tau_task + tau_nullspace + coriolis, which are from Cartesian PD control, nullspace PD control, and the coriolis effect.
Could anyone explain that? Thank you very much.