27 for (
auto jp : jointPos) {
28 bool zeros = std::all_of(jp.second.begin(), jp.second.end(), [](
double i) {
return i==0.0; });
46 for (
auto jp : jointPos) {
47 bool zeros = std::all_of(jp.second.begin(), jp.second.end(), [](
double i) {
return i==0.0; });
73 for (
auto jp : jointPos) {
74 bool zeros = std::all_of(jp.second.begin(), jp.second.end(), [](
double i) {
return i==0.0; });
102 std::vector < JointPos> vect;
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;
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> > ();
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 ) {
159 std::cout <<
"[GENERIC ACTION::" << __func__ <<
"] Error, not known key " << key << std::endl;
Type
Enum useful to discriminate each action when, for example, we want to parse a file if you change thi...
std::map< std::string, std::vector< double > > JointPos
The map to describe the position of all actuated joints. The key is the name of the string...
std::map< std::string, unsigned int > JointsInvolvedCount
The map to describe, how many times a joint is set by the action. An ActionPrimitive and an ActionCom...
The pure virtual class representing an Action. It has members that are in common to all derived class...
std::vector< ROSEE::JointPos > getAllJointPos() const override
Get the joint position related to this action, overriden from Action Necessary to not make this class...
bool keys_equal(std::map< keyType, valueType1 > const &lhs, std::map< keyType, valueType2 > const &rhs)
Return false if two maps have different keys. The type of the keys (typename) must be the same obviou...
virtual void emitYaml(YAML::Emitter &out) const override
Function to fill the argument passed with info about the action. Pure virtual because each derived cl...
JointsInvolvedCount jointsInvolvedCount
JointPos getJointPos() const override
Get the joint position related to this action, overriden from Action.
ActionGeneric()
default costructor. It is used when parsing a file with YamlWorker,
std::set< std::string > fingersInvolved
virtual bool fillFromYaml(YAML::const_iterator yamlIt) override
function to fill members of the Action with infos taken from yaml files