35 Base(model, key), p_(
Rot3::Logmap(P)), z_(
Rot3::Logmap(Z)) {
39 gtsam::NonlinearFactor::shared_ptr
clone()
const override {
40 return boost::static_pointer_cast<gtsam::NonlinearFactor>(
41 gtsam::NonlinearFactor::shared_ptr(
new This(*
this))); }
44 void print(
const std::string& s =
"",
45 const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const override {
47 std::cout <<
"RotateFactor:]\n";
48 std::cout <<
"p: " << p_.transpose() << std::endl;
49 std::cout <<
"z: " << z_.transpose() << std::endl;
54 boost::optional<Matrix&> H = boost::none)
const override {
58 return (Vector(3) << q.x()-p_.x(), q.y()-p_.y(), q.z()-p_.z()).finished();
79 Base(model, key), i_p_(i_p), c_z_(c_z) {
84 gtsam::Quaternion iRc;
91 gtsam::NonlinearFactor::shared_ptr
clone()
const override {
92 return boost::static_pointer_cast<gtsam::NonlinearFactor>(
93 gtsam::NonlinearFactor::shared_ptr(
new This(*
this))); }
96 void print(
const std::string& s =
"",
97 const KeyFormatter& keyFormatter = DefaultKeyFormatter)
const override {
99 std::cout <<
"RotateDirectionsFactor:" << std::endl;
105 Vector
evaluateError(
const Rot3& iRc, boost::optional<Matrix&> H = boost::none)
const override {
106 Unit3 i_q = iRc * c_z_;
#define GTSAM_MAKE_ALIGNED_OPERATOR_NEW
This marks a GTSAM object to require alignment.
Definition: types.h:277
3D rotation represented as a rotation matrix or quaternion
Non-linear factor base classes.
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:35
noiseModel::Base::shared_ptr SharedNoiseModel
Note, deliberately not in noiseModel namespace.
Definition: NoiseModel.h:736
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:69
std::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:35
Point3 rotate(const Point3 &p, OptionalJacobian< 3, 3 > H1=boost::none, OptionalJacobian< 3, 3 > H2=boost::none) const
rotate point from rotated coordinate frame to world
Definition: Rot3M.cpp:149
Represents a 3D point on a unit sphere.
Definition: Unit3.h:42
GTSAM_EXPORT Vector3 unitVector(OptionalJacobian< 3, 2 > H=boost::none) const
Return unit-norm Vector.
Definition: Unit3.cpp:143
GTSAM_EXPORT void print(const std::string &s=std::string()) const
The print fuction.
Definition: Unit3.cpp:156
GTSAM_EXPORT Vector2 error(const Unit3 &q, OptionalJacobian< 2, 2 > H_q=boost::none) const
Signed, vector-valued error between two directions.
Definition: Unit3.cpp:191
This is the base class for all factor types.
Definition: Factor.h:56
double error(const Values &c) const override
Calculate the error of the factor.
Definition: NonlinearFactor.cpp:127
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
Print.
Definition: NonlinearFactor.cpp:63
A convenient base class for creating your own NoiseModelFactor with 1 variable.
Definition: NonlinearFactor.h:285
Factor on unknown rotation iRC that relates two incremental rotations c1Rc2 = iRc' * i1Ri2 * iRc Whic...
Definition: RotateFactor.h:23
RotateFactor(Key key, const Rot3 &P, const Rot3 &Z, const SharedNoiseModel &model)
Constructor.
Definition: RotateFactor.h:33
Vector evaluateError(const Rot3 &R, boost::optional< Matrix & > H=boost::none) const override
vector of errors returns 2D vector
Definition: RotateFactor.h:53
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
Definition: RotateFactor.h:44
gtsam::NonlinearFactor::shared_ptr clone() const override
Definition: RotateFactor.h:39
Factor on unknown rotation iRc that relates two directions c Directions provide less constraints than...
Definition: RotateFactor.h:67
Vector evaluateError(const Rot3 &iRc, boost::optional< Matrix & > H=boost::none) const override
vector of errors returns 2D vector
Definition: RotateFactor.h:105
RotateDirectionsFactor(Key key, const Unit3 &i_p, const Unit3 &c_z, const SharedNoiseModel &model)
Constructor.
Definition: RotateFactor.h:77
void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
print
Definition: RotateFactor.h:96
static Rot3 Initialize(const Unit3 &i_p, const Unit3 &c_z)
Initialize rotation iRc such that i_p = iRc * c_z.
Definition: RotateFactor.h:83
gtsam::NonlinearFactor::shared_ptr clone() const override
Definition: RotateFactor.h:91