Add MjcPhysicsSiteAPI support and testing.

PiperOrigin-RevId: 759124593
Change-Id: Ic2fa2a00f8384f432ee2eef95c80f5c180aa4ca9
This commit is contained in:
Sam Haves
2025-05-15 06:37:10 -07:00
committed by Copybara-Service
parent 7ba507323d
commit 81442e06a0
3 changed files with 114 additions and 0 deletions
@@ -21,6 +21,7 @@
#include <vector>
#include <mujoco/mujoco.h>
#include "third_party/mujoco/src/experimental/usd/mjcPhysics/tokens.h"
#include "mjcf/utils.h"
#include <pxr/base/arch/attributes.h>
#include <pxr/base/gf/matrix4d.h>
@@ -834,6 +835,8 @@ class ModelWriter {
pxr::SdfPath site_path = WriteSiteGeom(site, body_path);
SetPrimPurpose(data_, site_path, pxr::UsdGeomTokens->guide);
ApplyApiSchema(data_, site_path, pxr::MjcPhysicsTokens->SiteAPI);
int site_id = mjs_getId(site->element);
auto transform = MujocoPosQuatToTransform(&model_->site_pos[3 * site_id],
&model_->site_quat[4 * site_id]);