26 out.WriteAs<uint32_t>(m_poses.size());
27 for (
const auto& p : m_poses)
out << p;
36 m_poses.resize(in.
ReadAs<uint32_t>());
37 for (
auto& p : m_poses) in >> p;
51 if (ind >= m_poses.size())
THROW_EXCEPTION(
"getPose: Index out of range!!");
53 outPose =
CPose3D(m_poses[ind]);
62 if (ind >= m_poses.size())
THROW_EXCEPTION(
"getPose: Index out of range!!");
63 m_poses[ind] = inPose.
asTPose();
72 m_poses.push_back(newPose.
asTPose());
92 if (n > m_poses.size())
95 for (i = 0; i < n; i++) ret = ret +
CPose3D(m_poses[i]);
105 return absolutePoseOf(posesCount());
112 if (n > m_poses.size())
115 for (
size_t i = 0; i < n; i++) dist += m_poses[i].
norm();
121 return computeTraveledDistanceAfter(posesCount());
mrpt::math::TPose3D asTPose() const
void clear()
Clears the sequence.
#define THROW_EXCEPTION(msg)
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
double computeTraveledDistanceAfter(size_t n)
Returns the traveled distance after moving "n" poses, so for "n=0" it returns 0, for "n=1" the first ...
uint8_t serializeGetVersion() const override
Must return the current versioning number of the object.
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
This base provides a set of functions for maths stuff.
STORED_TYPE ReadAs()
De-serialize a variable and returns it by value.
CPose3D absolutePoseOf(unsigned int n)
Returns the absolute pose of a robot after moving "n" poses, so for "n=0" the origin pose (0...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
void appendPose(CPose3D &newPose)
Appends a new pose at the end of sequence.
This class stores a sequence of relative, incremental 3D poses.
void getPose(unsigned int ind, CPose3D &outPose)
Reads the stored pose at index "ind", where the first one is 0, the last "posesCount() - 1"...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
Virtual base class for "archives": classes abstracting I/O streams.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
mrpt::vision::TStereoCalibResults out
double computeTraveledDistanceAfterAll()
Returns the traveled distance after ALL movements.
CPose3D absolutePoseAfterAll()
A shortcut for "absolutePoseOf( posesCount() )".
void changePose(unsigned int ind, CPose3D &inPose)
Changes the stored pose at index "ind", where the first one is 0, the last "posesCount() - 1"...
CONTAINER::Scalar norm(const CONTAINER &v)