Skip to content

fix(robotics): enable collider for mesh-bearing URDF collision links - #5

Open
aki-xavier wants to merge 1 commit into
facebookresearch:mainfrom
aki-xavier:fix/urdf-collider-auto
Open

aki-xavier wants to merge 1 commit into
facebookresearch:mainfrom
aki-xavier:fix/urdf-collider-auto

Conversation

@aki-xavier

Copy link
Copy Markdown

Problem

LoadBotPrefabFromUrdfFile fills shapeFile/shapeRotation/shapeTranslation/shapeScale for mesh-bearing <collision> geometry, but leaves colliderType at the prefab default (ColliderType::None). The resulting Bot has no collision representation at all:

  • mochi contact queries on the actor are refused with the error "Contact queries are only supported for actors with contact sample points." (the prefab default leaves the colliders off, so no contact sample points are generated);
  • no contact is produced against other actors, so contact force/torque reads and contact-aware controllers see a contactless robot.

Change

When a URDF <collision> mesh resolves on disk, set link->colliderType = ColliderType::Auto so the link participates in contact. Links without a mesh collision (or with only primitive geometry) keep the prefab default and remain untouched.

This mirrors what the old importer's mesh-based collision path was meant to do, and is required for both mochi's contact queries and the contact simulation itself.

Tests

Added to urdf_mesh_resolution_test.cpp:

  • MeshCollisionEnablesColliderType — mesh <collision>shapeFile set and colliderType == Auto;
  • PrimitiveCollisionKeepsDefaultColliderType — primitive-only <collision>shapeFile empty and colliderType == None (unchanged default).

Verification (point of failure → after)

Using a 6-DOF arm URDF whose collision meshes are STL meshes: before the fix every link reports colliderType=0 (None) and RegisterQuery(QueryType::TotalContactForce) fails for all links; after the fix, mesh-bearing links report a real collider (resolved to the SDF collider), contact queries register, and a wall-push experiment produces a real contact wrench (bounded, stable contact force scaling with controller stiffness).

Note: the importer's existing behavior of skipping primitive <collision> geometry (boxes/cylinders/spheres) is unchanged — such links still get no collider, which is why a URDF whose collisions are all primitives must be given mesh collisions (or the importer extended later) to become contact-enabled.

The URDF importer fills `shapeFile`/shape transforms for mesh-bearing
<collision> geometry but leaves `colliderType` at the prefab default
(ColliderType::None). The resulting bot has no collision representation:
mochi contact queries (TotalContactForce / ContactPoints) are refused
("Contact queries are only supported for actors with contact sample
points") and no contact is generated with other actors.

Set ColliderType::Auto when a collision mesh resolves, so imported URDF
bots participate in contact. Links without a mesh collision keep the
default unchanged.

Regression tests: mesh collision -> Auto, primitive-only collision ->
None.
@meta-cla

meta-cla Bot commented Sep 9, 2026

Copy link
Copy Markdown

Hi @aki-xavier!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@epezentFB

Copy link
Copy Markdown

@aki-xavier Can you help me understand the problem a bit better? I'm not sure this is fixing a bug:

  1. Tracing the lineage of BotLinkPrefab::colliderType takes us to ArticulatedLinkParams where it is Auto:

  2. If I import a URDF into SuperDex Studio, mesh bearing links have Auto for collision:

image

@epezentFB

Copy link
Copy Markdown

Could you please also share the URDF if possible?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants