Automatically infer *limited field from *range field for joints, tendons and actuators.
PiperOrigin-RevId: 467980594 Change-Id: If635c55a90cf949796b99a41395a6c2c4f7ea094
This commit is contained in:
committed by
Copybara-Service
parent
29535a8eca
commit
4bfc2c0311
@@ -39,7 +39,7 @@ using ::testing::NotNull;
|
||||
|
||||
// ------------------------ test keyframes -------------------------------------
|
||||
|
||||
static const char* const kKeyframePath = "user/testdata/keyframe.xml";
|
||||
constexpr char kKeyframePath[] = "user/testdata/keyframe.xml";
|
||||
|
||||
TEST_F(MujocoTest, KeyFrameTest) {
|
||||
const std::string xml_path = GetTestDataFilePath(kKeyframePath);
|
||||
@@ -567,5 +567,25 @@ TEST_F(UserDataTest, NSensorTooSmall) {
|
||||
EXPECT_THAT(error.data(), HasSubstr("nuser_sensor"));
|
||||
}
|
||||
|
||||
// ------------- test for auto parsing of *limited fields -------------
|
||||
|
||||
using LimitedTest = MujocoTest;
|
||||
|
||||
constexpr char kKeyAutoLimits[] = "user/testdata/auto_limits.xml";
|
||||
|
||||
// check joint limit values when automatically inferred based on range
|
||||
TEST_F(LimitedTest, JointLimited) {
|
||||
const std::string xml_path = GetTestDataFilePath(kKeyAutoLimits);
|
||||
mjModel* model = mj_loadXML(xml_path.c_str(), nullptr, nullptr, 0);
|
||||
ASSERT_THAT(model, NotNull());
|
||||
|
||||
// see `user/testdata/auto_limits.xml` for expected values
|
||||
for (int i=0; i < model->njnt; i++) {
|
||||
EXPECT_EQ(model->jnt_limited[i], (mjtByte)model->jnt_user[i]);
|
||||
}
|
||||
|
||||
mj_deleteModel(model);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
} // namespace mujoco
|
||||
|
||||
Reference in New Issue
Block a user