mj_usd plugin: add joints export.

Note that ball joint is missing, will come later.

PiperOrigin-RevId: 776057523
Change-Id: I8d13c3ea9e7f3d894af73a4640eb93202f8a2a03
This commit is contained in:
Robin Alazard
2025-06-26 03:01:31 -07:00
committed by Copybara-Service
parent 48205fb570
commit 3441e0aa03
4 changed files with 626 additions and 25 deletions
+21
View File
@@ -18,6 +18,7 @@
#include <string>
#include <gtest/gtest.h>
#include <pxr/base/gf/quatf.h>
#include <pxr/usd/sdf/assetPath.h>
#include <pxr/usd/sdf/declareHandles.h>
#include <pxr/usd/sdf/fileFormat.h>
@@ -29,6 +30,9 @@
#define EXPECT_PRIM_VALID(stage, path) \
EXPECT_TRUE((stage)->GetPrimAtPath(SdfPath(path)).IsValid());
#define EXPECT_PRIM_INVALID(stage, path) \
EXPECT_FALSE((stage)->GetPrimAtPath(SdfPath(path)).IsValid());
#define EXPECT_PRIM_IS_A(stage, path, type) \
{ \
EXPECT_TRUE((stage)->GetPrimAtPath(SdfPath(path)).IsA<type>()); \
@@ -66,6 +70,19 @@
#define EXPECT_ATTRIBUTE_HAS_NO_VALUE(stage, path) \
EXPECT_FALSE((stage)->GetAttributeAtPath(SdfPath(path)).HasValue());
#define EXPECT_ATTRIBUTE_HAS_AUTHORED_VALUE(stage, path) \
EXPECT_TRUE((stage)->GetAttributeAtPath(SdfPath(path)).HasAuthoredValue());
#define EXPECT_ATTRIBUTE_HAS_NO_AUTHORED_VALUE(stage, path) \
EXPECT_FALSE((stage)->GetAttributeAtPath(SdfPath(path)).HasAuthoredValue());
#define EXPECT_REL_TARGET_COUNT(stage, path, count) \
{ \
pxr::SdfPathVector targets; \
(stage)->GetRelationshipAtPath(SdfPath(path)).GetTargets(&targets); \
EXPECT_TRUE(targets.size() == count); \
}
#define EXPECT_REL_HAS_TARGET(stage, path, target_path) \
{ \
pxr::SdfPathVector targets; \
@@ -115,6 +132,10 @@ void ExpectAttributeHasConnection(pxr::UsdStageRefPtr stage, const char* path,
// Checks that all authored attributes on the given prim have types that match
// the schema types.
void ExpectAllAuthoredAttributesMatchSchemaTypes(const pxr::UsdPrim& prim);
// Checks if two quaternions represent the same rotation.
bool AreQuatsSameRotation(const pxr::GfQuatf& q1, const pxr::GfQuatf& q2,
float tolerance = 1e-6);
} // namespace usd
} // namespace mujoco
#endif // MUJOCO_TEST_EXPERIMENTAL_USD_PLUGINS_MJCF_FIXTURE_H_