Go to the documentation of this file.
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"
57 "\tTokens size: %" USIZE_STR
"\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)
148 using namespace internal;
153 "\nFile %s was not found.\n"
154 "Either specify a valid filename or set set the "
155 "m_visualize_GT flag to false\n",
160 file_GT.fileOpenCorrectly(),
161 "\nreadGTFileRGBD_TUM: Couldn't openGT file\n");
162 ASSERTMSG_(poses_vec,
"std::vector<POSE_T>* is not valid.");
167 for (
size_t i = 0; file_GT.readLine(curr_line); i++)
169 if (curr_line.at(0) !=
'#')
176 POSE_T pose_offset_opposite;
177 if (substract_init_offset)
182 curr_line.begin() + curr_line.find_first_of(
" \t") + 1,
185 pose_offset_opposite = pose_offset.getOppositeScalar();
189 for (; file_GT.readLine(curr_line);)
196 curr_line.begin() + curr_line.find_first_of(
" \t"));
197 timestamps->push_back(atof(timestamp_str.c_str()));
203 curr_line.begin() + curr_line.find_first_of(
" \t") + 1,
208 if (substract_init_offset)
210 curr_pose.addComponents(pose_offset_opposite);
214 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.
void fromStringRaw(const std::string &s)
Same as fromString, but without requiring the square brackets in the string.
void rpy(T &roll, T &pitch, T &yaw) const
Return the yaw, pitch & roll angles associated to quaternion.
T y() const
Return y coordinate of the quaternion.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define THROW_EXCEPTION(msg)
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
T x() const
Return x coordinate of the quaternion.
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
void tokenize(const std::string &inString, const std::string &inDelimiters, OUT_CONTAINER &outTokens, bool skipBlankTokens=true) noexcept
Tokenizes a string according to a set of delimiting characters.
T z() const
Return z coordinate of the quaternion.
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 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).
mrpt::io::CFileInputStream CFileInputStream
#define ASSERTMSG_(f, __ERROR_MSG)
Defines an assertion mechanism.
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ,...
void getPoseFromString< false, true >(const std::string &s, mrpt::poses::CPose3D &p)
Invalid form.
GLsizei const GLchar ** string
void getPoseFromString(const std::string &s, mrpt::poses::CPose2D &p)
This namespace provides a OS-independent interface to many useful functions: filenames manipulation,...
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |