46 template <
bool QUAT_REPR = true,
bool TUM_FORMAT = true>
49 std::vector<std::string> curr_tokens;
53 curr_tokens.size() == 7,
55 "Invalid number of tokens in given string\n" 61 quat.
r(atof(curr_tokens[6].c_str()));
62 quat.
x(atof(curr_tokens[3].c_str()));
63 quat.
y(atof(curr_tokens[4].c_str()));
64 quat.
z(atof(curr_tokens[5].c_str()));
69 atof(curr_tokens[0].c_str()),
70 atof(curr_tokens[1].c_str()),
71 atof(curr_tokens[2].c_str()),
87 THROW_EXCEPTION(
"Invalid combination: QUAT_REPR=false, TUM_FORMAT=true");
137 template <
class POSE_T>
139 const std::string& fname, std::vector<POSE_T>* poses_vec,
140 std::vector<mrpt::system::TTimeStamp>* timestamps = NULL,
141 bool substract_init_offset =
false)
149 using namespace internal;
154 "\nFile %s was not found.\n" 155 "Either specify a valid filename or set set the " 156 "m_visualize_GT flag to false\n",
162 "\nreadGTFileRGBD_TUM: Couldn't openGT file\n");
163 ASSERTMSG_(poses_vec,
"std::vector<POSE_T>* is not valid.");
168 for (
size_t i = 0; file_GT.
readLine(curr_line); i++)
170 if (curr_line.at(0) !=
'#')
177 POSE_T pose_offset_opposite;
178 if (substract_init_offset)
183 curr_line.begin() + curr_line.find_first_of(
" \t") + 1,
186 pose_offset_opposite = pose_offset.getOppositeScalar();
190 for (; file_GT.
readLine(curr_line);)
197 curr_line.begin() + curr_line.find_first_of(
" \t"));
198 timestamps->push_back(atof(timestamp_str.c_str()));
204 curr_line.begin() + curr_line.find_first_of(
" \t") + 1,
209 if (substract_init_offset)
211 curr_pose.addComponents(pose_offset_opposite);
215 poses_vec->push_back(curr_pose);
void readFileWithPoses(const std::string &fname, std::vector< POSE_T > *poses_vec, std::vector< mrpt::system::TTimeStamp > *timestamps=NULL, bool substract_init_offset=false)
Parse the textfile and fill in the corresponding poses vector.
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
This namespace provides a OS-independent interface to many useful functions: filenames manipulation...
T y() const
Return y coordinate of the quaternion.
#define THROW_EXCEPTION(msg)
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
void fromStringRaw(const std::string &s)
Same as fromString, but without requiring the square brackets in the string.
void getPoseFromString(const std::string &s, mrpt::poses::CPose2D &p)
T r() const
Return r coordinate of the quaternion.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,qz).
GLsizei const GLchar ** string
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void tokenize(const std::string &inString, const std::string &inDelimiters, std::deque< std::string > &outTokens, bool skipBlankTokens=true) noexcept
Tokenizes a string according to a set of delimiting characters.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
T x() const
Return x coordinate of the quaternion.
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ...
T z() const
Return z coordinate of the quaternion.
#define ASSERTMSG_(f, __ERROR_MSG)
void rpy(T &roll, T &pitch, T &yaw) const
Return the yaw, pitch & roll angles associated to quaternion.
void getPoseFromString< false, true >(const std::string &s, mrpt::poses::CPose3D &p)
Invalid form.