robotology / human-dynamics-estimation

Software repository for estimating human dynamics
BSD 3-Clause "New" or "Revised" License
81 stars 28 forks source link

Add HumanDynamicsEstimation library #246

Closed lrapetti closed 3 years ago

lrapetti commented 3 years ago

As discussed in https://github.com/robotology/human-dynamics-estimation/issues/244, with this PR we start moving part of the code contained in the implemented device, into a dedicated library.

Note that, for the sake of this PR, I am simply moving the code from InverseVelocityKinematics and Utils, as it is. The main objective is, in fact, to set up correctly the CMake project for the purpose.

lrapetti commented 3 years ago

Just a call for a consensus on the library naming! Otherwise, LGTM.

Concerning this point, for the time being, I have been using HumanDynamicsEstimation for the library, HumanDynamicsEstimationLibrary for the repository containing the library, and HumanDynamicsEstimationLibrary for the namespace. Not sure those are good choice, if you can give me some feedback/suggestion based on your experience, it would be great.

For information, this is the current structure for the file installation:

Click here to see the content of the `install` directory
total 0
drwxr-xr-x  4 lorenzorapetti  staff  128 May 13 10:38 include
drwxr-xr-x  8 lorenzorapetti  staff  256 May 13 10:38 lib
drwxr-xr-x  5 lorenzorapetti  staff  160 May 13 10:38 share

./include:
total 0
drwxr-xr-x  7 lorenzorapetti  staff  224 May 13 10:38 HumanDynamicsEstimation
drwxr-xr-x  5 lorenzorapetti  staff  160 May 13 10:38 hde

./include/HumanDynamicsEstimation:
total 72
-rw-r--r--  1 lorenzorapetti  staff   5104 May 13 10:37 HumanDynamics.h
drwxr-xr-x  4 lorenzorapetti  staff    128 May 13 10:38 HumanDynamicsEstimation
-rw-r--r--  1 lorenzorapetti  staff  11024 May 13 10:37 HumanState.h
-rw-r--r--  1 lorenzorapetti  staff   4736 May 13 10:37 Quaternion.h
-rw-r--r--  1 lorenzorapetti  staff   5055 May 13 10:37 Vector3.h

./include/HumanDynamicsEstimation/HumanDynamicsEstimation:
total 32
-rw-r--r--  1 lorenzorapetti  staff  5818 May 11 14:09 InverseVelocityKinematics.hpp
-rw-r--r--  1 lorenzorapetti  staff  4790 May 12 17:04 Utils.hpp

./include/hde:
total 24
-rw-r--r--  1 lorenzorapetti  staff   778 Dec 14 10:36 IHumanDynamics.h
-rw-r--r--  1 lorenzorapetti  staff  1211 Dec 14 10:36 IHumanState.h
-rw-r--r--  1 lorenzorapetti  staff   777 Dec 14 10:36 IHumanWrench.h

./lib:
total 19064
drwxr-xr-x   3 lorenzorapetti  staff       96 May 13 10:38 cmake
-rwxr-xr-x   1 lorenzorapetti  staff  9501604 May 13 10:38 libHumanDynamicsEstimation.2.2.0.dylib
lrwxr-xr-x   1 lorenzorapetti  staff       38 May 13 10:38 libHumanDynamicsEstimation.dylib -> libHumanDynamicsEstimation.2.2.0.dylib
-rwxr-xr-x   1 lorenzorapetti  staff    96772 May 13 10:38 libHumanDynamicsMsg.dylib
-rwxr-xr-x   1 lorenzorapetti  staff   157108 May 13 10:38 libHumanStateMsg.dylib
drwxr-xr-x  14 lorenzorapetti  staff      448 May 13 10:38 yarp

./lib/cmake:
total 0
drwxr-xr-x  6 lorenzorapetti  staff  192 May 13 10:38 HumanDynamicsEstimation

./lib/cmake/HumanDynamicsEstimation:
total 40
-rw-r--r--  1 lorenzorapetti  staff   775 May 13 10:37 HumanDynamicsEstimationConfig.cmake
-rw-r--r--  1 lorenzorapetti  staff  1977 May 13 10:37 HumanDynamicsEstimationConfigVersion.cmake
-rw-r--r--  1 lorenzorapetti  staff  2348 May 13 10:38 HumanDynamicsEstimationTargets-noconfig.cmake
-rw-r--r--  1 lorenzorapetti  staff  4530 May 13 10:38 HumanDynamicsEstimationTargets.cmake

