Gear task stl files

Discussion in 'Priority support' started by OkayHuman, Apr 17, 2019.

  1. How can I create accurate collision meshes for these STL files? In other words, I need to turn these STL files into a Mujoco environment where the pieces fit into each other.

    According to another researcher, these files work imported by default into Gazebo. Gazebo is apparently using VHACD, but when I used VHACD with these files I got totally bogus results.
     

    Attached Files:

  2. Emo Todorov

    Emo Todorov Administrator Staff Member

    When V-HACD came out people essentially assumed that the problem is solved, because the algorithm made sense and the demos generated by the author were convincing. However I have tried it briefly and it had issues with roughly half of the meshes I tested. Others are having similar difficulties apparently. I am not sure of this is an implementation issue or if the algorithm itself ignores corner cases. On the other hand, packages like Gazebo and V-Rep are using it, so maybe they did extra work to clean up the code? I don't know. But Gazebo is open-source so you could find out if they are using the original or some modified version. Something along these lines needs to be done in MuJoCo at some point...

    If I were you, I would write code to decompose your gears "manually". The other objects you can simply model as fused bodies (i.e. there is no need to model the contacts between the shaft and inner circle opening). The gears are made of identical elements repeated many times around a circle. Actually if you apply approximate decomposition to gears (with V-HACD or anything else) the approximation may cause the simulated gears to jam or otherwise malfunction. So you probably want exact decomposition in this case.
     
  3. Emo Todorov

    Emo Todorov Administrator Staff Member

    Also, don't try to decompose the SIEMENS logo :)

    And given that all the teeth on the gear are identical, you can have a single STL representing one tooth (loaded in the assets section as a mesh) and multiple geoms referencing that mesh. The geom positions and orientations can be used to repeat the mesh around the circle; those should be generated with some script.
     
  4. @Emo

    You mean write a Mujoco XML file and build the parts with Mujoco primitives? Is there a good example for something like this?
     
  5. Emo Todorov

    Emo Todorov Administrator Staff Member

    I mean write an XML file, define an STL mesh corresponding to one tooth of your gear, and then reference it from many geoms in the same body, like this:

    <asset>
    <mesh name="tooth" file="tooth.stl"/>
    </asset>

    <body>
    <geom type="cylinder" pos="0 0 0"/>
    <geom type="mesh" mesh="tooth" pos=".1 0 0" euler="0 0 0"/>
    <geom type="mesh" mesh="tooth" pos=".09 0.01 0" euler="0 0 10"/>
    ... pos="cos(x)*r sin(x)*r 0" euler="0 0 x" ...
    </body>

    Repeat as many times as there are teeth on the gear. The pos attributes will need to be computed by some script that applies 2D rotations at increasing angles and outputs the positions. The euler attributes specify the rotation of each mesh instance directly. Obviously there are other attributes you may need to adjust, but the pos and euler are the main ones that will create the gear. Be careful with radians vs degrees when specifying rotations.