epfl-lasa / control-libraries

A collection of library modules to facilitate the creation of full control loop algorithms, including state representation, motion planning, kinematics, dynamics and control.
https://epfl-lasa.github.io/control-libraries
GNU General Public License v3.0
27 stars 2 forks source link

Inconsisten behavior of passing state.force_ and state.torque_ #331

Closed liuyangdh closed 1 year ago

liuyangdh commented 1 year ago

https://github.com/epfl-lasa/control-libraries/blob/main/source/controllers/src/impedance/Impedance.cpp https://github.com/epfl-lasa/control-libraries/blob/main/source/controllers/src/impedance/CompliantTwist.cpp

There is inconsistency how the different controller handle the state member value force_ and torque_.
In the Impdedance controller, using the compute_command method, the force and torque of the state just gets passed on (if none is given to the feedback state, and hence there is are force / torque in the state_error). Conversely, when using the CompliantTwist controller, force and torque from the initial state get removed through several typecasts CompliantState -> CompliantTwist. This is rather hard to detect, but leads to different behavior.

Question poses itself, if the force/torque should really be passed on like this. Since when obtaining a state from Franka, the gravity comp might already be included. If this is not set zero, before applying an (feedback) impedance controller it results in overcompensating the graivity, hence an instable controller.