idyntree: cpp-visualizer: getWorldLinkTransform returns zero position

The methods getWorldLinkTransform and getWorldModelTransform of the cpp visualizer returns zero-vector for the position of all the links.

A simple way to test it is to add the following lines to the visualization loop of the idyntree-model-view

// Visualization loop
    while( visualizer.run() )
    {
        visualizer.draw();

        //print model transform
        for (size_t i = 0; i < visualizer.modelViz("model").getLinkNames().size(); i++)
        {
            std::cerr << "link number" << i << std::endl;
            std::cerr << visualizer.modelViz("model").getWorldLinkTransform(i).toString();
        }
    }

The output is the following Screenshot 2021-03-02 at 14 50 13

$ idyntree-model-view -m model.urdf
...
link number25
-0.25 -0.0669873 0.965926
-0.258819 0.965926 2.26267e-08
-0.933013 -0.25 -0.258819
 0 0 0
link number26
-0.258819 2.26267e-08 0.965926
2.97885e-09 1 -2.26267e-08
-0.965926 -2.97885e-09 -0.258819
 0 0 0
link number27
-1 8.74228e-08 1.11022e-15
8.74228e-08 1 -8.74228e-08
-8.75296e-15 -8.74228e-08 -1
 0 0 0
link number28
-0.258819 2.26267e-08 0.965926
2.97885e-09 1 -2.26267e-08
-0.965926 -2.97885e-09 -0.258819
 0 0 0
...

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 20 (20 by maintainers)

Most upvoted comments

Actually, I don’t know why the getWorldModel method exists. It always returns the identity.

If that is the case, I guess it can be either changed in order to stream the base pose, or directly removed if not used anywhere.

Let’s not remove it altogether as it would break the ABI. Modifying it to have a sane semantics make sense to me, otherwise we can just deprecated it and remove it in iDynTree 4.0

I would just deprecate it, also because it is not clear that “Model” refers to the base.

Actually, I don’t know why the getWorldModel method exists. It always returns the identity.

If that is the case, I guess it can be either changed in order to stream the base pose, or directly removed if not used anywhere.

Let’s not remove it altogether as it would break the ABI. Modifying it to have a sane semantics make sense to me, otherwise we can just deprecated it and remove it in iDynTree 4.0

Actually, I don’t know why the getWorldModel method exists. It always returns the identity.

If I remember well, I think I was trying to implement a visualizer process for base estimation back in time, the set and reset link colors were added to check the frames in contact. I do not remember why the getWorldLinkTransform() or getWorldModelTransform() were implemented though (My bad, sorry for not adding a relevant test.)

@S-Dafarra let me know if you are planning to open the PR, otherwise I can take care of it.

Feel free to push on that branch if you like 😉

I do not remember why the getWorldLinkTransform() or getWorldModelTransform() were implemented though (My bad, sorry for not adding a relevant test.)

So we can think the fix shouldn’t brake any code.

Actually, I don’t know why the getWorldModel method exists. It always returns the identity.

If that is the case, I guess it can be either changed in order to stream the base pose, or directly removed if not used anywhere.