Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed Oct 3, 2023
1 parent c90336a commit 3bf6f77
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/integration/joint_axis_dom.cc
Original file line number Diff line number Diff line change
Expand Up @@ -559,3 +559,29 @@ TEST(DOMJointAxis, ParseMimicInvalidLeaderAxis)
EXPECT_EQ(errors[2].Message(), errorMsg2) << errors[2];
EXPECT_EQ(errors[3].Message(), errorMsg3) << errors[3];
}

/////////////////////////////////////////////////
TEST(DOMJointAxis, ParseMimicURDF)
{
const std::string testFile =
sdf::testing::TestFile("sdf", "joint_mimic_rack_pinion.urdf");

sdf::Root root;
auto errors = root.Load(testFile);
EXPECT_TRUE(errors.empty()) << errors;

auto model = root.Model();
ASSERT_NE(nullptr, model);
auto followerJoint = model->JointByName("rack_joint");
ASSERT_NE(nullptr, followerJoint);
auto followerJointAxis = followerJoint->Axis();
ASSERT_NE(nullptr, followerJointAxis);
auto mimicJoint = followerJointAxis->Mimic();
ASSERT_NE(std::nullopt, mimicJoint);

EXPECT_EQ(mimicJoint->Joint(), "upper_joint");
EXPECT_EQ(mimicJoint->Axis(), "axis");
EXPECT_DOUBLE_EQ(mimicJoint->Multiplier(), 0.105);
EXPECT_DOUBLE_EQ(mimicJoint->Offset(), 0);
EXPECT_DOUBLE_EQ(mimicJoint->Reference(), 0);
}

0 comments on commit 3bf6f77

Please sign in to comment.