Add equalityJointAPI to mjcPhysics.

PiperOrigin-RevId: 860081702
Change-Id: Ifd961dcb2a8e0f5d885e9e9dadc0153b03cb5f4d
This commit is contained in:
Sam Haves
2026-01-23 06:27:41 -08:00
committed by Copybara-Service
parent e1992e62d7
commit 2582a83ac3
10 changed files with 547 additions and 75 deletions
+7
View File
@@ -20,6 +20,7 @@
#include <vector>
#include <mujoco/experimental/usd/mjcPhysics/actuator.h>
#include <mujoco/experimental/usd/mjcPhysics/equalityJointAPI.h>
#include <mujoco/experimental/usd/mjcPhysics/keyframe.h>
#include <mujoco/experimental/usd/mjcPhysics/siteAPI.h>
#include <mujoco/experimental/usd/mjcPhysics/tendon.h>
@@ -227,6 +228,12 @@ std::unique_ptr<Node> BuildKinematicTree(const pxr::UsdStageRefPtr stage) {
// Now that we know all the bodies, we can assign joints to respective
// nodes.
extraction.nodes[to_idx]->joints.push_back(joint.GetPath());
// If the joint has MjcPhysicsEqualityJointAPI, also add it to constraints
// so that ParseConstraint is called to create the equality constraint.
if (joint.GetPrim().HasAPI<pxr::MjcPhysicsEqualityJointAPI>()) {
extraction.nodes[to_idx]->constraints.push_back(joint.GetPath());
}
}
// The world body is represented by an empty SdfPath.