robotology / simmechanics-to-urdf

Script for converting simmechanics XML files to URDF
34 stars 8 forks source link

Respect correctly assignedMass even if a link inertia is specified via mirroredInertia #59

Closed traversaro closed 6 months ago

traversaro commented 10 months ago

This ensure that if a link has both assignedMass and mirroredInertia, assignedMass is not ignored.

Fix https://github.com/robotology/simmechanics-to-urdf/issues/58 .

This is not the perfect fix as ideally we would like for mirroredInertia to get the assignedMass from the link from which we copy the inertia parameters. However, this requires some more code changes that I do not have the time to do now, especially given that the work on the lab has been shifted to https://github.com/icub-tech-iit/creo2urdf .

traversaro commented 10 months ago

If someone wants to work on a more definitive solution I would be happy to guide him in the development of this feature.

HosameldinMohamed commented 10 months ago

I tried the solution and I'm not sure about the results I've got:

For the YAML that contains:

assignedMasses:
  l_upper_arm : 1.8703
  r_upper_arm : 1.8703

mirroredInertia:
  - mirroredLink: l_upper_arm
    originalLink: r_upper_arm
    simmetryReferenceLink: root_link
    symmetryPlane: xz

Translated with the version from this branch.

I got the following URDF:

  <link name="l_upper_arm">
    <inertial>
      <mass value="1.8703"/>
      <inertia ixx="0.0033015393386908592" ixy="-1.1642719938717833e-05" ixz="0.00024864845503107756" iyy="0.0034295590589069995" iyz="0.00022475902176983257" izz="0.001479994626864221"/>
    </inertial>
  </link>

  <link name="r_upper_arm">
    <inertial>
      <mass value="1.8703"/>
      <inertia ixx="0.0033005254762146084" ixy="-7.856912537486065e-05" ixz="0.0005314736736640653" iyy="0.003275179877659797" iyz="0.00032042055112711576" izz="0.0016353876705876744"/>
    </inertial>
  </link>

I'm not sure why I got these numbers, even if I apply the scaling implemented in the code, for example:

>> newMass = 1.8703

newMass =

    1.8703

>> oldMass = 1.6756

oldMass =

    1.6756

>> inertiaScaling = newMass / oldMass

inertiaScaling =

    1.1162

>> r_ixx = 0.0033005254762146084

r_ixx =

    0.0033

>> l_ixx = r_ixx * inertiaScaling

l_ixx =

   0.003684037239296
HosameldinMohamed commented 10 months ago

ideally we would like for mirroredInertia to get the assignedMass from the link from which we copy the inertia parameters. However, this requires some more code changes that I do not have the time to do now

I could check the code to see how much effort it takes to do it!

traversaro commented 10 months ago

I'm not sure why I got these numbers, even if I apply the scaling implemented in the code, for example:

Just to understand, what is the wrong thing in that numbers?

HosameldinMohamed commented 10 months ago

I'm not sure why I got these numbers, even if I apply the scaling implemented in the code, for example:

Just to understand, what is the wrong thing in that numbers?

I expected i_xx of l_upper_arm to be equal to the one in r_upper_arm multiplied by inertiaScaling. As I understood from your implementation in the PR. But I didn't get that result.

traversaro commented 8 months ago

Any update on this PR @HosameldinMohamed ? If you do not plan to work on this anymore, I guess we can close this PR.

HosameldinMohamed commented 8 months ago

Any update on this PR @HosameldinMohamed ? If you do not plan to work on this anymore, I guess we can close this PR.

No updates yet @traversaro, I would attempt it in a few days, otherwise I'll close it then.

traversaro commented 8 months ago

Ok, no hurry!

HosameldinMohamed commented 6 months ago

Any update on this PR @HosameldinMohamed ? If you do not plan to work on this anymore, I guess we can close this PR.

No updates yet @traversaro, I would attempt it in a few days, otherwise I'll close it then.

In the end, I don't think I'll be working on this PR anymore. So I guess we can close it.

traversaro commented 6 months ago

Any update on this PR @HosameldinMohamed ? If you do not plan to work on this anymore, I guess we can close this PR.

No updates yet @traversaro, I would attempt it in a few days, otherwise I'll close it then.

In the end, I don't think I'll be working on this PR anymore. So I guess we can close it.

Ok, thanks!