add regression test for parsing the inertia
This commit is contained in:
parent
c1ff68a28e
commit
d4fa8bc8e3
|
@ -96,6 +96,7 @@ Joint toKdl(boost::shared_ptr<urdf::Joint> jnt)
|
||||||
RigidBodyInertia toKdl(boost::shared_ptr<urdf::Inertial> i)
|
RigidBodyInertia toKdl(boost::shared_ptr<urdf::Inertial> i)
|
||||||
{
|
{
|
||||||
Frame origin = toKdl(i->origin);
|
Frame origin = toKdl(i->origin);
|
||||||
|
// kdl specifies the inertia in the reference frame of the link, the urdf specifies the inertia in the inertia reference frame
|
||||||
return origin.M * RigidBodyInertia(i->mass, origin.p, RotationalInertia(i->ixx, i->iyy, i->izz, i->ixy, i->ixz, i->iyz));
|
return origin.M * RigidBodyInertia(i->mass, origin.p, RotationalInertia(i->ixx, i->iyy, i->izz, i->ixy, i->ixz, i->iyz));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,8 @@ TEST_F(TestParser, test)
|
||||||
ASSERT_TRUE(my_tree.getSegment("world") == my_tree.getRootSegment());
|
ASSERT_TRUE(my_tree.getSegment("world") == my_tree.getRootSegment());
|
||||||
ASSERT_EQ(my_tree.getRootSegment()->second.children.size(), (unsigned int)1);
|
ASSERT_EQ(my_tree.getRootSegment()->second.children.size(), (unsigned int)1);
|
||||||
ASSERT_TRUE(my_tree.getSegment("base_link")->second.parent == my_tree.getRootSegment());
|
ASSERT_TRUE(my_tree.getSegment("base_link")->second.parent == my_tree.getRootSegment());
|
||||||
|
ASSERT_EQ(my_tree.getSegment("base_link")->second.segment.getInertia().getMass(), 116.0);
|
||||||
|
ASSERT_NEAR(my_tree.getSegment("base_link")->second.segment.getInertia().getRotationalInertia().data[0], 15.6107, 0.001);
|
||||||
SUCCEED();
|
SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue