matthias-mayr / Cartesian-Impedance-Controller

A C++ implementation of Cartesian impedance control for torque-controlled manipulators with ROS bindings.
https://matthias-mayr.github.io/Cartesian-Impedance-Controller/
BSD 3-Clause "New" or "Revised" License
212 stars 32 forks source link

Any ideas for gravity compensation for gripper and workpiece weight ? #11

Closed vk4151 closed 10 months ago

vk4151 commented 1 year ago

I have been using Cartesian-Impedance-Controller, however, I observed there is always an error to the goal state. From my understanding from the repo, we need to command wrenches to compensate the gravity due to tool and workpiece.

Any ideas how to calculate wrenches dynamically during motion to compensate the gravity due to weights of the tool and workpiece?

matthias-mayr commented 1 year ago

Great to hear that the library can be of use for you.

Your observation is correct. I also intentionally left such a feature outside the controller library since e.g. the Franka Emika Robot (Panda) requires strict 1ms updates.

In the easiest version of such a compensation, one can just calculate the force vector send it to the controller. If the robot is upright, it does not even need to be transformed: https://github.com/matthias-mayr/Cartesian-Impedance-Controller/blob/104ec2e943571a687409f600ec01c7ea47401868/src/cartesian_impedance_controller_ros.cpp#L369-L392

For a more advanced version, one can look at the Cartesian controllers repo that allows for a permanent tool compensation.

This plus an adaption to work pieces could be relatively easy to integrate. I think that this would be a great a feature and would enrich the library if a normal computer can still do calculate the necessary control updates in <1ms. A PR would definitely be appreciated.

matthias-mayr commented 10 months ago

Just having been at ROSCon, I can add that in ros2_control one can chain controllers and could add one that explicitly compensates for workpieces. However, right now this controller does not support ROS 2 yet.

I hope this and the answer above addresses your question. Feel free to reopen the issues if there's anything else.