Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force and Compliance Controller: Gravity Compensation #39

Open
KKSTB opened this issue Dec 2, 2021 · 5 comments · May be fixed by #40
Open

Force and Compliance Controller: Gravity Compensation #39

KKSTB opened this issue Dec 2, 2021 · 5 comments · May be fixed by #40
Labels
ROS1 solution proposed A solution has been proposed inside the issue

Comments

@KKSTB
Copy link

KKSTB commented Dec 2, 2021

I can see there is gravity compensation feature. But how should I use it properly?
In the controller yaml, I've added gravity xyz and tool com_x, com_y, com_z, mass. But I see there is something called signal_taring. How should I deal with it? Thanks!

@stefanscherzinger
Copy link
Contributor

@KKSTB

I have to admit that that's a somewhat hidden feature. I'll try to add documentation and probably rework that a little to make it more usable. After going through the code and trying to remember what I did there, I think the user was supposed to
specify tool mass and center of mass as you did in the controller's .yaml file. The signal_taring service call was optional. It should allow users to bias away additional force-torque measurements in the current robot's position. If I remember correctly, the users could call that controller's service right before biasing the sensor to zero (with a sensor-specific call).

But even after going through the code, I'm not completely sure how that worked or how the procedure was meant. Use that with care if you must. I'll work on a PR with integration test to rethink this feature on a higher level.

@stefanscherzinger stefanscherzinger linked a pull request Dec 4, 2021 that will close this issue
7 tasks
@stefanscherzinger
Copy link
Contributor

Small addition: I found an older explanation here.

@stefanscherzinger stefanscherzinger added the solution proposed A solution has been proposed inside the issue label Aug 16, 2022
@KKSTB
Copy link
Author

KKSTB commented Sep 7, 2022

I understand the algorithm now after trying it with force torque sensor. The algorithm need some fixes in order to get the compensation correct.

  1. In signalTaringCallback(), there are calls to Base::displayInTipLink() and Base::displayInBaseLink(). These functions use m_ik_solver->getPositions(). So the tare function does not get the correct joint positions if the controller is not running. So if (!Base::isRunning()), it should call Base::m_ik_solver->setStartState(Base::m_joint_handles, Base::m_joint_handle_map); to update joint positions.
  2. In signalTaringCallback() and compensateGravity(), the wrench calculated and assigned to tmp is referenced at ft_sensor_ref_link. I tested that their value actually behave very close to FT sensor wrench if plotted in graph. So their calculation should be treated similar to FT sensor wrench. Therefore they should also be frame-transformed with m_ft_sensor_transform before Base::displayInBaseLink(). Because of this requirement, I optimized the calculation by not frame-transforming in ftSensorWrenchCallback(), and not rotate to base link in signalTaringCallback() and compensateGravity(). Instead inside computeForceError() I added the raw FT sensor wrench + model weight wrench + gravity comp during taring together, and then frame-transform by m_ft_sensor_transform and rotate to base link by Base::displayInBaseLink() altogether to get the compensated value.

The compensation works after the above modifications.

@stefanscherzinger
Copy link
Contributor

@KKSTB Many thanks for sticking with this and taking the time to understand the feature!

The compensation works after the above modifications.

That's good to hear! Could you maybe provide a PR? That would be awesome for me to review and integrate.

@KKSTB
Copy link
Author

KKSTB commented Sep 30, 2022

I cherry-picked the fix to create the PR. Although I believe it should work, it would be great if someone could do some verification. Thanks for the great work of cartesian controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ROS1 solution proposed A solution has been proposed inside the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants