9 #define VP_DEBUG_MODE 45
33 : TrajectoryToFill_(aTrajectoryToFill),
35 float_str_re(
"[-0-9]+\\.[0-9]*"),
38 seq_str_re(
"([0-9]+)"),
39 timestamp_str_re(
"(" + float_str_re +
"),(" + float_str_re +
")"),
40 frame_id_str_re(
"[a-zA-z_0-9]*"),
41 header_str_re(
"\\(" + seq_str_re +
"\\,\\(" + timestamp_str_re +
"\\),(" +
42 frame_id_str_re +
")\\)\\,\\("),
45 joint_name_str_re(
"([a-zA-Z0-9_]+)"),
46 list_of_jn_str_re(joint_name_str_re +
"(\\,|\\))"),
49 point_value_str_re(
"(" + float_str_re +
"+)|(?:)"),
50 list_of_pv_str_re(point_value_str_re +
"(\\,|\\))"),
53 comma_pt_str_re(
"\\,\\("),
56 bg_liste_of_pts_str_re(
"\\,\\("),
59 header_re(header_str_re),
60 list_of_jn_re(list_of_jn_str_re),
61 list_of_pv_re(list_of_pv_str_re),
62 bg_pt_re(bg_pt_str_re),
63 end_pt_re(end_pt_str_re),
64 comma_pt_re(comma_pt_str_re),
65 bg_liste_of_pts_re(bg_liste_of_pts_str_re) {}
68 std::string &text, boost::match_results<std::string::const_iterator> &what,
69 boost::regex &e, std::string &sub_text) {
70 unsigned nb_failures = 0;
72 boost::match_flag_type flags = boost::match_extra;
73 if (boost::regex_search(text, what, e, flags)) {
75 std::cout <<
"** Match found **\n Sub-Expressions:" << what.size()
78 std::cout <<
" $" <<
i <<
" = \"" << what[(
int)
i] <<
"\" "
79 << what.position(
i) <<
" " << what.length((
int)
i) <<
"\n";
81 if (what.size() >= 1) {
83 boost::match_results<std::string::const_iterator>::difference_type
pos =
84 what.position(all_text);
85 boost::match_results<std::string::const_iterator>::difference_type len =
86 what.length((
int)all_text);
87 sub_text = text.substr(
pos + len);
91 if (
dbg_level > 5) std::cout <<
"** No Match found **\n";
94 if (nb_failures > 100)
return false;
100 std::string &sub_text1) {
101 std::istringstream is;
102 boost::match_results<std::string::const_iterator> what;
117 <<
" " << is.str() << std::endl;
121 std::cout <<
"sub_text1:" << sub_text1 << std::endl;
127 std::string &trajectory, std::string &sub_text1,
128 std::vector<std::string> &joint_names) {
129 std::istringstream is;
130 boost::match_results<std::string::const_iterator> what;
131 bool joint_names_loop =
true;
139 std::string sep_char;
142 if (sep_char ==
")") joint_names_loop =
false;
144 std::cout <<
"joint_name:" <<
joint_name <<
" " << sep_char
146 std::cout <<
"sub_text1:" << sub_text1 << std::endl;
149 trajectory = sub_text1;
151 }
while (joint_names_loop);
155 std::string &sub_text1,
156 std::vector<double> &seq) {
157 boost::match_results<std::string::const_iterator> what;
158 bool joint_seq_loop =
true;
159 std::istringstream is;
160 std::string sub_text2 = trajectory;
161 sub_text1 = trajectory;
164 std::string sep_char;
166 std::cout <<
"size:" << what.size() << std::endl;
169 if (what.size() == 3) {
170 std::string aString(what[1]);
171 if (aString.size() > 0) {
177 std::cout << aString <<
" | " << aValue << std::endl;
180 seq.push_back(aValue);
183 }
else if (what.size() == 1)
186 if (sep_char ==
")") joint_seq_loop =
false;
191 sub_text2 = sub_text1;
192 }
while (joint_seq_loop);
197 std::string &sub_text1) {
198 std::vector<double> position, velocities, acceleration, effort;
199 std::string sub_text2;
200 boost::match_results<std::string::const_iterator> what;
205 sub_text2 = sub_text1;
208 sub_text2 = sub_text1;
212 sub_text2 = sub_text1;
215 sub_text2 = sub_text1;
219 sub_text2 = sub_text1;
222 sub_text2 = sub_text1;
226 sub_text2 = sub_text1;
234 std::string &sub_text1) {
235 boost::match_results<std::string::const_iterator> what;
236 bool joint_points_loop =
true;
237 std::istringstream is;
241 std::string sub_text2 = sub_text1;
246 sub_text2 = sub_text1;
248 if (!
parse_point(sub_text2, sub_text1))
return false;
249 sub_text2 = sub_text1;
253 sub_text2 = sub_text1;
257 sub_text2 = sub_text1;
258 std::string sep_char;
261 if (sep_char ==
")") joint_points_loop =
false;
263 }
while (joint_points_loop);
269 std::string sub_text1, sub_text2;
271 sub_text1 = sub_text2;
280 sub_text1 = sub_text2;
295 std::string aStr = is.str();
303 std::size_t
index = 0;
304 os <<
"-- Trajectory --" << std::endl;
305 for (std::vector<std::string>::const_iterator it_joint_name =
308 os <<
"Joint(" <<
index <<
")=" << *(it_joint_name) << std::endl;
310 os <<
" Number of points: " <<
points_.size() << std::endl;
311 for (std::vector<JointTrajectoryPoint>::const_iterator it_point =
313 it_point !=
points_.end(); it_point++) {
314 it_point->display(os);