./lib/yarp:
total 11880
-rwxr-xr-x  1 lorenzorapetti  staff   197856 May 13 10:38 HumanControlBoard.so
-rwxr-xr-x  1 lorenzorapetti  staff   430072 May 13 10:38 HumanDynamicsEstimator.so
-rwxr-xr-x  1 lorenzorapetti  staff   253072 May 13 10:38 HumanDynamicsPublisher.so
-rwxr-xr-x  1 lorenzorapetti  staff   154324 May 13 10:38 HumanDynamicsWrapper.so
-rwxr-xr-x  1 lorenzorapetti  staff   107140 May 13 10:38 HumanRobotPosePublisher.so
-rwxr-xr-x  1 lorenzorapetti  staff  3295372 May 13 10:38 HumanStateProvider.so
-rwxr-xr-x  1 lorenzorapetti  staff   334324 May 13 10:38 HumanStatePublisher.so
-rwxr-xr-x  1 lorenzorapetti  staff   153832 May 13 10:38 HumanStateRemapper.so
-rwxr-xr-x  1 lorenzorapetti  staff   167864 May 13 10:38 HumanStateWrapper.so
-rwxr-xr-x  1 lorenzorapetti  staff   426784 May 13 10:38 HumanWrenchProvider.so
-rwxr-xr-x  1 lorenzorapetti  staff   294180 May 13 10:38 RobotPositionController.so
-rwxr-xr-x  1 lorenzorapetti  staff   249664 May 13 10:38 XsensTFPublisher.so

./share:
total 0
drwxr-xr-x   6 lorenzorapetti  staff  192 May 13 10:38 HDERviz
drwxr-xr-x  30 lorenzorapetti  staff  960 May 13 10:38 HumanDynamicsEstimation
drwxr-xr-x   4 lorenzorapetti  staff  128 May 13 10:38 yarp

./share/HDERviz:
total 8
drwxr-xr-x  6 lorenzorapetti  staff  192 May 13 10:38 launch
-rw-r--r--  1 lorenzorapetti  staff  147 Dec 14 10:36 package.xml
drwxr-xr-x  5 lorenzorapetti  staff  160 May 13 10:38 rviz
drwxr-xr-x  7 lorenzorapetti  staff  224 May 13 10:38 urdfs

./share/HDERviz/launch:
total 32
-rw-r--r--  1 lorenzorapetti  staff  1522 Feb  1 12:48 HDERviz.launch
-rw-r--r--  1 lorenzorapetti  staff   565 Feb  1 12:48 iCub3Rviz.launch
-rw-r--r--  1 lorenzorapetti  staff   551 Feb  1 12:48 iCubRviz.launch
-rw-r--r--  1 lorenzorapetti  staff  1478 Feb  1 12:48 twoHumansRviz.launch

./share/HDERviz/rviz:
total 136
-rw-r--r--  1 lorenzorapetti  staff  24128 Mar 24 15:42 HDERviz.rviz
-rw-r--r--  1 lorenzorapetti  staff  10543 Feb  1 12:48 iCubRviz.rviz
-rw-r--r--  1 lorenzorapetti  staff  30678 Dec 14 10:36 twoHumansRviz.rviz

./share/HDERviz/urdfs:
total 1192
-rw-r--r--  1 lorenzorapetti  staff  141197 Feb  1 12:48 iCubGazeboV2_5.urdf
-rw-r--r--  1 lorenzorapetti  staff  127945 Dec 14 10:36 iCubGenova02.urdf
-rw-r--r--  1 lorenzorapetti  staff   91985 Dec 14 10:36 iCubGenova04.urdf
-rw-r--r--  1 lorenzorapetti  staff  157349 Dec 14 10:36 teleoperation_iCub_model_V_2_5.urdf
-rw-r--r--  1 lorenzorapetti  staff   79579 Feb  1 12:48 teleoperation_iCub_model_V_3.urdf

