Skip to content

[BUG FIX] Fix resolve SAPIEN simulation crash caused by multiple parent nodes#16

Open
Miracle-0v0 wants to merge 1 commit into
vlongle:mainfrom
Miracle-0v0:fix-multiple-parents
Open

[BUG FIX] Fix resolve SAPIEN simulation crash caused by multiple parent nodes#16
Miracle-0v0 wants to merge 1 commit into
vlongle:mainfrom
Miracle-0v0:fix-multiple-parents

Conversation

@Miracle-0v0

@Miracle-0v0 Miracle-0v0 commented Jun 3, 2026

Copy link
Copy Markdown

Description

The LLM-generated joint_pred.py occasionally assigns a single link to multiple parents (e.g., first attaching a part via place_relative_to to parent A, then using make_revolute_joint to attach it to parent B). Previously, make_revolute_joint and make_prismatic_joint failed to clear the old joint because they matched strictly by (child, parent), leaving the link with two parents. This invalid kinematic tree caused the SAPIEN engine to reject the URDF and crash without generating a video, subsequently leading to a fatal IndexError: list index out of range when accessing videos[0].

This PR fixes this by introducing a safe re-attachment mechanism in articulate_anything/api/odio_urdf.py using get_parent_link_name(child) to detect and overwrite existing joints regardless of the old parent. It also adds robust error handling in articulate_anything/agent/actor/joint_prediction/joint_actor.py to raise a descriptive RuntimeError if SAPIEN fails to yield a video.

Related Issue

Resolves #14 & #15

Motivation and Context

Reviewer-critical: The Text Modality pipeline currently lacks a Critic/retry loop mechanism. Therefore, a single physical logic hallucination by the LLM (like assigning conflicting parents) causes the entire generation pipeline to crash irrecoverably. By enforcing a strictly valid kinematic tree at the API level—while still respecting the LLM's latest parent-assignment intent—the system becomes significantly more robust against LLM hallucinations.

How Has This Been / Can This Be Tested?

Tested locally using the text_task pipeline with the door mechanism prompt (which specifically triggers the door_thumb_turn_lock multiple-parent bug).

  • Fails on main with Error: link with name door_thumb_turn_lock has multiple parents. followed by IndexError.
  • Passes with the fix: the URDF safely re-roots the link, SAPIEN simulates and generates the video successfully.
  • Also manually verified that if the video list is empty, the new RuntimeError('SAPIEN simulation failed to generate video...') is correctly raised.

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.

link placement error

1 participant