Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iCubGazeboV3] Change feet collision meshes to simplified geometry #66

Closed
prashanthr05 opened this issue Nov 5, 2020 · 25 comments
Closed

Comments

@prashanthr05
Copy link

I am trying to change the feet meshes to replace it with simplified geometry.

I got the bounding box for the feet from MeshLab as,

l_foot_front l_foot_rear r_foot_front r_foot_rear
l_foot_front l_foot_rear r_foot_front_bb r_foot_rear

They all have the same dimensions and are in mm (I believe!).

However, in the URDF there seems to be a scale option for the mesh that scales the mesh's axis-aligned-bounding-box, according to http://wiki.ros.org/urdf/XML/link. There's no further explanation.

      <geometry>
        <mesh filename="package://iCub/meshes/simmechanics/sim_icub3_l_foot_rear_prt.stl" scale="0.001 0.001 0.001"/>
      </geometry>

I believe the scale is simply a unit conversion from millimeters to meters.

So I made the changes only to the collision part of the feet as

    <collision>
      <origin xyz="0.010700000000000012 -0.06475000000001183 0.9464469999999995" rpy="0 0 -1.5707963267948966"/>
<!--      
      <geometry>
        <mesh filename="package://iCub/meshes/simmechanics/sim_icub3_l_foot_rear_prt.stl" scale="0.001 0.001 0.001"/>
      </geometry>
-->
      <geometry>
        <box size="0.1 0.117 0.010299988"/>
      </geometry>
    </collision>

But looks like, there's something I am missing here, which can be seen as soon as we load the model,

ezgif com-gif-maker

Anyone's got advice/prior experience on this?
cc @nunoguedelha @traversaro @S-Dafarra @GiulioRomualdi

@S-Dafarra
Copy link
Contributor

S-Dafarra commented Nov 5, 2020

I guess this is what is done on iCub2.5

<collision>
<origin xyz="0.03 0.005 0.014" rpy="0.0 0.0 0.0"/>
<geometry>
<box size="0.16 0.072 0.001"/>
</geometry>
</collision>

Can you provide a link to your modifications?

@prashanthr05
Copy link
Author

Can you provide a link to your modifications?

I have it here for the time being.

@prashanthr05
Copy link
Author

prashanthr05 commented Nov 5, 2020

Looks like the origin for the collision geometry was modified in

<collision>
<origin xyz="0.03 0.005 0.014" rpy="0.0 0.0 0.0"/>
<geometry>
<box size="0.16 0.072 0.001"/>
</geometry>
</collision>

I hope this was not done by trial-and-error?

@S-Dafarra
Copy link
Contributor

Can you try to put the robot fixed in the air and visualize the collisions?

@traversaro
Copy link
Member

I hope this was not done by trial-and-error?

This is specified in https://github.com/robotology/icub-model-generator/blob/master/simmechanics/CMakeLists.txt#L97 that was added in robotology/icub-models-generator#85 .

@traversaro
Copy link
Member

To simplify the debug, I strong suggest to temporary disabled the visual meshes, so you would see just simplified mesh that you add. For the dimension of the box and the placement, I suggest to use as a reference the location of the l_sole frames, as I imagine was done for iCub 2.5 .

@prashanthr05
Copy link
Author

I hope this was not done by trial-and-error?

This is specified in https://github.com/robotology/icub-model-generator/blob/master/simmechanics/CMakeLists.txt#L97 that was added in robotology/icub-model-generator#85 .

I was wondering about the choice and source of the values in

<origin xyz="0.03 0.005 0.014" rpy="0.0 0.0 0.0"/>

which is different from,

<origin xyz="0.04720901500000001 -0.07009999199999985 -0.6474380002860779" rpy="-1.5707963267948961 0 -1.5707963267948961"/>

but seems to be the same as,

https://github.com/robotology/icub-model-generator/blob/5f1ccfe8031fa2bbcd341c83fd85a10a93b381bf/simmechanics/CMakeLists.txt#L116

@traversaro
Copy link
Member

<origin xyz="0.03 0.005 0.014" rpy="0.0 0.0 0.0"/>

which is different from,

<origin xyz="0.04720901500000001 -0.07009999199999985 -0.6474380002860779" rpy="-1.5707963267948961 0 -1.5707963267948961"/>

Why they should be similar? The origin of the box is placed in the center of the box (see http://wiki.ros.org/urdf/XML/link) while the origin of the visual mesh is arbitrary.

@prashanthr05
Copy link
Author

To simplify the debug, I strong suggest to temporary disabled the visual meshes, so you would see just simplified mesh that you add. For the dimension of the box and the placement, I suggest to use as a reference the location of the l_sole frames, as I imagine was done for iCub 2.5 .

I read this only now. Understood.

@prashanthr05
Copy link
Author

prashanthr05 commented Nov 6, 2020

With @FabioBergonti, we modified the visual and collision geometries for all the feet links using data from the CAD,

  <link name="r_foot_front">
   ...
    <visual>
      <origin xyz="0.0 0.0 0.003" rpy="0 0 0"/>
      <geometry>
        <box size="0.117 0.100 0.006"/>
      </geometry>
      ...
    </visual>
    <collision>
      <origin xyz="0.0 0.0 0.003" rpy="0 0 0"/>
      <geometry>
        <box size="0.117 0.100 0.006"/>
      </geometry>
    </collision>
  </link>

On loading the model, we see

View 1 View 2
Screenshot from 2020-11-06 11-41-11 Screenshot from 2020-11-06 11-52-06

Peek 2020-11-06 11-56

@S-Dafarra
Copy link
Contributor

Great @prashanthr05! From the gif it seems a little tilted. Is it only my impression? You can also try to use the fixed version to look at the feet from below

@prashanthr05
Copy link
Author

Great @prashanthr05! From the gif it seems a little tilted. Is it only my impression? You can also try to use the fixed version to look at the feet from below

It is indeed tilted because of my poor camera skills ;D.

I tried loading the fixed version in vain. It keeps falling to the ground.
The SDF format seems to be the same as fixed models in icub-gazebo, while those in icub-gazebo remain fixed, instead those in icub-models don't. Is it just me who is facing this?

@traversaro
Copy link
Member

This seems to be related to the base_link / root_link change .

@prashanthr05
Copy link
Author

This seems to be related to the base_link / root_link change .

Wow, such a memory! I am going to check this. Thanks, @traversaro !

@prashanthr05
Copy link
Author

prashanthr05 commented Nov 6, 2020

I tried loading the fixed version in vain. It keeps falling to the ground.
The SDF format seems to be the same as fixed models in icub-gazebo, while those in icub-gazebo remain fixed, instead those in icub-models don't. Is it just me who is facing this?

This seems to be related to the base_link / root_link change .

I confirm. Changing the fixed joint child from base_link to root_link, makes it work.

    <joint name="fixed_base" type="fixed">
      <parent>world</parent>
      <child>iCub::root_link</child>
    </joint>

@prashanthr05
Copy link
Author

With the fixed model,

View 1 View 2 View 3
Screenshot from 2020-11-06 12-59-49 Screenshot from 2020-11-06 12-59-19 Screenshot from 2020-11-06 12-58-27

@prashanthr05
Copy link
Author

I will open relevant PRs in the icub-model-generator.

@prashanthr05
Copy link
Author

I tried loading the fixed version in vain. It keeps falling to the ground.
The SDF format seems to be the same as fixed models in icub-gazebo, while those in icub-gazebo remain fixed, instead those in icub-models don't. Is it just me who is facing this?

This seems to be related to the base_link / root_link change .

I confirm. Changing the fixed joint child from base_link to root_link, makes it work.

    <joint name="fixed_base" type="fixed">
      <parent>world</parent>
      <child>iCub::root_link</child>
    </joint>

This has already been done in #59.

@S-Dafarra
Copy link
Contributor

Indeed, also to me the old fixed iCubV3 falls down, but the iCubGazeboV3 does not.

@prashanthr05
Copy link
Author

To introduce the changes of assigned collision geometries from here to the URDF model through icub-model-generator, I will list the steps I will follow, please correct me wherever applicable

@S-Dafarra
Copy link
Contributor

To introduce the changes of assigned collision geometries from here to the URDF model through icub-model-generator, I will list the steps I will follow, please correct me wherever applicable

@pattacini @Nicogene what do you think?

@prashanthr05
Copy link
Author

prashanthr05 commented Nov 6, 2020

Tested locally with changes made in prashanthr05/icub-model-generator@d151943 and prashanthr05/icub-model-generator@8d08a83

The diff between the files with the introduced option and without (changes for all the foot_rear/front links),

<       <origin xyz="0.0 0.0 0.003" rpy="0.0 0.0 0.0"/>
---
>       <origin xyz="0.010700000000000012 -0.06475000000001183 0.9464469999999995" rpy="0 0 -1.57079632679"/>
250c250
<         <box size="0.117 0.1 0.006"/>
---
>         <mesh filename="package://iCub/meshes/simmechanics/sim_icub3_l_foot_rear_prt.stl" scale="0.001 0.001 0.001"/>
283c283
<       <origin xyz="0.0 0.0 0.003" rpy="0.0 0.0 0.0"/>
---
>       <origin xyz="-0.10854999999999998 -0.06475000000001183 0.9464469999999995" rpy="0 0 -1.57079632679"/>
285c285
<         <box size="0.117 0.1 0.006"/>
---
>         <mesh filename="package://iCub/meshes/simmechanics/sim_icub3_l_foot_front_prt.stl" scale="0.001 0.001 0.001"/>
1202c1202
<       <origin xyz="0.0 0.0 0.003" rpy="0.0 0.0 0.0"/>
---
>       <origin xyz="-0.10850000000000011 0.06484999999993908 0.9464470000000105" rpy="0 0 -1.57079632679"/>
1204c1204
<         <box size="0.117 0.1 0.006"/>
---
>         <mesh filename="package://iCub/meshes/simmechanics/sim_icub3_r_foot_front_prt.stl" scale="0.001 0.001 0.001"/>
1230c1230
<       <origin xyz="0.0 0.0 0.003" rpy="0.0 0.0 0.0"/>
---
>       <origin xyz="0.010749999999999881 0.0648499999999391 0.9464470000000105" rpy="0 0 -1.57079632679"/>
1232c1232
<         <box size="0.117 0.1 0.006"/>
---
>         <mesh filename="package://iCub/meshes/simmechanics/sim_icub3_r_foot_rear_prt.stl" scale="0.001 0.001 0.001"/>

P.S. I had to test by disabling GENERATE_DH_MODELS and tests. See robotology/icub-models-generator#161 and robotology/icub-models-generator#159

cc @traversaro

@traversaro
Copy link
Member

P.S. I had to test by disabling GENERATE_DH_MODELS and tests. See robotology/icub-models-generator#161 and robotology/icub-models-generator#159

Yes, that is expected.

@prashanthr05
Copy link
Author

Given the merge of robotology/icub-models-generator#165, shall we close this issue?

@traversaro
Copy link
Member

Ok!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants