36 for (
auto it : jpFurther ) {
45 std::vector<JointPos> vect;
68 std::set <std::string>
set;
75 std::stringstream output;
76 output <<
"ActionName: " <<
name << std::endl;
78 output <<
"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;
90 output <<
"JointPos Nearer to 0:" << std::endl;
95 std::cout << output.str();
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;
110 out << YAML::Key << joint.first;
111 out << YAML::Value << YAML::Flow << joint.second;
115 out << YAML::Key <<
"JointPosNearer" << YAML::Value << YAML::BeginMap;
117 out << YAML::Key << joint.first;
118 out << YAML::Value << YAML::Flow << joint.second;
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) {
144 }
else if (key.compare (
"JointPosNearer") == 0) {
147 }
else if (key.compare (
"JointPosFurther") == 0) {
150 }
else if (key.compare (
"PrimitiveType") == 0) {
152 keyValue->second.as <
unsigned int>() );
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;
unsigned int nFingersInvolved
Type
Enum useful to discriminate each action when, for example, we want to parse a file if you change thi...
JointPos getJointPosNearer() const
Virtual class, Base of all the primitive actions. It has some implemented functions that a derived cl...
JointPos getJointPosFurther() const
void print() const override
Overridable functions, if we want to make them more action-specific.
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::size_t size(custom_string const &s)
ActionSingleJointMultipleTips()
bool fillFromYaml(YAML::const_iterator yamlIt) override
function to fill members of the Action with infos taken from yaml files
Type
Enum useful to discriminate each primitive action when, for example, we want to parse a file if you ...
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
std::vector< JointPos > getAllJointPos() const override
Overriden get from the pure virtual function of the base class Action The signature must be equal...
std::string jointInvolved
std::set< std::string > getKeyElements() const override
Necessary method to know the key used by the maps which store all the Actions of one type...
std::string getJointName() const
std::set< std::string > fingersInvolved
JointPos getJointPos() const override
Overriden get from the pure virtual function of the base class Action.