robotology / human-dynamics-estimation

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

Fix Visualizer change of base link #235

Closed lrapetti closed 3 years ago

lrapetti commented 3 years ago

Currenty, when the model require to change the base link, the change of base is not correctly done.

You can observe in the following video what happen with the iCub2.5 model with root_link_fake exposed as base by the iHumanState

https://user-images.githubusercontent.com/35487806/106469259-5c891f00-649f-11eb-832a-a0756f5704fe.mov

The cause of the problem is reported by the following observation by @S-Dafarra

When setting the model to the visualizer with https://github.com/robotology/idyntree/blob/devel/src/visualization/include/iDynTree/Visualizer.h#L750, it uses Model::getDefaultBaseLink() to determine the base link. You can change it with Model::setDefaultBaseLink() before adding the model to the visualizer.

Edit: Indeed, what you are doing in https://github.com/robotology/human-dynamics-estimation/blob/master/modules/HumanStateVisualizer/src/main.cpp#L211-L215 is correct

Edit Edit: If you change the base link in the model you already loaded, this change has an effect only if it is done before calling the init() method of the visualizer.

Following this suggestion, this PR fixes the implementation. As you can see, with the following source data, the model now behave as expected

https://user-images.githubusercontent.com/35487806/106469491-a83bc880-649f-11eb-9b64-9a4664742c7d.mov

yeshasvitirupachuri commented 3 years ago

@lrapetti if possible can you please verify the visualization with datasets that have base movement like walking

lrapetti commented 3 years ago

@lrapetti if possible can you please verify the visualization with datasets that have base movement like walking

Sure, seems to be working as expected

https://user-images.githubusercontent.com/35487806/106471246-b8ed3e00-64a1-11eb-8224-a37866fc131d.mov