12 #ifdef PINOCCHIO_WITH_HPP_FCL
14 #endif // PINOCCHIO_WITH_HPP_FCL
16 #include <boost/test/unit_test.hpp>
18 #include <urdf_parser/urdf_parser.h>
20 BOOST_AUTO_TEST_SUITE(BOOST_TEST_MODULE)
26 + std::string(
"/example-robot-data/robots/romeo_description/urdf/romeo_small.urdf");
34 BOOST_CHECK(
model.nq == 31);
44 BOOST_CHECK(
model.names[1] ==
"root_joint");
47 const std::string name_ =
"freeFlyer_joint";
49 BOOST_CHECK(model_name.
names[1] == name_);
60 BOOST_CHECK_EQUAL(
model.nq, 29);
65 BOOST_CHECK_EQUAL(geomModel.
ngeoms, 2);
67 #ifdef PINOCCHIO_WITH_HPP_FCL
69 #ifdef PINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME
71 #else // PINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME
75 #ifndef PINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME
77 #else // PINOCCHIO_URDFDOM_COLLISION_WITH_GROUP_NAME
80 #endif // PINOCCHIO_WITH_HPP_FCL
85 BOOST_CHECK(model_ff.
nq == 36);
97 BOOST_CHECK_EQUAL(geomModel0.
ngeoms, 2);
105 BOOST_CHECK_EQUAL(geomModel1.
ngeoms, 2);
115 + std::string(
"/example-robot-data/robots/romeo_description/urdf/romeo_small.urdf");
120 std::string filestr((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
125 BOOST_CHECK(
model.nq == 31);
131 std::string filestr(
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
132 "<robot name=\"test\">"
133 " <link name=\"base_link\"/>"
134 " <link name=\"link_1\"/>"
135 " <link name=\"link_2\"/>"
136 " <joint name=\"joint_1\" type=\"fixed\">"
137 " <origin xyz=\"1 0 0\"/>"
138 " <axis xyz=\"0 0 1\"/>"
139 " <parent link=\"base_link\"/>"
140 " <child link=\"link_1\"/>"
142 " <joint name=\"joint_2\" type=\"fixed\">"
143 " <origin xyz=\"0 1 0\"/>"
144 " <axis xyz=\"0 0 1\"/>"
145 " <parent link=\"link_1\"/>"
146 " <child link=\"link_2\"/>"
154 link1_id =
model.getFrameId(
"link_1"),
155 link2_id =
model.getFrameId(
"link_2"),
159 BOOST_CHECK_EQUAL(base_link_id,
model.frames[
joint1_id].parentFrame);
169 + std::string(
"/example-robot-data/robots/romeo_description/urdf/romeo_small.urdf");
171 ::urdf::ModelInterfaceSharedPtr urdfTree = ::urdf::parseURDFFile(
filename);
176 BOOST_CHECK(
model.nq == 31);
183 + std::string(
"/example-robot-data/robots/romeo_description/urdf/romeo_small.urdf");
192 BOOST_CHECK(
model.nq == 38);
199 + std::string(
"/example-robot-data/robots/romeo_description/urdf/romeo_small.urdf");
204 std::string filestr((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
209 BOOST_CHECK(
model.nq == 38);
216 + std::string(
"/example-robot-data/robots/romeo_description/urdf/romeo_small.urdf");
218 ::urdf::ModelInterfaceSharedPtr urdfTree = ::urdf::parseURDFFile(
filename);
223 BOOST_CHECK(
model.nq == 38);
233 BOOST_CHECK(
model.njoints == 30);
234 const int nframes =
model.nframes;
235 const std::string filestr(
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
236 "<robot name=\"test\">"
237 " <link name=\"box\"/>"
241 BOOST_CHECK(
model.njoints == 30);
242 BOOST_CHECK(nframes + 1 ==
model.nframes);
252 BOOST_CHECK(
model.njoints == 31);
253 const std::string filestr(
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
254 "<robot name=\"test\">"
255 " <link name=\"box\"/>"
260 std::invalid_argument);
271 #if defined(PINOCCHIO_WITH_HPP_FCL)
279 + std::string(
"/example-robot-data/robots/romeo_description/urdf/romeo_small.urdf");
280 std::vector<std::string> packageDirs;
282 packageDirs.push_back(meshDir);
286 GeometryModel geomModel;
288 geomModel.addAllCollisionPairs();
290 GeometryModel geomModelOther =
292 BOOST_CHECK(geomModelOther == geomModel);
294 #endif // if defined(PINOCCHIO_WITH_HPP_FCL)
305 PINOCCHIO_MODEL_DIR + std::string(
"/../unittest/models/link_and_joint_identical_name.urdf");
308 BOOST_CHECK_THROW(
model.getFrameId(
"base"), std::invalid_argument);
313 BOOST_AUTO_TEST_SUITE_END()