MROB
PiFactorPlane.hpp
1 /* Copyright (c) 2022, Gonzalo Ferrer
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  *
15  *
16  * EigenFactorPlane.hpp
17  *
18  * Created on: Oct 26 2022
19  * Author: Gonzalo Ferrer
20  * g.ferrer@skoltech.ru
21  * Mobile Robotics Lab.
22  */
23 
24 #ifndef PIFACTORPLANE_HPP_
25 #define PIFACTORPLABE_HPP_
26 
27 
28 #include "mrob/matrix_base.hpp"
29 #include "mrob/factor.hpp"
30 
31 
32 namespace mrob{
33 
44 class PiFactorPlane: public Factor{
45 public:
50  PiFactorPlane(const Mat4 &Sobservation, std::shared_ptr<Node> &nodePose,
51  std::shared_ptr<Node> &nodePlane,
52  Factor::robustFactorType robust_type = Factor::robustFactorType::QUADRATIC);
53  ~PiFactorPlane() override = default;
57  virtual void evaluate_residuals() override;
61  virtual void evaluate_jacobians() override;
62  virtual void evaluate_chi2() override;
63 
64  virtual void print() const;
65 
66  MatRefConst get_obs() const override {return Sobs_;};
67  VectRefConst get_residual() const override {return r_;};
68  MatRefConst get_information_matrix() const override {return W_;};
69  MatRefConst get_jacobian([[maybe_unused]] mrob::factor_id_t id = 0) const override {return J_;};
70 
71 
72 
73 private:
74  Mat41 r_; //residuals
75  Mat<4,10> J_;//Jacobians dimensions obs x [plane(4) + pose(6)]
76  Mat4 W_;//inverse of observation covariance (information matrix)
77  bool reversedNodeOrder_;
78  // intermediate variables to keep
79  Mat41 plane_;
80  Mat4 Sobs_, S_mul_T_transp_;// we store this bariable for later calcuating the Jacobian faster
81 
82 public:
83  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
84 
85 };
86 
87 }
88 #endif /* PiFactorPlane_HPP_ */
MatRefConst get_obs() const override
Definition: PiFactorPlane.hpp:66
virtual void print() const
Definition: PiFactorPlane.cpp:101
robustFactorType
Definition: factor.hpp:87
MatRefConst get_jacobian([[maybe_unused]] mrob::factor_id_t id=0) const override
Definition: PiFactorPlane.hpp:69
PiFactorPlane(const Mat4 &Sobservation, std::shared_ptr< Node > &nodePose, std::shared_ptr< Node > &nodePlane, Factor::robustFactorType robust_type=Factor::robustFactorType::QUADRATIC)
Definition: PiFactorPlane.cpp:33
virtual void evaluate_residuals() override
Definition: PiFactorPlane.cpp:56
virtual void evaluate_chi2() override
Definition: PiFactorPlane.cpp:96
Definition: PiFactorPlane.hpp:44
VectRefConst get_residual() const override
Definition: PiFactorPlane.hpp:67
Special Euclidean (group) in 3d Is the group representing rotations and translations, that is, rigid body transformations. SE3 = {T = [R t] | R SO3 , t Re^3 } [0 1] Associated to the groups of RBT, there is the Lie algebra se3 representing the same transformation in the tangent space around the identity. Particularly, xi =[w , v] Re^6, where w Re^3 represents the rotation and v the translation. We will preserve this order in this class.
Definition: matrix_base.hpp:36
Definition: factor.hpp:81
virtual void evaluate_jacobians() override
Definition: PiFactorPlane.cpp:73