10 #include <yaml-cpp/yaml.h>
11 #include <boost/shared_ptr.hpp>
12 #include <boost/make_shared.hpp>
13 #include <ros/common.h>
15 #include "keyframe_player/Keyframe.h"
16 #include <motion_file/ruleapplier.h>
28 double pGain;
double iGain;
double dGain;
30 kf_player::gainSelectEnum gainSelect;
37 std::vector<FrameJoint> joints;
39 double roll;
double pitch;
double yaw;
46 std::string frameName;
54 std::vector<RulePart> parts;
63 Motion(
const Motion& _in) :
64 motionName(_in.motionName) ,
65 preState(_in.preState) ,
66 playState(_in.playState) ,
67 postState(_in.postState) ,
68 pidEnabled(_in.pidEnabled) ,
69 jointList(_in.jointList) ,
70 filePath(_in.filePath)
73 for(
size_t i=0;i<_in.frames.size();i++)
75 frames.push_back(boost::make_shared<Keyframe>(*_in.frames[i]));
79 for(
size_t i=0;i<_in.rules.size();i++)
81 rules.push_back(Rule());
82 rules.back().name = _in.rules[i].name;
84 for(
size_t j = 0; j < _in.rules[i].parts.size(); j++)
85 rules[i].parts.push_back((_in.rules[i].parts[j]));
90 Motion& operator=(Motion _in)
94 motionName=(_in.motionName);
95 preState=(_in.preState);
96 playState=(_in.playState);
97 postState=(_in.postState);
98 pidEnabled=(_in.pidEnabled);
99 jointList=(_in.jointList);
100 filePath=(_in.filePath);
103 for(
size_t i=0;i<_in.frames.size();i++)
105 frames.push_back(boost::make_shared<Keyframe>(*_in.frames[i]));
109 for(
size_t i=0;i<_in.rules.size();i++)
111 rules.push_back(Rule());
112 rules.back().name = _in.rules[i].name;
114 for(
size_t j = 0; j < _in.rules[i].parts.size(); j++)
115 rules[i].parts.push_back((_in.rules[i].parts[j]));
121 bool load(std::string name);
122 bool parse(std::string motion);
123 bool save(std::string name);
126 int findFrame(
const std::string name);
127 int findJoint(
const std::string name);
129 bool isRuleValid(
int index);
130 bool canApplyRule(
int index,
double delta,
bool limit_inverse,
double epsilon);
131 bool applyRule(
int index,
double delta,
bool limit_inverse,
double epsilon);
133 static int nameToIndex(
const std::vector<std::string>& jointList,
const std::string& name);
136 static bool isIdentical(motionfile::Motion& motion_1, motionfile::Motion& motion_2);
139 static void detailedComparison(motionfile::Motion& motion_1, motionfile::Motion& motion_2);
141 typedef boost::shared_ptr<Keyframe> KeyframePtr;
144 std::string motionName;
145 std::string preState;
146 std::string playState;
147 std::string postState;
150 std::vector<std::string> jointList;
151 std::vector<Rule> rules;
153 std::string filePath;
156 std::vector<KeyframePtr> frames;
159 void nodeToMotion(
const YAML::Node& node);
160 void parseRule(
const YAML::Node& node);
161 void motionToNode(YAML::Emitter& em);
163 motionfile::RuleApplier ruleApplier;
const std::string jointName[NUM_JOINTS]
List of names of the joints that are required by the gait motion module (indexed by the JointID enum)...
Definition: gait_common.h:57