39 virtual gtsam::NonlinearFactor::shared_ptr
clone()
const {
40 return boost::static_pointer_cast<gtsam::NonlinearFactor>(
44 Vector evaluateError(
const Pose3& gk1,
const Pose3& gk,
const Vector6& xik,
45 boost::optional<Matrix&> H1 = boost::none,
46 boost::optional<Matrix&> H2 = boost::none,
47 boost::optional<Matrix&> H3 = boost::none)
const {
52 Matrix6 D_gkxi_gk, D_gkxi_exphxi;
53 Pose3 gkxi = gk.compose(exphxi, D_gkxi_gk, H3 ? &D_gkxi_exphxi : 0);
55 Matrix6 D_hx_gk1, D_hx_gkxi;
56 Pose3 hx = gkxi.between(gk1, (H2 || H3) ? &D_hx_gkxi : 0, H1 ? &D_hx_gk1 : 0);
61 if (H1) *H1 = D_log_hx * D_hx_gk1;
63 Matrix6 D_log_gkxi = D_log_hx * D_hx_gkxi;
64 if (H2) *H2 = D_log_gkxi * D_gkxi_gk;
65 if (H3) *H3 = D_log_gkxi * D_gkxi_exphxi * D_exphxi_xi * h_;
93 double h,
const Matrix& Inertia,
const Vector& Fu,
double m,
96 h_(h), Inertia_(Inertia), Fu_(Fu), m_(m) {
101 virtual gtsam::NonlinearFactor::shared_ptr
clone()
const {
102 return boost::static_pointer_cast<gtsam::NonlinearFactor>(
111 boost::optional<Matrix&> H1 = boost::none,
112 boost::optional<Matrix&> H2 = boost::none,
113 boost::optional<Matrix&> H3 = boost::none)
const {
115 Vector muk = Inertia_*xik;
116 Vector muk_1 = Inertia_*xik_1;
122 Matrix D_adjThxik_muk, D_adjThxik1_muk1;
126 Matrix D_gravityBody_gk;
128 Vector f_ext = (Vector(6) << 0.0, 0.0, 0.0, gravityBody.
x(), gravityBody.
y(), gravityBody.
z()).finished();
130 Vector hx = pk - pk_1 - h_*Fu_ - h_*f_ext;
133 Matrix D_pik_xi = Inertia_-0.5*(h_*D_adjThxik_muk +
Pose3::adjointMap(h_*xik).transpose()*Inertia_);
138 Matrix D_pik1_xik1 = Inertia_-0.5*(-h_*D_adjThxik1_muk1 +
Pose3::adjointMap(-h_*xik_1).transpose()*Inertia_);
144 insertSub(*H3, -h_*D_gravityBody_gk, 3, 0);
151 Vector computeError(
const Vector6& xik,
const Vector6& xik_1,
const Pose3& gk)
const {
152 Vector pk = Pose3::dExpInv_exp(h_*xik).transpose()*Inertia_*xik;
153 Vector pk_1 = Pose3::dExpInv_exp(-h_*xik_1).transpose()*Inertia_*xik_1;
156 Vector f_ext = (Vector(6) << 0.0, 0.0, 0.0, gravityBody.
x(), gravityBody.
y(), gravityBody.
z());
158 Vector hx = pk - pk_1 - h_*Fu_ - h_*f_ext;
163 Vector
evaluateError(
const Vector6& xik,
const Vector6& xik_1,
const Pose3& gk,
164 boost::optional<Matrix&> H1 = boost::none,
165 boost::optional<Matrix&> H2 = boost::none,
166 boost::optional<Matrix&> H3 = boost::none)
const {
169 boost::function<Vector(
const Vector6&,
const Vector6&,
const Pose3&)>(
170 boost::bind(&DiscreteEulerPoincareHelicopter::computeError, *
this, _1, _2, _3)
177 boost::function<Vector(
const Vector6&,
const Vector6&,
const Pose3&)>(
178 boost::bind(&DiscreteEulerPoincareHelicopter::computeError, *
this, _1, _2, _3)
185 boost::function<Vector(
const Vector6&,
const Vector6&,
const Pose3&)>(
186 boost::bind(&DiscreteEulerPoincareHelicopter::computeError, *
this, _1, _2, _3)
192 return computeError(xik, xik_1, gk);
Implement the Reconstruction equation: , where : timestep (parameter) : poses at the current and the ...
Definition: SimpleHelicopter.h:27
This is the base class for all factor types.
Definition: Factor.h:54
static Matrix6 adjointMap(const Vector6 &xi)
FIXME Not tested - marked as incorrect.
Definition: Pose3.cpp:65
double x() const
get x
Definition: Point3.h:108
internal::FixedSizeMatrix< Y, X1 >::type numericalDerivative31(boost::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
Compute numerical derivative in argument 1 of ternary function.
Definition: numericalDerivative.h:224
static shared_ptr All(size_t dim)
Fully constrained variations.
Definition: NoiseModel.h:460
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
void insertSub(Eigen::MatrixBase< Derived1 > &fullMatrix, const Eigen::MatrixBase< Derived2 > &subMatrix, size_t i, size_t j)
insert a submatrix IN PLACE at a specified location in a larger matrix NOTE: there is no size checkin...
Definition: Matrix.h:197
Point3 unrotate(const Point3 &p, OptionalJacobian< 3, 3 > H1=boost::none, OptionalJacobian< 3, 3 > H2=boost::none) const
rotate point from world to rotated frame
Definition: Rot3.cpp:134
static Vector6 adjointTranspose(const Vector6 &xi, const Vector6 &y, OptionalJacobian< 6, 6 > H=boost::none)
The dual version of adjoint action, acting on the dual space of the Lie-algebra vector space.
Definition: Pose3.cpp:91
Implement the Discrete Euler-Poincare' equation:
Definition: SimpleHelicopter.h:76
static Vector6 Logmap(const Pose3 &p, OptionalJacobian< 6, 6 > H=boost::none)
Log map at identity - return the canonical coordinates of this rotation.
Definition: Pose3.cpp:139
Vector evaluateError(const Vector6 &xik, const Vector6 &xik_1, const Pose3 &gk, boost::optional< Matrix & > H1=boost::none, boost::optional< Matrix & > H2=boost::none, boost::optional< Matrix & > H3=boost::none) const
DEP, with optional derivatives pk - pk_1 - h_*Fu_ - h_*f_ext = 0 where pk = CT_TLN(h*xi_k)*Inertia*xi...
Definition: SimpleHelicopter.h:110
A convenient base class for creating your own NoiseModelFactor with 3 variables.
Definition: NonlinearFactor.h:420
Non-linear factor base classes.
virtual gtsam::NonlinearFactor::shared_ptr clone() const
Definition: SimpleHelicopter.h:39
const Rot3 & rotation(OptionalJacobian< 3, 6 > H=boost::none) const
get rotation
Definition: Pose3.cpp:272
internal::FixedSizeMatrix< Y, X2 >::type numericalDerivative32(boost::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
Compute numerical derivative in argument 2 of ternary function.
Definition: numericalDerivative.h:252
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
Some functions to compute numerical derivatives.
return a deep copy of this virtual factor gtsam::NonlinearFactor::shared_ptr clone() const
Creates a shared_ptr clone of the factor - needs to be specialized to allow for subclasses.
Definition: SimpleHelicopter.h:101
double y() const
get y
Definition: Point3.h:111
static Pose3 Expmap(const Vector6 &xi, OptionalJacobian< 6, 6 > H=boost::none)
Exponential map at identity - create a rotation from canonical coordinates .
Definition: Pose3.cpp:120
virtual double error(const Values &c) const
Calculate the error of the factor.
Definition: NonlinearFactor.cpp:97
internal::FixedSizeMatrix< Y, X3 >::type numericalDerivative33(boost::function< Y(const X1 &, const X2 &, const X3 &)> h, const X1 &x1, const X2 &x2, const X3 &x3, double delta=1e-5)
Compute numerical derivative in argument 3 of ternary function.
Definition: numericalDerivative.h:280
double z() const
get z
Definition: Point3.h:114