20 #include <gtsam/config.h>
22 #ifndef GTSAM_POSE3_EXPMAP
23 #define POSE3_DEFAULT_COORDINATES_MODE Pose3::FIRST_ORDER
25 #define POSE3_DEFAULT_COORDINATES_MODE Pose3::EXPMAP
28 #include <gtsam/base/DerivedValue.h>
44 static const size_t dimension = 6;
66 R_(pose.R_), t_(pose.t_) {
79 R_(T(0, 0), T(0, 1), T(0, 2), T(1, 0), T(1, 1), T(1, 2), T(2, 0), T(2, 1),
80 T(2, 2)), t_(T(0, 3), T(1, 3), T(2, 3)) {
88 void print(
const std::string& s =
"")
const;
91 bool equals(
const Pose3& pose,
double tol = 1e-9)
const;
103 Pose3 inverse(boost::optional<Matrix&> H1 = boost::none)
const;
106 Pose3 compose(
const Pose3& p2, boost::optional<Matrix&> H1 = boost::none,
107 boost::optional<Matrix&> H2 = boost::none)
const;
111 return Pose3(R_ * T.R_, t_ + R_ * T.t_);
118 Pose3 between(
const Pose3& p2, boost::optional<Matrix&> H1 = boost::none,
119 boost::optional<Matrix&> H2 = boost::none)
const;
144 Pose3 retractFirstOrder(
const Vector& d)
const;
148 POSE3_DEFAULT_COORDINATES_MODE)
const;
158 static Pose3 Expmap(
const Vector& xi);
161 static Vector6 Logmap(
const Pose3& p);
167 Matrix6 AdjointMap()
const;
173 Vector
Adjoint(
const Vector& xi_b)
const {
return AdjointMap()*xi_b; }
190 static Matrix6 adjointMap(
const Vector& xi);
195 static Vector adjoint(
const Vector& xi,
const Vector& y, boost::optional<Matrix&> H = boost::none);
200 static Vector adjointTranspose(
const Vector& xi,
const Vector& y, boost::optional<Matrix&> H = boost::none);
212 static Matrix6 dExpInv_exp(
const Vector& xi);
221 static Matrix
wedge(
double wx,
double wy,
double wz,
double vx,
double vy,
double vz) {
222 return (Matrix(4,4) <<
241 boost::optional<Matrix&> Dpose=boost::none, boost::optional<Matrix&> Dpoint=boost::none)
const;
254 boost::optional<Matrix&> Dpose=boost::none, boost::optional<Matrix&> Dpoint=boost::none)
const;
267 double x()
const {
return t_.x(); }
270 double y()
const {
return t_.y(); }
273 double z()
const {
return t_.z(); }
276 Matrix4 matrix()
const;
286 double range(
const Point3& point,
287 boost::optional<Matrix&> H1=boost::none,
288 boost::optional<Matrix&> H2=boost::none)
const;
295 double range(
const Pose3& pose,
296 boost::optional<Matrix&> H1=boost::none,
297 boost::optional<Matrix&> H2=boost::none)
const;
318 GTSAM_EXPORT
friend std::ostream &operator<<(std::ostream &os,
const Pose3& p);
322 friend class boost::serialization::access;
323 template<
class Archive>
324 void serialize(Archive & ar,
const unsigned int version) {
325 ar & boost::serialization::make_nvp(
"Pose3",
326 boost::serialization::base_object<Value>(*
this));
327 ar & BOOST_SERIALIZATION_NVP(R_);
328 ar & BOOST_SERIALIZATION_NVP(t_);
343 return Pose3::wedge(xi(0), xi(1), xi(2), xi(3), xi(4), xi(5));
351 GTSAM_EXPORT boost::optional<Pose3> align(
const std::vector<Point3Pair>& pairs);
const Rot3 & rotation() const
get rotation
Definition: Pose3.h:261
Pose3()
Default constructor is origin.
Definition: Pose3.h:61
double y() const
get y
Definition: Pose3.h:270
Pose3 operator*(const Pose3 &T) const
compose syntactic sugar
Definition: Pose3.h:110
Pose3(const Matrix &T)
Constructor from 4*4 matrix.
Definition: Pose3.h:78
Matrix inverse(const Matrix &A)
invert A
Definition: Matrix.cpp:289
double z() const
get z
Definition: Pose3.h:273
const Point3 & translation() const
get translation
Definition: Pose3.h:264
Pose3(const Pose3 &pose)
Copy constructor.
Definition: Pose3.h:65
CoordinatesMode
Enum to indicate which method should be used in Pose3::retract() and Pose3::localCoordinates() ...
Definition: Pose3.h:128
Matrix wedge< Pose3 >(const Vector &xi)
wedge for Pose3:
Definition: Pose3.h:342
Point3 operator*(const Point3 &p) const
syntactic sugar for transform_from
Definition: Pose3.h:244
void print(const Matrix &A, const string &s, ostream &stream)
print a matrix
Definition: Matrix.cpp:183
static Matrix wedge(double wx, double wy, double wz, double vx, double vy, double vz)
wedge for Pose3:
Definition: Pose3.h:221
The correct exponential map, computationally expensive.
Definition: Pose3.h:129
Template to create a binary predicate.
Definition: Testable.h:102
Rot3 Rotation
Pose Concept requirements.
Definition: Pose3.h:47
Pose3(const Rot3 &R, const Point3 &t)
Construct from R,t.
Definition: Pose3.h:70
static std::pair< size_t, size_t > rotationInterval()
Return the start and end indices (inclusive) of the rotation component of the exponential map paramet...
Definition: Pose3.h:315
double x() const
get x
Definition: Pose3.h:267
static Pose3 identity()
identity for group operation
Definition: Pose3.h:98
static size_t Dim()
Dimensionality of tangent space = 6 DOF - used to autodetect sizes.
Definition: Pose3.h:134
std::pair< Point3, Point3 > Point3Pair
Calculate pose between a vector of 3D point correspondences (p,q) where q = Pose3::transform_from(p) ...
Definition: Pose3.h:350
Definition: DerivedValue.h:44
size_t dim() const
Dimensionality of the tangent space = 6 DOF.
Definition: Pose3.h:139
static std::pair< size_t, size_t > translationInterval()
Return the start and end indices (inclusive) of the translation component of the exponential map para...
Definition: Pose3.h:308
3D rotation represented as a rotation matrix or quaternion
Vector Adjoint(const Vector &xi_b) const
FIXME Not tested - marked as incorrect.
Definition: Pose3.h:173