ami-iit / mujoco-urdf-loader

BSD 3-Clause "New" or "Revised" License
8 stars 0 forks source link

Add sensors to mujoco ergoCub #6

Open giotherobot opened 8 months ago

giotherobot commented 8 months ago
### Sensors
- [ ] IMU
- [ ] FTs
- [x] Encoders
- [ ] Touch
- [x] Camera
giotherobot commented 8 months ago

Trying to add the FT sensors programmatically I found an issue in the converted model: the fixed joints that in the URDF represent the FT location are not present in the MJCF model converted. It seems that the fixed joint gets removed in the processing, the chain does not contain a 'l_shoulder_3link for example and the connection is direct froml_shoulder_2tol_upper_arm. Both meshes ("sim_ecub_1-1_l_shoulder_2" and "sim_ecub_1-1_l_shoulder_3") are loaded into thel_shoulder_2` link.

giotherobot commented 8 months ago

Relevant section in mujoco URDF parser: https://github.com/google-deepmind/mujoco/blob/e2c14188adc8f6170aaf03a2f9c3424ab191d629/src/xml/xml_urdf.cc#L436

traversaro commented 8 months ago

Ah cool, that was exactly the first issue we faced when importing the iCub in Gazebo Classic in 2013 as well, we solved it back in time by adding an option to disable fixed joint lumping https://github.com/gazebosim/sdformat/commit/62e8dd0edfddb02b5885c87ebf1eceed6e57eb4c and https://osrf-migration.github.io/sdformat-gh-pages/#!/osrf/sdformat/pull-requests/133/page/1 . We could think of ignoring FT sensors for now.

giotherobot commented 8 months ago

Ok let's skip FTs for now, looking at mujoco there seems to be no 'fixed' joint too.

giotherobot commented 8 months ago

The same problem is present with IMUs, to place them in the URDF we are using fixed joints that vanish in the conversion to mjcf.

I think the "correct" way to deal with these should be with site elements (see https://mujoco.readthedocs.io/en/stable/XMLreference.html#body-site).

traversaro commented 8 months ago

The same problem is present with IMUs, to place them in the URDF we are using fixed joints that vanish in the conversion to mjcf.

I think the "correct" way to deal with these should be with site elements (see https://mujoco.readthedocs.io/en/stable/XMLreference.html#body-site).

Nice, also for this we have a Gazebo equivalent: https://github.com/gazebosim/sdformat/issues/262, that then was fixed in https://github.com/gazebosim/sdformat/pull/1148 .

giotherobot commented 4 months ago

@vpunithreddy is working on this for ironcub on the https://github.com/ami-iit/mujoco-urdf-loader repo, we can open issues there.

vpunithreddy commented 4 months ago

Thanks @giotherobot I have started to add sites necessary for the frames of the sensors with respect to their parent_body

I have used iRoncub-Mk3 for reference and have been progressing. As of now, I have added the

The commits are in the branch iRonCub_mjcf

image