25 out.WriteAs<uint32_t>(poses.size());
26 for (
const auto& p : poses)
out << p;
35 poses.resize(in.
ReadAs<uint32_t>());
36 for (
auto& p : poses) in >> p;
63 *((&(poses[ind])) + ind) = inPose;
72 poses.push_back(newPose);
94 for (i = 0; i < n; i++) ret = ret + poses[i];
101 return absolutePoseOf(posesCount());
110 for (
size_t i = 0; i < n; i++) dist += poses[i].
norm();
117 return computeTraveledDistanceAfter(posesCount());
This class stores a sequence of relative, incremental 2D poses.
void serializeFrom(mrpt::serialization::CArchive &in, uint8_t serial_version) override
Pure virtual method for reading (deserializing) from an abstract archive.
#define THROW_EXCEPTION(msg)
double computeTraveledDistanceAfterAll()
Returns the traveled distance after ALL movements.
#define IMPLEMENTS_SERIALIZABLE(class_name, base, NameSpace)
To be added to all CSerializable-classes implementation files.
CPose2D absolutePoseOf(unsigned int n)
Returns the absolute pose of a robot after moving "n" poses, so for "n=0" the origin pose (0...
void getPose(unsigned int ind, CPose2D &outPose)
Reads the stored pose at index "ind", where the first one is 0, the last "posesCount() - 1"...
void serializeTo(mrpt::serialization::CArchive &out) const override
Pure virtual method for writing (serializing) to an abstract archive.
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.
void clear()
Clears the sequence.
STORED_TYPE ReadAs()
De-serialize a variable and returns it by value.
void changePose(unsigned int ind, CPose2D &inPose)
Changes the stored pose at index "ind", where the first one is 0, the last "posesCount() - 1"...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
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 ...
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 2D pose, including the 2D coordinate point and a heading (phi) angle...
mrpt::vision::TStereoCalibResults out
void appendPose(CPose2D &newPose)
Appends a new pose at the end of sequence.
CONTAINER::Scalar norm(const CONTAINER &v)
CPose2D absolutePoseAfterAll()
A shortcut for "absolutePoseOf( posesCount() )".