73 CPose2D(
const double x,
const double y,
const double phi);
91 inline const double&
phi()
const {
return m_phi; }
115 inline void phi(
double angle)
170 void composePoint(
double lx,
double ly,
double& gx,
double& gy)
const;
183 double lx,
double ly,
double lz,
double& gx,
double& gy,
189 const double gx,
const double gy,
double& lx,
double& ly)
const;
279 throw std::runtime_error(
280 "CPose2D::operator[]: Index of bounds.");
294 throw std::runtime_error(
295 "CPose2D::operator[]: Index of bounds.");
345 static inline bool empty() {
return false; }
350 throw std::logic_error(
352 "Try to change the size of CPose2D to %u.",
353 static_cast<unsigned>(
n)));
360 std::ostream&
operator<<(std::ostream& o,
const CPose2D&
p);
370 bool operator==(
const CPose2D& p1,
const CPose2D& p2);
371 bool operator!=(
const CPose2D& p1,
const CPose2D& p2);
void changeCoordinatesReference(const CPose2D &p)
makes: this = p (+) this
double phi_sin() const
Get a (cached) value of sin(phi), recomputing it only once when phi changes.
const type_value & getPoseMean() const
The virtual base class which provides a unified interface for all persistent objects in MRPT...
mrpt::math::TPoint2D operator+(const CPose2D &pose, const mrpt::math::TPoint2D &pnt)
Compose a 2D point from a new coordinate base given by a 2D pose.
type_value & getPoseMean()
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction...
void operator*=(const double s)
Scalar multiplication.
void AddComponents(const CPose2D &p)
Scalar sum of components: This is diferent from poses composition, which is implemented as "+" operat...
mrpt::math::CArrayDouble< 2 > m_coords
[x,y]
double m_cosphi
Precomputed cos() & sin() of phi.
std::deque< TYPE1, Eigen::aligned_allocator< TYPE1 > > deque_t
void composePoint(double lx, double ly, double &gx, double &gy) const
An alternative, slightly more efficient way of doing with G and L being 2D points and P this 2D pose...
CPose2D(TConstructorFlags_Poses)
Fast constructor that leaves all the data uninitialized - call with UNINITIALIZED_POSE as argument...
double value_type
The type of the elements.
CPose2D operator-(const CPose2D &b) const
Compute .
void fromStringRaw(const std::string &s)
Same as fromString, but without requiring the square brackets in the string.
A numeric matrix of compile-time fixed size.
bool operator!=(const CPoint< DERIVEDCLASS > &p1, const CPoint< DERIVEDCLASS > &p2)
double m_phi
The orientation of the pose, in radians.
CPose2D operator-(const CPose2D &p)
Unary - operator: return the inverse pose "-p" (Note that is NOT the same than a pose with negative x...
void setToNaN() override
Set all data fields to quiet NaN.
A base class for representing a pose in 2D or 3D.
mrpt::aligned_containers< CPose2D >::deque_t StdDeque_CPose2D
Eigen aligment-compatible container.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void inverse()
Convert this pose into its inverse, saving the result in itself.
CPose2D type_value
Used to emulate CPosePDF types, for example, in mrpt::graphs::CNetworkOfPoses.
CPose2D operator+(const CPose2D &D) const
The operator is the pose compounding operator.
GLsizei const GLchar ** string
A class used to store a 2D point.
A class used to store a 3D point.
std::string asString() const
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
double & operator[](unsigned int i)
mrpt::math::CMatrixDouble22 getRotationMatrix() const
bool operator==(const CPoint< DERIVEDCLASS > &p1, const CPoint< DERIVEDCLASS > &p2)
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).
CPose2D & operator+=(const CPose2D &b)
Make .
CPose2D getOppositeScalar() const
Return the opposite of the current pose instance by taking the negative of all its components individ...
static size_type max_size()
void getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &out_HM) const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
const double & phi() const
Get the phi angle of the 2D pose (in radians)
static void resize(const size_t n)
void composeFrom(const CPose2D &A, const CPose2D &B)
Makes .
double phi_cos() const
Get a (cached) value of cos(phi), recomputing it only once when phi changes.
void inverseComposePoint(const double gx, const double gy, double &lx, double &ly) const
Computes the 2D point L such as .
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0...
void phi(double angle)
Set the phi angle of the 2D pose (in radians)
double distance2DFrobeniusTo(const CPose2D &p) const
Returns the 2D distance from this pose/point to a 2D pose using the Frobenius distance.
const double & const_reference
std::ptrdiff_t difference_type
void inverseComposeFrom(const CPose2D &A, const CPose2D &B)
Makes this method is slightly more efficient than "this= A - B;" since it avoids the temporary objec...
void getAsVector(mrpt::math::CVectorDouble &v) const
Returns a 1x3 vector with [x y phi].
const double & operator[](unsigned int i) const
void inverseComposePoint(const mrpt::math::TPoint2D &g, mrpt::math::TPoint2D &l) const
CPose2D()
Default constructor (all coordinates to 0)
std::vector< TYPE1, Eigen::aligned_allocator< TYPE1 > > vector_t
mrpt::aligned_containers< CPose2D >::vector_t StdVector_CPose2D
Eigen aligment-compatible container.
void normalizePhi()
Forces "phi" to be in the range [-pi,pi];.
void phi_incr(const double Aphi)
Increment the PHI angle (without checking the 2 PI range, call normalizePhi is needed) ...
std::ostream & operator<<(std::ostream &o, const CPoint< DERIVEDCLASS > &p)
Dumps a point as a string [x,y] or [x,y,z].
void update_cached_cos_sin() const