28 bool zeros = std::all_of(jp.second.begin(), jp.second.end(), [](
double i) { return i==0.0; });
47 bool zeros = std::all_of(jp.second.begin(), jp.second.end(), [](
double i) { return i==0.0; });
69 std::set<std::string> fingersInvolved) :
Action(actionName,
Action::
Type::Generic) {
74 bool zeros = std::all_of(jp.second.begin(), jp.second.end(), [](
double i) { return i==0.0; });
102 std::vector < JointPos> vect;
103 vect.push_back ( jointPos ) ;
109 out << YAML::BeginMap << YAML::Key <<
name << YAML::Value << YAML::BeginMap ;
110 out << YAML::Key <<
"Type" << YAML::Value << type;
111 out << YAML::Key <<
"FingersInvolved" << YAML::Value << YAML::Flow << fingersInvolved;
112 out << YAML::Key <<
"JointsInvolvedCount" << YAML::Value << YAML::BeginMap;
113 for (
const auto &jointCount : jointsInvolvedCount ) {
114 out << YAML::Key << jointCount.first;
115 out << YAML::Value << jointCount.second;
119 out << YAML::Key <<
"JointPos" << YAML::Value << YAML::BeginMap;
120 for (
const auto &joint : jointPos) {
121 out << YAML::Key << joint.first;
122 out << YAML::Value << YAML::Flow << joint.second;
132 name = yamlIt->first.as<std::string>();
133 type = ROSEE::Action::Type::Generic;
135 for (
auto keyValue = yamlIt->second.begin(); keyValue != yamlIt->second.end(); ++keyValue ) {
137 std::string key = keyValue->first.as<std::string>();
139 if ( key.compare (
"FingersInvolved") == 0 ) {
141 auto tempVect = keyValue->second.as <std::vector <std::string> > ();
142 fingersInvolved.insert ( tempVect.begin(), tempVect.end() );
144 }
else if ( key.compare (
"Type") == 0 ) {
145 if (ROSEE::Action::Type::Generic !=
static_cast<ROSEE::Action::Type> ( keyValue->second.as <
unsigned int>() )) {
146 std::cout <<
"[GENERIC ACTION::" << __func__ <<
"] Error, found type " << keyValue->second.as <
unsigned int>()
147 <<
"instead of generic type (" << ROSEE::Action::Type::Generic <<
")" << std::endl;
150 type = ROSEE::Action::Type::Generic;
152 }
else if ( key.compare (
"JointsInvolvedCount") == 0 ) {
155 }
else if ( key.compare (
"JointPos") == 0 ) {
156 jointPos = keyValue->second.as <
JointPos >();
159 std::cout <<
"[GENERIC ACTION::" << __func__ <<
"] Error, not known key " << key << std::endl;