Further property strings for MuJoCo

Typically: "How do I... ", "How can I... " questions
Post Reply
need2know
Posts: 22
Joined: 29 Jul 2024, 09:53

Further property strings for MuJoCo

Post by need2know »

Hi,

i want to change the attribute "fitaabb" from mujoco (see: https://mujoco.readthedocs.io/en/stable ... #body-geom).
unfortunately this attribute is not named in the standard property strings list (see: https://manual.coppeliarobotics.com/en/ ... erence.htm).

How can i change this attribute programmatically for a simulated shape?

Cheers
coppelia
Site Admin
Posts: 10738
Joined: 14 Dec 2012, 00:25

Re: Further property strings for MuJoCo

Post by coppelia »

Hello,

fitaabb is a compiler attribute, not a shape/geom attribute. But following should work:

Code: Select all

function sysCall_init()
    simMujoco = require'simMujoco'
    local info = {}
    info.element='mujoco'
    info.xml='<compiler fitaabb="true"/>'
    simMujoco.addInjection(info) 
end
Cheers
need2know
Posts: 22
Joined: 29 Jul 2024, 09:53

Re: Further property strings for MuJoCo

Post by need2know »

Hi,

by inserting this code in "sysCall_init" of an non-threaded customization-script the call "simMujoco.addInjection" generates following error:

Code: Select all

sim.genericFunctionHandler: simulation is not yet running.
inserting this code in "sysCall_init" of another simulation-script in my simulation scene has no effect to the simulation, bc the simulation starts already in the customization script.

Thanks for your help!

Cheers
coppelia
Site Admin
Posts: 10738
Joined: 14 Dec 2012, 00:25

Re: Further property strings for MuJoCo

Post by coppelia »

It should work from a simulation script. From a customization script, you'll have to add this e.g. to the sysCall_actuation section, the very first time it is called.

Cheers
need2know
Posts: 22
Joined: 29 Jul 2024, 09:53

Re: Further property strings for MuJoCo

Post by need2know »

I am currently searching for a parameter of mujoco, which allows shapes to fall into a Bin. in my current simulation scene (with default settings for mujoco) they simply lay on the surface of the boundingbox of the Bin which, obviously, has an open top. so they should fall down to the bottom of the bin and do not stay on top of the boundig box.

for visualization i sent you some pictures (@ [email protected]).

both shapes (bin and cylinder) are collidable.
all cylinders are dynamically enabled and not static
the bin is static.

both shapes are imported via stl model.

using newton or bullet, the cylinders fall into the bin by using the same simulation-code.

Cheers
coppelia
Site Admin
Posts: 10738
Joined: 14 Dec 2012, 00:25

Re: Further property strings for MuJoCo

Post by coppelia »

Hello,

from the picture, I can't see what type of shape this bin is: scene files are always better than pictures, My guess it is simply a random mesh. If this is the case, then MuJoCo and some other engines might use a convex hull alternative instead. If you do not want this, then you need to create the bin appropriately. You have several possibilities, the two main ones are:
  • Use a convex decomposition of the imported shape. This can work more or less ok depending on the type of shape. Go to [menu bar > Modules > Geometry / Mesh > Convex decomposition...]
  • Since your mesh is a simple bin, then you will probably obtain best results by approximating it via 5 cuboid primitives, grouped together. I'd still keep the original mesh for visualization (and hide the dynamically active group of 5 cuboids in a hidden layer). In the triangle edit mode you can have CoppeliaSim help you by creating the appropriate cuboids with correct orientations)
Cheers
Post Reply