./share/HumanDynamicsEstimation:
total 1752
-rw-r--r--  1 lorenzorapetti  staff   23119 Mar 24 15:42 Human.xml
-rw-r--r--  1 lorenzorapetti  staff   14102 Dec 14 10:36 HumanJointTorquesYarpScope.xml
-rw-r--r--  1 lorenzorapetti  staff   13416 May 11 16:22 HumanStateProvider.xml
-rw-r--r--  1 lorenzorapetti  staff   14007 Feb  1 12:48 HumanStateProvider_second.xml
-rw-r--r--  1 lorenzorapetti  staff     520 Apr 21 11:27 HumanStateVisualizer.ini
-rw-r--r--  1 lorenzorapetti  staff     731 Mar 24 15:42 HumanStateVisualizerWithDynamics.ini
-rw-r--r--  1 lorenzorapetti  staff     531 Mar 24 15:42 HumanStateVisualizer_iCub2_5.ini
-rw-r--r--  1 lorenzorapetti  staff     529 Mar 24 15:42 HumanStateVisualizer_iCub3.ini
-rw-r--r--  1 lorenzorapetti  staff    1012 Dec 14 10:36 RobotPosePublisher.xml
-rw-r--r--  1 lorenzorapetti  staff    2051 May  5 16:34 RobotPositionController_iCub.xml
-rw-r--r--  1 lorenzorapetti  staff   10503 Feb  1 12:48 RobotStateProvider_Atlas.xml
-rw-r--r--  1 lorenzorapetti  staff   10231 Feb  1 12:48 RobotStateProvider_Baxter.xml
-rw-r--r--  1 lorenzorapetti  staff   17118 Feb  1 12:48 RobotStateProvider_Human.xml
-rw-r--r--  1 lorenzorapetti  staff   10292 Feb  1 12:48 RobotStateProvider_Nao.xml
-rw-r--r--  1 lorenzorapetti  staff   10536 Feb  1 12:48 RobotStateProvider_Walkman.xml
-rw-r--r--  1 lorenzorapetti  staff   10767 Feb  1 12:48 RobotStateProvider_iCub2_5.xml
-rw-r--r--  1 lorenzorapetti  staff   11327 Feb  1 12:48 RobotStateProvider_iCub2_5_Pole.xml
-rw-r--r--  1 lorenzorapetti  staff   10619 Feb  1 12:48 RobotStateProvider_iCub3.xml
-rw-r--r--  1 lorenzorapetti  staff   11136 Feb  1 12:48 RobotStateProvider_iCub3_Pole.xml
-rw-r--r--  1 lorenzorapetti  staff     516 Dec 14 10:36 TransformServer.xml
-rw-r--r--  1 lorenzorapetti  staff   10477 Dec 14 10:36 WholeBodyRetargeting.xml
-rw-r--r--  1 lorenzorapetti  staff   23357 Feb  1 12:48 hands-pHRI.xml
-rw-r--r--  1 lorenzorapetti  staff  141197 Feb  1 12:48 iCubGazeboV2_5.urdf
-rw-r--r--  1 lorenzorapetti  staff  127945 Dec 14 10:36 iCubGenova02.urdf
-rw-r--r--  1 lorenzorapetti  staff   91985 Dec 14 10:36 iCubGenova04.urdf
-rw-r--r--  1 lorenzorapetti  staff   25714 Feb  1 12:48 pHRI.xml
-rw-r--r--  1 lorenzorapetti  staff  157349 Dec 14 10:36 teleoperation_iCub_model_V_2_5.urdf
-rw-r--r--  1 lorenzorapetti  staff   79579 Feb  1 12:48 teleoperation_iCub_model_V_3.urdf

./share/yarp:
total 0
drwxr-xr-x  11 lorenzorapetti  staff  352 May 13 10:38 applications
drwxr-xr-x  15 lorenzorapetti  staff  480 May 13 10:38 plugins

./share/yarp/applications:
total 72
-rw-r--r--  1 lorenzorapetti  staff  3678 Feb  1 12:48 HumanDynamicsEstimation-HumanDumper.xml
-rw-r--r--  1 lorenzorapetti  staff  2121 Mar 24 15:42 HumanDynamicsEstimation-HumanDynamics.xml
-rw-r--r--  1 lorenzorapetti  staff  2337 Mar 24 15:42 HumanDynamicsEstimation-HumanKinematics.xml
-rw-r--r--  1 lorenzorapetti  staff  3670 Dec 14 10:36 HumanDynamicsEstimation-pHRI.xml
-rw-r--r--  1 lorenzorapetti  staff   746 Feb  1 12:48 HumanDynamicsEstimation.xml
-rw-r--r--  1 lorenzorapetti  staff  1290 Feb  1 12:48 XsensRetargetingPositionControlPoleiCub2_5.xml
-rw-r--r--  1 lorenzorapetti  staff  1287 Feb  1 12:48 XsensRetargetingPositionControlPoleiCub3.xml
-rw-r--r--  1 lorenzorapetti  staff  1549 Mar 24 15:42 XsensRetargetingVisualizationiCub2_5.xml
-rw-r--r--  1 lorenzorapetti  staff  1534 Mar 24 15:42 XsensRetargetingVisualizationiCub3.xml

