Go to the documentation of this file.
51 if (m_cossin_uptodate)
return;
53 ::sincos(m_phi,&m_sinphi,&m_cosphi);
55 m_cosphi=::cos(m_phi);
56 m_sinphi=::sin(m_phi);
58 m_cossin_uptodate=
true;
66 CPose2D(
const double x,
const double y,
const double phi);
84 inline const double &
phi()
const {
return m_phi; }
86 inline double &
phi() { m_cossin_uptodate=
false;
return m_phi; }
89 inline double phi_cos()
const { update_cached_cos_sin();
return m_cosphi; }
91 inline double phi_sin()
const { update_cached_cos_sin();
return m_sinphi; }
94 inline void phi(
double angle) { m_phi=angle; m_cossin_uptodate=
false; }
96 inline void phi_incr(
const double Aphi) { m_phi+=Aphi; m_cossin_uptodate=
false; }
113 getRotationMatrix(R);
139 void composePoint(
double lx,
double ly,
double lz,
double &gx,
double &gy,
double &gz)
const;
197 case 0:
return m_coords[0];
198 case 1:
return m_coords[1];
201 throw std::runtime_error(
"CPose2D::operator[]: Index of bounds.");
208 case 0:
return m_coords[0];
209 case 1:
return m_coords[1];
212 throw std::runtime_error(
"CPose2D::operator[]: Index of bounds.");
223 enum { is_3D_val = 0 };
224 static inline bool is_3D() {
return is_3D_val!=0; }
225 enum { rotation_dimensions = 2 };
226 enum { is_PDF_val = 0 };
227 static inline bool is_PDF() {
return is_PDF_val!=0; }
245 static inline bool empty() {
return false; }
247 static inline void resize(
const size_t n) {
if (n!=
static_size)
throw std::logic_error(
format(
"Try to change the size of CPose2D to %u.",
static_cast<unsigned>(n))); }
void getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &out_HM) const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
CPose2D(const CPoint2D &)
Constructor from a CPoint2D object.
CPose2D BASE_IMPEXP operator-(const CPose2D &p)
Unary - operator: return the inverse pose "-p" (Note that is NOT the same than a pose with negative x...
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...
static void resize(const size_t n)
void phi_incr(const double Aphi)
Increment the PHI angle (without checking the 2 PI range, call normalizePhi is needed)
double value_type
The type of the elements.
CPose2D(const CPose3D &)
Aproximation!! Avoid its use, since information is lost.
CPose2D(const mrpt::math::TPose2D &)
Constructor from lightweight object.
const double & const_reference
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...
double distance2DFrobeniusTo(const CPose2D &p) const
Returns the 2D distance from this pose/point to a 2D pose using the Frobenius distance.
std::ptrdiff_t difference_type
Column vector, like Eigen::MatrixX*, but automatically initialized to zeros since construction.
void inverse()
Convert this pose into its inverse, saving the result in itself.
const double & operator[](unsigned int i) const
double & phi()
This is an overloaded member function, provided for convenience. It differs from the above function o...
const double & phi() const
Get the phi angle of the 2D pose (in radians)
double phi_cos() const
Get a (cached) value of cos(phi), recomputing it only once when phi changes.
A base class for representing a pose in 2D or 3D.
CPose2D()
Default constructor (all coordinates to 0)
Helper types for STL containers with Eigen memory allocators.
CPose2D type_value
Used to emulate CPosePDF types, for example, in mrpt::graphs::CNetworkOfPoses.
void AddComponents(CPose2D &p)
Scalar sum of components: This is diferent from poses composition, which is implemented as "+" operat...
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
void getRotationMatrix(mrpt::math::CMatrixDouble33 &R) const
Returns the equivalent SE(3) 3x3 rotation matrix, with (2,2)=1.
void asString(std::string &s) const
Returns a human-readable textual representation of the object (eg: "[x y yaw]", yaw in degrees)
mrpt::math::TPoint2D BASE_IMPEXP operator+(const CPose2D &pose, const mrpt::math::TPoint2D &pnt)
Compose a 2D point from a new coordinate base given by a 2D pose.
mrpt::math::CMatrixDouble22 getRotationMatrix() const
const type_value & getPoseMean() const
double phi_sin() const
Get a (cached) value of sin(phi), recomputing it only once when phi changes.
void getRotationMatrix(mrpt::math::CMatrixDouble22 &R) const
Returns the SE(2) 2x2 rotation matrix.
CPose2D(TConstructorFlags_Poses)
Fast constructor that leaves all the data uninitialized - call with UNINITIALIZED_POSE as argument.
void setToNaN() MRPT_OVERRIDE
Set all data fields to quiet NaN.
type_value & getPoseMean()
CPose2D(const CPoint3D &)
Constructor from CPoint3D with information loss.
std::vector< T1 > & operator+=(std::vector< T1 > &a, const std::vector< T2 > &b)
a+=b (element-wise sum)
#define DEFINE_SERIALIZABLE_POST(class_name)
std::string asString() const
A class used to store a 2D pose.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[0.02 1.04 -0....
void getAsVector(mrpt::math::CVectorDouble &v) const
Returns a 1x3 vector with [x y phi].
#define DEFINE_SERIALIZABLE_PRE(class_name)
This declaration must be inserted in all CSerializable classes definition, before the class declarati...
mrpt::aligned_containers< CPose2D >::deque_t StdDeque_CPose2D
Eigen aligment-compatible container.
double m_sinphi
Precomputed cos() & sin() of phi.
A numeric matrix of compile-time fixed size.
void composePoint(const mrpt::math::TPoint3D &l, mrpt::math::TPoint3D &g) const
void normalizePhi()
Forces "phi" to be in the range [-pi,pi];.
void composePoint(const mrpt::math::TPoint2D &l, mrpt::math::TPoint2D &g) const
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void getAsVector(mrpt::math::CArrayDouble< 3 > &v) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
static size_type max_size()
std::vector< T1 > & operator*=(std::vector< T1 > &a, const std::vector< T2 > &b)
a*=b (element-wise multiplication)
void composeFrom(const CPose2D &A, const CPose2D &B)
Makes .
mrpt::aligned_containers< CPose2D >::vector_t StdVector_CPose2D
Eigen aligment-compatible container.
A class used to store a 2D point.
A class used to store a 3D point.
void phi(double angle)
Set the phi angle of the 2D pose (in radians)
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz) const
void update_cached_cos_sin() const
#define MRPT_OVERRIDE
C++11 "override" for virtuals:
void changeCoordinatesReference(const CPose2D &p)
makes: this = p (+) this
double m_phi
The orientation of the pose, in radians.
mrpt::math::CArrayDouble< 2 > m_coords
[x,y]
double & operator[](unsigned int i)
CPose2D(const double x, const double y, const double phi)
Constructor from an initial value of the pose.
Page generated by Doxygen 1.8.20 for MRPT 1.4.0 SVN: at Thu Aug 27 02:40:23 UTC 2020 | | |