9 #ifndef CPOSE3DROTVEC_H
10 #define CPOSE3DROTVEC_H
75 const double vx,
const double vy,
const double vz,
const double x,
76 const double y,
const double z)
144 out_HM.set_unsafe(0, 3,
m_coords[0]);
145 out_HM.set_unsafe(1, 3,
m_coords[1]);
146 out_HM.set_unsafe(2, 3,
m_coords[2]);
147 out_HM.set_unsafe(3, 0, 0);
148 out_HM.set_unsafe(3, 1, 0);
149 out_HM.set_unsafe(3, 2, 0);
150 out_HM.set_unsafe(3, 3, 1);
194 this->m_rotvec[0] = aux[0];
195 this->m_rotvec[1] = aux[1];
196 this->m_rotvec[2] = aux[2];
198 this->m_coords[0] = m.get_unsafe(0, 3);
199 this->m_coords[1] = m.get_unsafe(1, 3);
200 this->m_coords[2] = m.get_unsafe(2, 3);
204 const double x,
const double y,
const double z,
const double yaw = 0,
205 const double pitch = 0,
const double roll = 0);
212 double& out_pitch)
const;
222 double lx,
double ly,
double lz,
double& gx,
double& gy,
double& gz,
238 local_point.
x, local_point.
y, local_point.
z, global_point.
x,
239 global_point.
y, global_point.
z);
250 const double gx,
const double gy,
const double gz,
double& lx,
251 double& ly,
double& lz,
264 out_jacobian_drvtC_drvtA =
nullptr,
266 out_jacobian_drvtC_drvtB =
nullptr);
353 const double x0,
const double y0,
const double z0,
const double vx,
354 const double vy,
const double vz)
369 template <
class ARRAYORVECTOR>
387 template <
class ARRAYORVECTOR>
400 template <
class ARRAYORVECTOR>
424 throw std::runtime_error(
425 "CPose3DRotVec::operator[]: Index of bounds.");
445 throw std::runtime_error(
446 "CPose3DRotVec::operator[]: Index of bounds.");
475 if (!m.fromMatlabStringFormat(
s))
479 "Wrong size of vector in ::fromString");
480 for (
int i = 0; i < 3; i++)
m_coords[i] = m.get_unsafe(0, i);
481 for (
int i = 0; i < 3; i++)
m_rotvec[i] = m.get_unsafe(0, 3 + i);
539 static inline bool empty() {
return false; }
544 throw std::logic_error(
546 "Try to change the size of CPose3DRotVec to %u.",
547 static_cast<unsigned>(
n)));
553 std::ostream&
operator<<(std::ostream& o,
const CPose3DRotVec&
p);
557 CPose3DRotVec
operator-(
const CPose3DRotVec&
p);
559 bool operator==(
const CPose3DRotVec& p1,
const CPose3DRotVec& p2);
560 bool operator!=(
const CPose3DRotVec& p1,
const CPose3DRotVec& p2);
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
A numeric matrix of compile-time fixed size.
A quaternion, which can represent a 3D rotation as pair , with a real part "r" and a 3D vector ,...
A class used to store a 2D point.
A class used to store a 3D point.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
A class used to store a 3D pose as a translation (x,y,z) and a quaternion (qr,qx,qy,...
A 3D pose, with a 3D translation and a rotation in 3D parameterized in rotation-vector form (equivale...
void inverseComposeFrom(const CPose3DRotVec &A, const CPose3DRotVec &B)
Makes this method is slightly more efficient than "this= A - B;" since it avoids the temporary objec...
CPose3DRotVec(TConstructorFlags_Poses constructor_dummy_param)
Fast constructor that leaves all the data uninitialized - call with UNINITIALIZED_POSE as argument.
void fromString(const std::string &s)
Set the current object value from a string generated by 'asString' (eg: "[x y z yaw pitch roll]",...
double value_type
The type of the elements.
void setFrom6Vector(const ARRAYORVECTOR &vec6)
Set pose from an array with these 6 elements: [x y z vx vy vz] where v{xyz} is the rotation vector an...
CPose3DRotVec & operator=(const CPose3DRotVec &o)
Copy operator.
std::string asString() const
void getAsVector(ARRAYORVECTOR &v) const
Like getAs6Vector() but for dynamic size vectors (required by base class CPoseOrPoint)
std::ptrdiff_t difference_type
void operator*=(const double s)
Scalar multiplication of x,y,z,vx,vy,vz.
void setToNaN() override
Set all data fields to quiet NaN.
void inverseComposePoint(const double gx, const double gy, const double gz, double &lx, double &ly, double &lz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dpose=nullptr) const
Computes the 3D point L such as .
static void resize(const size_t n)
void asString(std::string &s) const
Returns a human-readable textual representation of the object: "[x y z rx ry rz]".
void inverse()
Convert this pose into its inverse, saving the result in itself.
void sphericalCoordinates(const mrpt::math::TPoint3D &point, double &out_range, double &out_yaw, double &out_pitch) const
Computes the spherical coordinates of a 3D point as seen from the 6D pose specified by this object.
static size_type max_size()
CPose3DRotVec(const double *vec6)
Constructor from an array with these 6 elements: [w1 w2 w3 x y z] where r{ij} are the entries of the ...
static CPose3DRotVec exp(const mrpt::math::CArrayDouble< 6 > &vect)
Exponentiate a Vector in the SE(3) Lie Algebra to generate a new CPose3DRotVec (static method).
void getAs6Vector(ARRAYORVECTOR &vec6) const
Gets pose as an array with these 6 elements: [x y z vx vy vz] where v{xyz} is the rotation vector and...
void getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &out_HM) const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
void addComponents(const CPose3DRotVec &p)
Scalar sum of all 6 components: This is diferent from poses composition, which is implemented as "+" ...
void composeFrom(const CPose3DRotVec &A, const CPose3DRotVec &B, mrpt::math::CMatrixFixedNumeric< double, 6, 6 > *out_jacobian_drvtC_drvtA=nullptr, mrpt::math::CMatrixFixedNumeric< double, 6, 6 > *out_jacobian_drvtC_drvtB=nullptr)
Makes "this = A (+) B"; this method is slightly more efficient than "this= A + B;" since it avoids th...
CPose3DRotVec getInverse() const
Compute the inverse of this pose and return the result.
const double & const_reference
double & operator[](unsigned int i)
CPose3DRotVec(const mrpt::math::CArrayDouble< 6 > &v)
Constructor with initilization of the pose from a vector [w1 w2 w3 x y z].
void toQuatXYZ(CPose3DQuat &q) const
Convert this RVT into a quaternion + XYZ.
void ln(mrpt::math::CArrayDouble< 6 > &out_ln) const
Take the logarithm of the 3x4 matrix defined by this pose, generating the corresponding vector in the...
const double & operator[](unsigned int i) const
CPose3DRotVec operator+(const CPose3DRotVec &b) const
The operator is the pose compounding operator.
CPose3DRotVec & operator+=(const CPose3DRotVec &b)
Make (b can be "this" without problems)
CPose3DRotVec(const CPose3DRotVec &o)
Copy constructor.
type_value & getPoseMean()
mrpt::math::CArrayDouble< 3 > ln_rotation() const
Take the logarithm of the 3x3 rotation matrix part of this pose, generating the corresponding vector ...
const mrpt::math::CMatrixDouble33 getRotationMatrix() const
This is an overloaded member function, provided for convenience. It differs from the above function o...
void composePoint(const mrpt::math::TPoint3D local_point, mrpt::math::TPoint3D &global_point) const
An alternative, slightly more efficient way of doing with G and L being 3D points and P this 6D pose...
void setFromValues(const double x0, const double y0, const double z0, const double vx, const double vy, const double vz)
Set the pose from a 3D position (meters) and yaw/pitch/roll angles (radians) - This method recomputes...
CPose3DRotVec operator-(const CPose3DRotVec &b) const
Compute
void changeCoordinatesReference(const CPose3DRotVec &p)
makes: this = p (+) this
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dpose=nullptr) const
An alternative, slightly more efficient way of doing with G and L being 3D points and P this 6D pose...
CPose3DRotVec()
Default constructor, with all the coordinates set to zero.
CPose3DRotVec type_value
Used to emulate CPosePDF types, for example, in mrpt::graphs::CNetworkOfPoses.
const type_value & getPoseMean() const
mrpt::math::CArrayDouble< 3 > rotVecFromRotMat(const math::CMatrixDouble44 &m)
Create a vector with 3 components according to the input transformation matrix (only the rotation wil...
void setFromXYZAndAngles(const double x, const double y, const double z, const double yaw=0, const double pitch=0, const double roll=0)
CPose3DRotVec(const double vx, const double vy, const double vz, const double x, const double y, const double z)
Constructor with initilization of the pose.
mrpt::math::CArrayDouble< 3 > m_rotvec
The rotation vector [vx,vy,vz].
void setFromTransformationMatrix(const mrpt::math::CMatrixDouble44 &m)
mrpt::math::CMatrixDouble44 getHomogeneousMatrixVal() const
mrpt::math::CArrayDouble< 3 > m_coords
The translation vector [x,y,z].
A base class for representing a pose in 2D or 3D.
double x() const
Common members of all points & poses classes.
The virtual base class which provides a unified interface for all persistent objects in MRPT.
GLsizei const GLchar ** string
GLdouble GLdouble GLdouble GLdouble q
#define THROW_EXCEPTION(msg)
#define MRPT_UNUSED_PARAM(a)
Can be used to avoid "not used parameters" warnings from the compiler.
#define ASSERTMSG_(f, __ERROR_MSG)
size_t size(const MATRIXLIKE &m, const int dim)
bool operator!=(const CPoint< DERIVEDCLASS > &p1, const CPoint< DERIVEDCLASS > &p2)
CPose2D operator-(const CPose2D &p)
Unary - operator: return the inverse pose "-p" (Note that is NOT the same than a pose with negative x...
std::ostream & operator<<(std::ostream &o, const CPoint< DERIVEDCLASS > &p)
Dumps a point as a string [x,y] or [x,y,z]
bool operator==(const CPoint< DERIVEDCLASS > &p1, const CPoint< DERIVEDCLASS > &p2)
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
double x
X,Y,Z coordinates.