./share/yarp/plugins:
total 104
-rw-r--r--  1 lorenzorapetti  staff  217 May 13 10:38 hde.ini
-rw-r--r--  1 lorenzorapetti  staff  146 May 13 10:38 human_control_board.ini
-rw-r--r--  1 lorenzorapetti  staff  161 May 13 10:38 human_dynamics_estimator.ini
-rw-r--r--  1 lorenzorapetti  staff  140 Dec 14 10:36 human_dynamics_publisher.ini
-rw-r--r--  1 lorenzorapetti  staff  155 May 13 10:38 human_dynamics_wrapper.ini
-rw-r--r--  1 lorenzorapetti  staff  147 Dec 14 10:36 human_robot_pose_publisher.ini
-rw-r--r--  1 lorenzorapetti  staff  149 May 13 10:38 human_state_provider.ini
-rw-r--r--  1 lorenzorapetti  staff  128 Dec 14 10:36 human_state_publisher.ini
-rw-r--r--  1 lorenzorapetti  staff  149 May 13 10:38 human_state_remapper.ini
-rw-r--r--  1 lorenzorapetti  staff  146 May 13 10:38 human_state_wrapper.ini
-rw-r--r--  1 lorenzorapetti  staff  152 May 13 10:38 human_wrench_provider.ini
-rw-r--r--  1 lorenzorapetti  staff  164 May 13 10:38 robot_position_controller.ini
-rw-r--r--  1 lorenzorapetti  staff  116 Dec 14 10:36 xsens_tf_publisher.ini

Maybe is better to avoid the /include/HumanDynamicsEstimation/HumanDynamicsEstimation path changing the name for the library?

lrapetti commented 3 years ago

Other quick pass. Nothing super important, but we can take advantage for a minor refactoring.

Thanks, it was not in the purpose of the PR, but we can take the chance also for those improvements

diegoferigo commented 3 years ago

Typically these changes either are done in these kind of occasions, or they get always postponed :)

lrapetti commented 3 years ago

Other quick pass. Nothing super important, but we can take advantage for a minor refactoring.

Thanks for the hints, I took care of the changes in https://github.com/robotology/human-dynamics-estimation/pull/246/commits/48f64fd964be1164bfc0d29d8b1d86e385156bf4

prashanthr05 commented 3 years ago

I really like the changes :)

lrapetti commented 3 years ago

Thanks to the help of @diegoferigo, with the latest commits we made some fixies in the cmake project, and also re-orgnized some of the files and installation paths.

To have an idea, those are the files that are currently installed

