36 for (
auto it : jpFurther ) {
45 std::vector<JointPos> vect;
46 vect.push_back (jointPosFurther);
47 vect.push_back (jointPosNearer);
52 return jointPosFurther;
56 return jointPosFurther;
60 return jointPosNearer;
68 std::set <std::string>
set;
69 set.insert(jointInvolved);
75 std::stringstream output;
76 output <<
"ActionName: " <<
name << std::endl;
78 output <<
"FingersInvolved: [";
79 for (
auto fingName : fingersInvolved){
80 output << fingName <<
", " ;
82 output.seekp (-2, output.cur);
83 output <<
"]" << std::endl;
85 output <<
"Joint which moves the tips: " << jointInvolved << std::endl;
87 output <<
"JointPos Further from 0:" << std::endl;
88 output << jointPosFurther;
90 output <<
"JointPos Nearer to 0:" << std::endl;
91 output << jointPosNearer;
95 std::cout << output.str();
101 out << YAML::Key << jointInvolved;
102 out << YAML::Value << YAML::BeginMap;
104 out << YAML::Key <<
"PrimitiveType" << YAML::Value << primitiveType;
105 out << YAML::Key <<
"ActionName" << YAML::Value <<
name;
106 out << YAML::Key <<
"FingersInvolved" << YAML::Value << YAML::Flow << fingersInvolved;
108 out << YAML::Key <<
"JointPosFurther" << YAML::Value << YAML::BeginMap;
109 for (
const auto &joint : jointPosFurther) {
110 out << YAML::Key << joint.first;
111 out << YAML::Value << YAML::Flow << joint.second;
115 out << YAML::Key <<
"JointPosNearer" << YAML::Value << YAML::BeginMap;
116 for (
const auto &joint : jointPosNearer) {
117 out << YAML::Key << joint.first;
118 out << YAML::Value << YAML::Flow << joint.second;
130 jointInvolved = yamlIt->first.as < std::string > ();
132 for ( YAML::const_iterator keyValue = yamlIt->second.begin(); keyValue != yamlIt->second.end(); ++keyValue) {
133 std::string key = keyValue->first.as<std::string>();
135 if ( key.compare (
"ActionName") == 0 ){
136 name = keyValue->second.as < std::string > ();
138 }
else if (key.compare(
"FingersInvolved") == 0) {
139 std::vector <std::string> fingInvolvedVect = keyValue->second.as <std::vector < std::string >> ();
140 for (
const auto &it : fingInvolvedVect) {
141 fingersInvolved.insert(it);
144 }
else if (key.compare (
"JointPosNearer") == 0) {
145 jointPosNearer = keyValue->second.as <
JointPos>();
147 }
else if (key.compare (
"JointPosFurther") == 0) {
148 jointPosFurther = keyValue->second.as <
JointPos>();
150 }
else if (key.compare (
"PrimitiveType") == 0) {
152 keyValue->second.as <
unsigned int>() );
153 if (parsedType != primitiveType ) {
154 std::cerr <<
"[ERROR ActionSingleJointMultipleTips::" << __func__ <<
" parsed a type " << parsedType <<
155 " but this object has primitive type " << primitiveType << std::endl;
160 std::cerr <<
"[ERROR ActionSingleJointMultipleTips::" << __func__ <<
"not know key " << key <<
161 " found in the yaml file" << std::endl;
167 for (
auto it : jointPosFurther ) {
168 jointsInvolvedCount.insert (std::make_pair (it.first, 0) );
170 jointsInvolvedCount.at (jointInvolved) = 1;
172 nFingersInvolved = fingersInvolved.size();