Skip to content

Commit c282094

Browse files
havesscopybara-github
authored andcommitted
Convert UsdPhysicsRevoluteJoint from degres to radians if compiler option is set.
PiperOrigin-RevId: 784574716 Change-Id: I58f65816edb782fcb41bbc721f7bed5a27741639
1 parent 46b713e commit c282094

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/experimental/usd/usd_to_mjspec.cc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,10 +1380,13 @@ void ParseUsdPhysicsJoint(mjSpec* spec, const pxr::UsdPrim& prim, mjsBody* body,
13801380
if (revolute.GetLowerLimitAttr().Get(&lower) &&
13811381
revolute.GetUpperLimitAttr().Get(&upper)) {
13821382
mj_joint->limited = mjLIMITED_TRUE;
1383-
// As per the XML Reference, the default unit for mjSpec is degrees, so we
1384-
// don't need to convert from USD (which is degrees).
1385-
mj_joint->range[0] = lower;
1386-
mj_joint->range[1] = upper;
1383+
if (spec->compiler.degree) {
1384+
mj_joint->range[0] = lower;
1385+
mj_joint->range[1] = upper;
1386+
} else {
1387+
mj_joint->range[0] = lower * M_PI / 180.0;
1388+
mj_joint->range[1] = upper * M_PI / 180.0;
1389+
}
13871390
}
13881391
} else if (prim.IsA<pxr::UsdPhysicsPrismaticJoint>()) {
13891392
pxr::UsdPhysicsPrismaticJoint prismatic(prim);

0 commit comments

Comments
 (0)