9 #ifndef SOT_TRAJECTORY_H__ 10 #define SOT_TRAJECTORY_H__ 16 #include <boost/array.hpp> 17 #include <boost/assign/list_of.hpp> 18 #include <boost/regex.hpp> 22 namespace ba = boost::assign;
58 boost::match_results<std::string::const_iterator> &what, boost::regex &e,
59 std::string &sub_text);
65 void parse_header(std::string &text, std::string &sub_text1);
70 std::vector<std::string> &joint_names);
74 bool parse_seq(std::string &text, std::string &sub_text1,
75 std::vector<double> &seq);
78 bool parse_point(std::string &trajectory, std::string &sub_text1);
81 bool parse_points(std::string &trajectory, std::string &sub_text1);
93 timestamp(
unsigned long int lsecs,
unsigned long int lnsecs) {
98 if ((secs_ != other.
secs_) || (nsecs_ != other.
nsecs_))
return false;
112 Header() : seq_(0), stamp_(0, 0), frame_id_(
"initial_trajectory") {}
125 boost::array<std::string, 4> names = boost::assign::list_of(
"Positions")(
126 "Velocities")(
"Accelerations")(
"Effort");
128 const std::vector<double> *
points = 0;
130 for (std::size_t arrayId = 0; arrayId < names.size(); ++arrayId) {
133 points = &positions_;
136 points = &velocities_;
139 points = &accelerations_;
148 std::vector<double>::const_iterator it_db;
149 os << names[arrayId] << std::endl <<
"---------" << std::endl;
150 for (it_db = points->begin(); it_db != points->end(); it_db++) {
151 os << *it_db << std::endl;
156 void transfer(
const std::vector<double> &
src,
unsigned int vecId) {
165 accelerations_ =
src;
189 int deserialize(std::istringstream &is);
190 void display(std::ostream &)
const;
ReturnMatrix copy(const Eigen::MatrixBase< Matrix > &mat)
std::string list_of_pv_str_re
std::vector< double > efforts_
std::vector< std::string > joint_names
bool parse_points(std::string &trajectory, std::string &sub_text1)
Extract a sequence of points.
boost::regex list_of_jn_re
friend std::ostream & operator<<(std::ostream &stream, const timestamp &ats)
std::vector< double > positions_
std::string frame_id_str_re
std::vector< std::string > joint_names_
void parse_string(std::string &atext)
parse_string will fill TrajectoryToFill with string atext.
std::string float_str_re
Strings specifying the grammar of the structure.
boost::regex header_re
Boost regular expressions implementing the grammar.
bool search_exp_sub_string(std::string &text, boost::match_results< std::string::const_iterator > &what, boost::regex &e, std::string &sub_text)
General parsing method of text with regexp e. The results are given in what. The remaining text is le...
std::string timestamp_str_re
timestamp(const timestamp &ats)
boost::regex list_of_pv_re
std::string end_pt_str_re
std::vector< double > velocities_
std::string header_str_re
std::vector< JointTrajectoryPoint > points_
std::string point_value_str_re
timestamp(unsigned long int lsecs, unsigned long int lnsecs)
void transfer(const std::vector< double > &src, unsigned int vecId)
bool parse_point(std::string &trajectory, std::string &sub_text1)
Extract a point description.
std::string joint_name_str_re
std::string bg_liste_of_pts_str_re
std::string comma_pt_str_re
std::vector< double > vec_ref
boost::regex bg_liste_of_pts_re
std::string list_of_jn_str_re
void parse_header(std::string &text, std::string &sub_text1)
Find and store the header. This method is looking for: unsigned int seq. unsigned int sec...
bool operator==(const timestamp &other) const
RulesJointTrajectory(Trajectory &TrajectoryToFill)
Constructor TrajectoryToFill is the structure where to store the parsed information.
Trajectory & TrajectoryToFill_
void parse_joint_names(std::string &text, std::string &sub_text1, std::vector< std::string > &joint_names)
Understand joint_names. Extract a list of strings.
bool parse_seq(std::string &text, std::string &sub_text1, std::vector< double > &seq)
Extract a sequence of doubles. To be used for position, velocities, accelerations and effort...
std::vector< double > accelerations_
void display(std::ostream &os) const