Go to the documentation of this file.
16 #include <boost/tokenizer.hpp>
38 "SimpleSeqPlay(" +
name +
")::intern(dummy)::init"),
41 "SimpleSeqPlay(" +
name +
")::output(vector)::posture"),
43 NULL,
"SimpleSeqPlay(" +
name +
")::input(vector)::currentPosture"),
50 it_nbs_in_state1_(0) {
55 std::string docstring =
56 "Load files describing a whole-body motion as reference feature "
60 " - string filename without extension\n"
62 " Data is read from the following files:\n"
63 " - posture from file \"filename.posture\",\n"
64 " The file should contain one column for time and as many columns as"
66 " depending of degree-of-freedrom.\n"
74 "Set the time between the robot current pose and the starting of the "
86 using boost::escaped_list_separator;
87 typedef boost::tokenizer<escaped_list_separator<char> > tokenizer_t;
92 unsigned int lineNumber = 0;
96 file.open(fn.c_str());
97 if (!file.is_open()) {
98 throw std::runtime_error(std::string(
"Failed to open file ") + fn);
104 while (file.good()) {
105 std::getline(file,
line);
107 tokenizer_t tok(
line, escaped_list_separator<char>(
'\\',
' ',
'\"'));
108 std::vector<double> components;
109 for (tokenizer_t::iterator it = tok.begin(); it != tok.end(); ++it) {
110 components.push_back(atof(it->c_str()));
112 if (components.size() == 0) {
115 if (postureSize == -2) {
116 postureSize =
static_cast<int>(components.size() - 1);
118 if (postureSize !=
static_cast<int>(components.size()) - 1) {
119 std::ostringstream oss;
120 oss << fn <<
", line " << lineNumber <<
": config of size "
121 << components.size() - 1 <<
". Expecting " << postureSize <<
".";
122 throw std::runtime_error(oss.str());
126 for (
unsigned i = 1;
i < components.size(); ++
i) {
142 std::size_t configId;
150 throw std::runtime_error(
151 "SimpleSeqPlay posture: Signals not initialized. read files first.");
160 if ((deltapos.norm() < 1e-4) ||
177 if (configId ==
posture_.size() - 1) {
193 return "Provide joint references for a whole-body motion\n"
195 " The reference trajectories of the joints are loaded from the file\n"
196 " using command load.\n"
198 " To use this entity,\n"
199 " 1. call method load,\n"
200 " 2. plug reference signals into robot signals and\n"
201 " 3. call method start.\n"
202 " Warning: pluging signals before loading trajectories will fail.\n";
std::string docCommandVoid0(const std::string &doc)
CommandVoid0< E > * makeCommandVoid0(E &entity, boost::function< void(E *)> function, const std::string &docString)
DirectGetter< E, T > * makeDirectGetter(E &entity, T *ptr, const std::string &docString)
virtual const T & access(const Time &t)
std::string docCommandVoid1(const std::string &doc, const std::string &type)
SignalArray< sigtime_t > sotNOSIGNAL(0)
std::string docDirectSetter(const std::string &name, const std::string &type)
std::string docDirectGetter(const std::string &name, const std::string &type)
DirectSetter< E, T > * makeDirectSetter(E &entity, T *ptr, const std::string &docString)
void addCommand(const std::string &name, command::Command *command)
void signalRegistration(const SignalArray< sigtime_t > &signals)
CommandVoid1< E, T > * makeCommandVoid1(E &entity, boost::function< void(const T &)> function, const std::string &docString)
sot-tools
Author(s): Mehdi Benallegue, Francois Keith, Florent Lamiraux, Thomas Moulard, Olivier Stasse, Jorrit T'Hooft
autogenerated on Wed Aug 2 2023 02:35:13