20#include <gtsam/config.h>
28#if GTSAM_ENABLE_BOOST_SERIALIZATION
29#include <boost/serialization/base_object.hpp>
48 typedef Point3 Translation;
49 inline constexpr static auto dimension = 6;
52 using Vector16 = Eigen::Matrix<double, 16, 1>;
53 using Base::operator*;
64 Pose3& operator=(
const Pose3& other) =
default;
66 Pose3(
const Base& other) : Base(other) {}
70 : Base(R, Vector3(t.
x(), t.
y(), t.
z())) {}
76 Pose3(
const Matrix &T) : Base(Matrix4(T)) {}
81 OptionalJacobian<6, 3> Ht = {});
84 static Pose3 FromPose2(
const Pose2& p, OptionalJacobian<6,3> H = {});
91 static std::optional<Pose3> Align(
const Point3Pairs& abPointPairs);
94 static std::optional<Pose3> Align(ConstMatrixView a, ConstMatrixView b);
101 void print(
const std::string& s =
"")
const;
104 bool equals(
const Pose3& pose,
double tol = 1e-9)
const;
124 Pose3 interpolateRt(
const Pose3& T,
double t,
125 OptionalJacobian<6, 6> Hself = {},
126 OptionalJacobian<6, 6> Harg = {},
127 OptionalJacobian<6, 1> Ht = {})
const;
138 using LieAlgebra = Matrix4;
144 static Matrix6 adjointMap_(
const Vector6 &xi) {
return adjointMap(xi);}
145 static Vector6 adjoint_(
const Vector6 &xi,
const Vector6 &y) {
return adjoint(xi, y);}
149 static Pose3 Retract(
const Vector6& xi, ChartJacobian Hxi = {});
150 static Vector6 Local(
const Pose3& pose, ChartJacobian Hpose = {});
172 Matrix transformFrom(ConstMatrixView points)
const;
187 {}, OptionalJacobian<3, 3> Hpoint = {})
const;
201 const Point3& translation(OptionalJacobian<3, 6> Hself = {})
const;
224 OptionalJacobian<6, 6> HaTb = {})
const;
230 Pose3 transformPoseTo(
const Pose3& wTb, OptionalJacobian<6, 6> Hself = {},
231 OptionalJacobian<6, 6> HwTb = {})
const;
238 double range(
const Point3& point, OptionalJacobian<1, 6> Hself = {},
239 OptionalJacobian<1, 3> Hpoint = {})
const;
246 double range(
const Pose3& pose, OptionalJacobian<1, 6> Hself = {},
247 OptionalJacobian<1, 6> Hpose = {})
const;
254 Unit3 bearing(
const Point3& point, OptionalJacobian<2, 6> Hself = {},
255 OptionalJacobian<2, 3> Hpoint = {})
const;
263 Unit3 bearing(
const Pose3& pose, OptionalJacobian<2, 6> Hself = {},
264 OptionalJacobian<2, 6> Hpose = {})
const;
294 OptionalJacobian<6, 6> Hy = {})
const;
298 friend std::ostream &operator<<(std::ostream &os,
const Pose3& p);
304#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
306 static inline LieAlgebra wedge(
double wx,
double wy,
double wz,
double vx,
307 double vy,
double vz) {
308 return Hat((TangentVector() << wx, wy, wz, vx, vy, vz).finished());
314#if GTSAM_ENABLE_BOOST_SERIALIZATION
316 friend class boost::serialization::access;
317 template<
class Archive>
318 void serialize(Archive & ar,
const unsigned int ) {
319 ar & BOOST_SERIALIZATION_NVP(R_);
320 ar & BOOST_SERIALIZATION_NVP(t_);
327#ifdef GTSAM_ALLOW_DEPRECATED_SINCE_V43
330inline Matrix wedge<Pose3>(
const Vector& xi) {
337using Pose3Pair = std::pair<Pose3, Pose3>;
338using Pose3Pairs = std::vector<std::pair<Pose3, Pose3> >;
341typedef std::vector<Pose3> Pose3Vector;
375 if constexpr (D == 1) {
376 const Matrix4 T = value.
matrix();
377 Eigen::Matrix<double, 13, 1> X;
379 X.segment<3>(1) = T.col(0).head<3>();
380 X.segment<3>(4) = T.col(1).head<3>();
381 X.segment<3>(7) = T.col(2).head<3>();
382 X.segment<3>(10) = T.col(3).head<3>();
385 throw std::invalid_argument(
386 "traits<Pose3>::QcqpValue only supports D=1.");
396 if constexpr (D == 1) {
397 std::vector<std::pair<Matrix, double>> constraints;
398 constraints.reserve(10);
400 Matrix A = Matrix::Zero(13, 13);
404 constraints.emplace_back(A, 1.0);
414 constraints.emplace_back(A, 0.0);
423 constraints.emplace_back(A, 0.0);
432 constraints.emplace_back(A, 0.0);
439 constraints.emplace_back(A, 1.0);
448 constraints.emplace_back(A, 0.0);
457 constraints.emplace_back(A, 0.0);
463 constraints.emplace_back(A, 1.0);
472 constraints.emplace_back(A, 0.0);
478 constraints.emplace_back(A, 1.0);
482 throw std::invalid_argument(
483 "traits<Pose3>::QcqpConstraints only supports D=1.");
490 if constexpr (D == 1) {
492 std::abs(X(0, 0)) < 1e-9) {
493 throw std::invalid_argument(
494 "traits<Pose3>::FromQcqpValue requires a 13-by-1 vector with a "
495 "nonzero homogenization entry.");
497 const Vector x = X.col(0) / X(0, 0);
499 R.col(0) = x.segment<3>(1);
500 R.col(1) = x.segment<3>(4);
501 R.col(2) = x.segment<3>(7);
504 throw std::invalid_argument(
505 "traits<Pose3>::FromQcqpValue only supports D=1.");
Base class and basic functions for Lie types.
Extended pose Lie group SE_k(3), with static or dynamic k.
3D rotation represented as a rotation matrix or quaternion
Global functions in a separate testing namespace.
Definition chartTesting.h:28
Vector3 Point3
As of GTSAM 4, in order to make GTSAM more lean, it is now possible to just typedef Point3 to Vector3...
Definition Point3.h:38
void print(const Matrix &A, const string &s, ostream &stream)
print without optional string, must specify cout yourself
Definition Matrix.cpp:143
Line3 transformTo(const Pose3 &wTc, const Line3 &wL, OptionalJacobian< 4, 6 > Dpose, OptionalJacobian< 4, 4 > Dline)
Transform a line from world to camera frame.
Definition Line3.cpp:91
A manifold defines a space in which there is a notion of a linear tangent space that can be centered ...
Definition Group.h:37
Both LieGroupTraits and Testable.
Definition MatrixLieGroup.h:350
OptionalJacobian is an Eigen::Ref like class that can take be constructed using either a fixed size o...
Definition OptionalJacobian.h:40
Definition BearingRange.h:36
Definition BearingRange.h:42
Definition BearingRange.h:182
Definition BearingRange.h:196
MatrixRep matrix() const
Homogeneous matrix representation.
Definition ExtendedPose3-inl.h:340
static LieAlgebra Hat(const TangentVector &xi)
Rot3 R_
Definition ExtendedPose3.h:80
Matrix3K t_
Definition ExtendedPose3.h:81
ExtendedPose3()
Definition ExtendedPose3.h:99
A 2D pose (Point2,Rot2).
Definition Pose2.h:39
A 3D pose (R,t) : (Rot3,Point3).
Definition Pose3.h:42
Pose3()
Default constructor is origin.
Definition Pose3.h:59
Pose3(const Rot3 &R, const Point3 &t)
Construct from R,t.
Definition Pose3.h:69
Pose3(const Matrix &T)
Constructor from 4*4 matrix.
Definition Pose3.h:76
double z() const
get z
Definition Pose3.h:214
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:284
Pose3 operator*(const Pose3 &T) const
Compose syntactic sugar.
Definition Pose3.h:130
Rot3 Rotation
Pose Concept requirements.
Definition Pose3.h:47
Point3 transformFrom(const Point3 &point, OptionalJacobian< 3, 6 > Hself={}, OptionalJacobian< 3, 3 > Hpoint={}) const
takes point in Pose coordinates and transforms it to world coordinates
Definition Pose3.cpp:180
double y() const
get y
Definition Pose3.h:209
const Point3 & translation(OptionalJacobian< 3, 6 > Hself={}) const
get translation
Definition Pose3.cpp:158
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:275
Point3 operator*(const Point3 &point) const
syntactic sugar for transformFrom
Definition Pose3.h:175
double x() const
get x
Definition Pose3.h:204
Pose3(const Pose3 &pose)=default
Copy constructor.
static Matrix QcqpValue(const Pose3 &value)
Return the D=1 homogenized QCQP variable x = [1, vec(R), tx, ty, tz] in column-major order.
Definition Pose3.h:374
static constexpr int QcqpVectorDim
Dimension of the D=1 homogenized QCQP vector.
Definition Pose3.h:367
static std::vector< std::pair< Matrix, double > > QcqpConstraints()
Return the ten D=1 lifted SE(3) manifold constraints A, b such that trace(x' A x) = b.
Definition Pose3.h:395
static Pose3 FromQcqpValue(const Matrix &X)
Project a D=1 homogenized QCQP vector back to Pose3.
Definition Pose3.h:489
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
Definition Rot3.h:65
static Rot3 ClosestTo(const Matrix3 &M)
Static, named constructor that finds Rot3 element closest to M in Frobenius norm.
Definition Rot3.h:287