9 #ifndef SOT_TRAJECTORY_H__
10 #define SOT_TRAJECTORY_H__
13 #include <dynamic-graph/linear-algebra.h>
14 #include <dynamic-graph/signal-caster.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);
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;
102 stream << ats.
secs_ + 0.000001 * (
long double)ats.
nsecs_;
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;
195 struct signal_io<sot::Trajectory> : signal_io_unimplemented<sot::Trajectory> {};
#define SOT_CORE_EXPORT
Definition: api.hh:20
Definition: trajectory.hh:115
void transfer(const std::vector< double > &src, unsigned int vecId)
Definition: trajectory.hh:156
void display(std::ostream &os) const
Definition: trajectory.hh:124
std::vector< double > velocities_
Definition: trajectory.hh:118
std::vector< double > vec_ref
Definition: trajectory.hh:122
std::vector< double > efforts_
Definition: trajectory.hh:120
std::vector< double > positions_
Definition: trajectory.hh:117
std::vector< double > accelerations_
Definition: trajectory.hh:119
Definition: trajectory.hh:29
std::string list_of_pv_str_re
Definition: trajectory.hh:39
std::string bg_pt_str_re
Definition: trajectory.hh:39
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_points(std::string &trajectory, std::string &sub_text1)
Extract a sequence of points.
std::string bg_liste_of_pts_str_re
Definition: trajectory.hh:40
boost::regex list_of_jn_re
Definition: trajectory.hh:42
boost::regex end_pt_re
Definition: trajectory.hh:42
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,...
std::string comma_pt_str_re
Definition: trajectory.hh:39
std::string list_of_jn_str_re
Definition: trajectory.hh:38
std::string float_str_re
Strings specifying the grammar of the structure.
Definition: trajectory.hh:37
RulesJointTrajectory(Trajectory &TrajectoryToFill)
Constructor TrajectoryToFill is the structure where to store the parsed information.
std::string joint_name_str_re
Definition: trajectory.hh:38
std::string seq_str_re
Definition: trajectory.hh:37
void parse_string(std::string &atext)
parse_string will fill TrajectoryToFill with string atext.
unsigned int dbg_level
Definition: trajectory.hh:34
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 end_pt_str_re
Definition: trajectory.hh:39
bool parse_point(std::string &trajectory, std::string &sub_text1)
Extract a point description.
boost::regex comma_pt_re
Definition: trajectory.hh:43
std::string frame_id_str_re
Definition: trajectory.hh:37
std::vector< std::string > joint_names
Definition: trajectory.hh:44
std::string header_str_re
Definition: trajectory.hh:38
boost::regex bg_pt_re
Definition: trajectory.hh:42
Trajectory & TrajectoryToFill_
Definition: trajectory.hh:31
std::string point_value_str_re
Definition: trajectory.hh:38
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.
boost::regex header_re
Boost regular expressions implementing the grammar.
Definition: trajectory.hh:42
boost::regex bg_liste_of_pts_re
Definition: trajectory.hh:43
boost::regex list_of_pv_re
Definition: trajectory.hh:42
std::string timestamp_str_re
Definition: trajectory.hh:37
Definition: trajectory.hh:176
double time_from_start_
Definition: trajectory.hh:185
int deserialize(std::istringstream &is)
std::vector< std::string > joint_names_
Definition: trajectory.hh:182
void display(std::ostream &) const
Trajectory(const Trajectory ©)
std::vector< JointTrajectoryPoint > points_
Definition: trajectory.hh:187
Header header_
Definition: trajectory.hh:184
Definition: trajectory.hh:84
bool operator==(const timestamp &other) const
Definition: trajectory.hh:97
friend std::ostream & operator<<(std::ostream &stream, const timestamp &ats)
Definition: trajectory.hh:101
unsigned long int nsecs_
Definition: trajectory.hh:87
timestamp()
Definition: trajectory.hh:88
timestamp(unsigned long int lsecs, unsigned long int lnsecs)
Definition: trajectory.hh:93
unsigned long int secs_
Definition: trajectory.hh:86
timestamp(const timestamp &ats)
Definition: trajectory.hh:89
Definition: abstract-sot-external-interface.hh:17