Click here
├── include
│   └── hde
│       ├── algorithms
│       │   └── InverseVelocityKinematics.hpp
│       ├── interfaces
│       │   ├── IHumanDynamics.h
│       │   ├── IHumanState.h
│       │   └── IHumanWrench.h
│       ├── msgs
│       │   ├── HumanDynamics.h
│       │   ├── HumanState.h
│       │   ├── Quaternion.h
│       │   └── Vector3.h
│       └── utils
│           └── iDynTreeUtils.hpp
├── lib
│   ├── cmake
│   │   └── HumanDynamicsEstimation
│   │       ├── HumanDynamicsEstimationConfig.cmake
│   │       ├── HumanDynamicsEstimationConfigVersion.cmake
│   │       ├── HumanDynamicsEstimationTargets-noconfig.cmake
│   │       └── HumanDynamicsEstimationTargets.cmake
│   ├── libHumanDynamicsEstimation_algorithms.2.2.0.dylib
│   ├── libHumanDynamicsEstimation_algorithms.dylib -> libHumanDynamicsEstimation_algorithms.2.2.0.dylib
│   ├── libHumanDynamicsEstimation_utils.2.2.0.dylib
│   ├── libHumanDynamicsEstimation_utils.dylib -> libHumanDynamicsEstimation_utils.2.2.0.dylib
│   ├── libHumanDynamicsMsg.dylib
│   ├── libHumanStateMsg.dylib
│   └── yarp
│       ├── HumanControlBoard.so
│       ├── HumanDynamicsEstimator.so
│       ├── HumanDynamicsPublisher.so
│       ├── HumanDynamicsWrapper.so
│       ├── HumanRobotPosePublisher.so
│       ├── HumanStateProvider.so
│       ├── HumanStatePublisher.so
│       ├── HumanStateRemapper.so
│       ├── HumanStateWrapper.so
│       ├── HumanWrenchProvider.so
│       ├── RobotPositionController.so
│       └── XsensTFPublisher.so
└── share
    ├── HDERviz
    │   ├── launch
    │   │   ├── HDERviz.launch
    │   │   ├── iCub3Rviz.launch
    │   │   ├── iCubRviz.launch
    │   │   └── twoHumansRviz.launch
    │   ├── package.xml
    │   ├── rviz
    │   │   ├── HDERviz.rviz
    │   │   ├── iCubRviz.rviz
    │   │   └── twoHumansRviz.rviz
    │   └── urdfs
    │       ├── iCubGazeboV2_5.urdf
    │       ├── iCubGenova02.urdf
    │       ├── iCubGenova04.urdf
    │       ├── teleoperation_iCub_model_V_2_5.urdf
    │       └── teleoperation_iCub_model_V_3.urdf
    ├── HumanDynamicsEstimation
    │   ├── Human.xml
    │   ├── HumanJointTorquesYarpScope.xml
    │   ├── HumanStateProvider.xml
    │   ├── HumanStateProvider_second.xml
    │   ├── HumanStateVisualizer.ini
    │   ├── HumanStateVisualizerWithDynamics.ini
    │   ├── HumanStateVisualizer_iCub2_5.ini
    │   ├── HumanStateVisualizer_iCub3.ini
    │   ├── RobotPosePublisher.xml
    │   ├── RobotPositionController_iCub.xml
    │   ├── RobotStateProvider_Atlas.xml
    │   ├── RobotStateProvider_Baxter.xml
    │   ├── RobotStateProvider_Human.xml
    │   ├── RobotStateProvider_Nao.xml
    │   ├── RobotStateProvider_Walkman.xml
    │   ├── RobotStateProvider_iCub2_5.xml
    │   ├── RobotStateProvider_iCub2_5_Pole.xml
    │   ├── RobotStateProvider_iCub3.xml
    │   ├── RobotStateProvider_iCub3_Pole.xml
    │   ├── TransformServer.xml
    │   ├── WholeBodyRetargeting.xml
    │   ├── hands-pHRI.xml
    │   ├── iCubGazeboV2_5.urdf
    │   ├── iCubGenova02.urdf
    │   ├── iCubGenova04.urdf
    │   ├── pHRI.xml
    │   ├── teleoperation_iCub_model_V_2_5.urdf
    │   └── teleoperation_iCub_model_V_3.urdf
    └── yarp
        ├── applications
        │   ├── HumanDynamicsEstimation-HumanDumper.xml
        │   ├── HumanDynamicsEstimation-HumanDynamics.xml
        │   ├── HumanDynamicsEstimation-HumanKinematics.xml
        │   ├── HumanDynamicsEstimation-pHRI.xml
        │   ├── HumanDynamicsEstimation.xml
        │   ├── XsensRetargetingPositionControlPoleiCub2_5.xml
        │   ├── XsensRetargetingPositionControlPoleiCub3.xml
        │   ├── XsensRetargetingVisualizationiCub2_5.xml
        │   └── XsensRetargetingVisualizationiCub3.xml
        └── plugins
            ├── hde.ini
            ├── human_control_board.ini
            ├── human_dynamics_estimator.ini
            ├── human_dynamics_publisher.ini
            ├── human_dynamics_wrapper.ini
            ├── human_robot_pose_publisher.ini
            ├── human_state_provider.ini
            ├── human_state_publisher.ini
            ├── human_state_remapper.ini
            ├── human_state_wrapper.ini
            ├── human_wrench_provider.ini
            ├── robot_position_controller.ini
            └── xsens_tf_publisher.ini

There are still some minor points open to be improved/discussed:

lrapetti commented 3 years ago

@diegoferigo I have addressed the latest comments.

it all depends if you think that there could be downstream projects that needs to consume them.

I think most likely we will need to use those in consumer devices, but, as you said, we can address this in future PRs (or in case we move the whole library outside this repo).

Let me know if there is any other comment before merging (cc @traversaro @prashanthr05 @Yeshasvitvs).

diegoferigo commented 3 years ago

LGTM! Nicely done @lrapetti.

prashanthr05 commented 3 years ago

Let me know if there is any other comment before merging (cc @traversaro @prashanthr05 @Yeshasvitvs).

None from my side, thanks to the detailed review by @diegoferigo . I have been following the updates.

lrapetti commented 3 years ago

Thanks all for your help!! I'll proceed to merge.

lrapetti commented 3 years ago

cc @DanielePucci

kouroshD commented 3 years ago

For the reference: If someone has an older version of HDE installed, we need to remove the msgs folder in order to build and install correctly the HDE. otherwise, the cache files will lead to errors while building HDE. cc @Yeshasvitvs

diegoferigo commented 3 years ago

For those using the superbuild, before updating, the following could suffice:

cd </path/to/superbuild>
cd build/src/human-dynamics-estimation
make uninstall # or, ninja uninstall
kouroshD commented 3 years ago

With @Yeshasvitvs we tried make uninstall, it was not sufficient. We needed to remove the msgs folder and the cached files inside that folder (if any, I did not checked!) inside that folder!