10 #ifndef PINOCCHIO_MODEL_DIR
11 #define PINOCCHIO_MODEL_DIR "path_to_the_model_dir"
17 return vector.end() != std::find(vector.begin(), vector.end(), elt);
20 int main(
int argc,
char ** argv)
28 + std::string(
"/example-robot-data/robots/ur_description/urdf/ur5_robot.urdf")
36 std::vector<std::string> list_of_joints_to_lock_by_name;
37 list_of_joints_to_lock_by_name.push_back(
"elbow_joint");
38 list_of_joints_to_lock_by_name.push_back(
"wrist_3_joint");
39 list_of_joints_to_lock_by_name.push_back(
"wrist_2_joint");
40 list_of_joints_to_lock_by_name.push_back(
"blabla");
43 std::vector<JointIndex> list_of_joints_to_lock_by_id;
44 for (std::vector<std::string>::const_iterator
it = list_of_joints_to_lock_by_name.begin();
45 it != list_of_joints_to_lock_by_name.end(); ++
it)
51 std::cout <<
"joint: " <<
joint_name <<
" does not belong to the model" << std::endl;
62 std::cout <<
"\n\nFIRST CASE: BUILD A REDUCED MODEL FROM A LIST OF JOINT TO LOCK" << std::endl;
67 std::cout <<
"List of joints in the original model:" << std::endl;
72 std::cout <<
"List of joints in the reduced model:" << std::endl;
74 std::cout <<
"\t- " << reduced_model.
names[
joint_id] << std::endl;
76 std::cout <<
"\n\nSECOND CASE: BUILD A REDUCED MODEL FROM A LIST OF JOINT TO KEEP UNLOCKED"
79 std::vector<std::string> list_of_joints_to_keep_unlocked_by_name;
80 list_of_joints_to_keep_unlocked_by_name.push_back(
"shoulder_pan_joint");
81 list_of_joints_to_keep_unlocked_by_name.push_back(
"shoulder_lift_joint");
82 list_of_joints_to_keep_unlocked_by_name.push_back(
"wrist_1_joint");
84 std::vector<JointIndex> list_of_joints_to_keep_unlocked_by_id;
85 for (std::vector<std::string>::const_iterator
it =
86 list_of_joints_to_keep_unlocked_by_name.begin();
87 it != list_of_joints_to_keep_unlocked_by_name.end(); ++
it)
91 list_of_joints_to_keep_unlocked_by_id.push_back(
model.getJointId(
joint_name));
93 std::cout <<
"joint: " <<
joint_name <<
" does not belong to the model";
97 list_of_joints_to_lock_by_id.clear();
105 list_of_joints_to_lock_by_id.push_back(
joint_id);
113 std::cout <<
"List of joints in the second reduced model:" << std::endl;
115 std::cout <<
"\t- " << reduced_model2.
names[
joint_id] << std::endl;