How to add shapenet object
I'm trying to add a shapenet object. I understand the structure of objects, but I'm really struggling to create the xml/png texture files, as specified in robosuite--right now, I'm trying to use Blender to create an object, and then export into the xml/png files respectively. I was wondering how you guys created the native objects in robosuite, and if there's a better way to do so than what I'm currently doing? Thanks!
Hi,
Are you looking to simulate shape shapes (boxes, cylinders, etc) or more complex shapes (a shoe, mug, etc)? For the former case robosuite offers a number of primitive shapes that you can programmatically create, without creating any xml manually (see here for an example).
However if you are interested in more complex shapes, the process is more involved:
- First, we recommend switching to the latest mujoco version to support
.objobject meshes. This feature was introduced in mujoco 2.1.2, and you would need to use a compatiblemujoco-pyversion that supports this version of mujoco. - You need to generate a convex collision mesh. This can be done with the
trimeshcollision package, or V-HACD. - Then you need to create a new xml for the object, using the textures and meshes you created in the previous steps. You can perhaps follow the example here for reference.
Just to let you know, our team is working on a pipeline to automatically port ShapeNet objects into robosuite. This is still in the works, we plan to release these features to the public in the coming months. Please let us know if you have additional questions.
Soroush
Hello I have a question: for step 1, I can't find a Mujoco 2.1.2 compatible mujoco-py (the official one supports mujoco210) is there some fork that make this work, or is it possible to run robosuite on >2.1.2 mujoco which is possible to install with pip install mujoco?
Thanks for the question. Indeed it is difficult to rely on mujoco-py for later versions of Mujoco. We are working right now on removing the dependency on pip install mujoco-py and instead using pip install mujoco. This involves a number of changes under the hood. We are planning to release this version in the coming weeks.
Hi, thank you for the reply! Ok I guess I'll wait for now, but is there a known workaround to this if I want to move on with this while waiting?
otherwise, do you need help/take pr related to this dependency replacement?
I tried these steps a while back for Ubuntu, hopefully they end up working for you:
-
Download
mujoco-2.1.1into~/.mujocodirectory -
Make a “fake”
mujoco210folder in the~/.mujocodirectory, and make an emptybinfolder inmujoco210 -
Add 4 symlinks exactly like this:
ln -sf ~/.mujoco/mujoco-2.1.1/lib/libglewegl.so ~/.mujoco/mujoco210/bin/libglewegl.so
ln -sf ~/.mujoco/mujoco-2.1.1/lib/libmujoco.so ~/.mujoco/mujoco210/bin/libmujoco210.so
ln -sf ~/.mujoco/mujoco-2.1.1/lib/libglewegl.so ~/.mujoco/mujoco-2.1.1/bin/libglewegl.so
ln -sf ~/.mujoco/mujoco-2.1.1/lib/libmujoco.so ~/.mujoco/mujoco-2.1.1/bin/libmujoco210.so
- Make sure your ~/.bash_rc contains these lines:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mujoco210/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/.mujoco/mujoco-2.1.1/bin
export MUJOCO_PY_MUJOCO_PATH=~/.mujoco/mujoco-2.1.1
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/nvidia
Noting here for reference (needed for older versions of robosuite):
- Export the object from blender as .obj: this gives both the .obj and the .mtl files
- Export the object as .stl
- Use obj2mjcf to get the correct .xml file structure
- Replace the .obj with the .stl (required for older versions of robosuite; not required for newer versions at the time of this post)