robotology / idyntree

Multibody Dynamics Library designed for Free Floating Robots
BSD 3-Clause "New" or "Revised" License
168 stars 66 forks source link

iDynTree::Regressors, include documentation for writing regressor structure generally, and for floating base. #593

Closed mandralis closed 3 years ago

mandralis commented 4 years ago

Dear authors,

Would it be possible to give an example of writing the Regressor XML file for a floating base robot ? I would like to use the method loadRegressorStructureFromString(regrXml) but I am unsure how this should be specified.

In the python examples folder of the iDynTree repository, you give an example for the iCubLeftArmFTRegressor, where the following code is given:

regrXml =  '<regressor>' 
           '  <subtreeBaseDynamics>' 
           '   <FTSensorLink>r_upper_arm</FTSensorLink>' 
           '   </subtreeBaseDynamics>' 
           '</regressor>'

First of all: what do the tags <subtreeBaseDynamics> and <FTSensorLink> mean ? Secondly: what do I need to modify in order to specify the structure of the regressor for a floating base robot (for example a quadruped). Thirdly: why do we need to specify the structure of the regressor in the first place, and what should it contain in order to return an accurate regressor for the robot specified in the URDF file ?

Thank you.

traversaro commented 4 years ago

Hi @mandralis , you arrived to a part of the code that is indeed quite old and who did not received any love recently. That specific code is meant to be used with robots that have F/T sensor embedded inside their structure (the only one that I am aware of to be honest is the iCub), for implementing the regressor described in Section 7.4 of my thesis (see https://traversaro.github.io/phd-thesis/traversaro-phd-thesis.pdf) and in https://ieeexplore.ieee.org/abstract/document/7139476, https://ieeexplore.ieee.org/document/7029957/ and https://ieeexplore.ieee.org/document/7487177/ .

For identification of generic floating base systems, I suggest to use the classical inverse dynamics regressor ( equation 7.1 of https://traversaro.github.io/phd-thesis/traversaro-phd-thesis.pdf), that is available in the KinDynComputations class as KinDynComputations::inverseDynamicsInertialParametersRegressor ( https://github.com/robotology/idyntree/blob/devel/src/high-level/include/iDynTree/KinDynComputations.h#L777 ), only on the devel branch for now. The semantics of that method should be more clear (but pay attention on how you express the base velocity), and for sure it works fine in Matlab/Octave bindings, and it should also work fine from Python bindings.

mandralis commented 4 years ago

Thank you @traversaro. Is there any documentation for the classical inverse dynamics regressor i.e. how to use that method? Furthermore, where can I read about the idea of why you calculate the regressor in a certain way ?

mandralis commented 4 years ago

Another related question @traversaro. You use inverse dynamics to calculate the regressor. However, this only works if the equations of motion are already linear with respect to the inertial parameters, right ? How do you guarantee this in your code base ?

If I want to use this type of calculation in another code base what do I have to do to guarantee that the equations will be linear with respect to the inertial parameters ? Is it enough to use inertia tensors around the joint frame as shown in the paper by Atkeson et. al. ? How do you deal with the floating base ?

traversaro commented 4 years ago

Sorry for the late reply @mandralis (feel free to ping in any issue if I forgot to reply : ) ).

Thank you @traversaro. Is there any documentation for the classical inverse dynamics regressor i.e. how to use that method?

Which method do you refer with "that method" case? If you refer to inverseDynamicsInertialParametersRegressor , the precised definition is indeed given in equation 7.1 of my PhD thesis, see https://traversaro.github.io/phd-thesis/traversaro-phd-thesis.pdf . For some related literature on how to use it, you can check the following papers:

Furthermore, where can I read about the idea of why you calculate the regressor in a certain way ?

What you mean by "why you calculate the regressor in a certain way" ?

You use inverse dynamics to calculate the regressor. However, this only works if the equations of motion are already linear with respect to the inertial parameters, right ? How do you guarantee this in your code base ? If I want to use this type of calculation in another code base what do I have to do to guarantee that the equations will be linear with respect to the inertial parameters ? Is it enough to use inertia tensors around the joint frame as shown in the paper by Atkeson et. al. ?

You can always write the inverse dynamics linearly with the inertial paramers, if you properly define the mapping between the density of the body and the ℝ¹⁰ . As discussed in the paper you mentioned, the tipical trick to obtain that is to define the inertia matrix in a frame that is not placed in the center of mass. This is a discussed a bit also in https://ieeexplore.ieee.org/abstract/document/7759801, let me know if it is understanding.

How do you deal with the floating base ?

I think the paper "Identifiability and identification of inertial parameters using the underactuated base-link dynamics for legged multibody systems" mentioned before could be helpful w.r.t. to that.

traversaro commented 3 years ago

Feel free to re-open or open new issues if you think it is useful.