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_ #333

Closed hubernikus closed 1 year ago

hubernikus 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.

domire8 commented 1 year ago

As it was discussed internally, the controller base class should have an additional boolean parameter feedforward_force - or similar - to allow the user or derived controllers to turn this behavior on and off.

This will be done on aica-technology/control-libraries

domire8 commented 1 year ago

This has been addressed and fixed here