Proximity sensor does not detect mujoco composites

Typically: "How do I... ", "How can I... " questions
Post Reply
Keven Sun
Posts: 10
Joined: 15 Aug 2022, 08:13

Proximity sensor does not detect mujoco composites

Post by Keven Sun »

Hello,
I'm trying to test the robotic gripping application using the new engine Mujoco.
I find that the created composite cannot be detected by proximity sensors(the return value of the function sim.handleProximitySensor() is always '-1'). However, most gripper use the proximity sensors to get the object. What would be the best way to solve this problem?

Thank you in advance.
Best regards.

Fery64
Posts: 88
Joined: 02 Feb 2022, 15:58

Re: Proximity sensor does not detect mujoco composites

Post by Fery64 »

What does it have to do with Composites?

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

Re: Proximity sensor does not detect mujoco composites

Post by coppelia »

Hello,

yes, this is correct. MuJoCo composites are visualized as drawing object and thus are invisible to proximity sensors, collision detection or distance calculations.

There is no elegant workaround for that currently. Two dirty workarounds would be to add some code to the part where the drawing objects are updated, i.e. in the sensing section:
  • by getting the positions of the composite surface nodes, and applying those positions to pre-created dummies. Then detecting those dummies (which need to be detectable). Use simMujoco.getCompositeInfo(prefix,0) to get the positions of the surface nodes.
  • by getting the triangles of the composite surface (with simMujoco.getCompositeInfo(prefix,2) ), and creating a shape from that (sim.createMeshShape ). That might be quite slow I am afraid
Cheers

Post Reply