MROB
factor1Pose1Landmark2d.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  * factor1Pose1Landmark2d.hpp
17  *
18  * Created on: Jul 27, 2020
19  * Author: Gonzalo Ferrer
20  * g.ferrer@skoltech.ru
21  * Mobile Robotics Lab.
22  */
23 
24 #ifndef FACTOR1POSE1LANDMARK2D_HPP_
25 #define FACTOR1POSE1LANDMARK2D_HPP_
26 
27 
28 
29 #include "mrob/matrix_base.hpp"
30 #include "mrob/factor.hpp"
31 
32 namespace mrob{
33 
62 {
63  public:
64  Factor1Pose1Landmark2d(const Mat21 &observation, std::shared_ptr<Node> &nodePose,
65  std::shared_ptr<Node> &nodeLandmark, const Mat2 &obsInf, bool initializeLandmark=false,
66  Factor::robustFactorType robust_type = Factor::robustFactorType::QUADRATIC);
67  ~Factor1Pose1Landmark2d() override = default;
71  void evaluate_residuals() override;
75  void evaluate_jacobians() override;
76  void evaluate_chi2() override;
77 
78  void print() const;
79 
80  MatRefConst get_obs() const {return obs_;};
81  VectRefConst get_residual() const {return r_;};
82  MatRefConst get_information_matrix() const {return W_;};
83  MatRefConst get_jacobian([[maybe_unused]] mrob::factor_id_t id = 0) const {return J_;};
84 
85  protected:
86  Mat21 obs_, r_, landmark_;
87  Mat31 state_;
88  matData_t dx_, dy_, q_; // increments from pose to landmark (x,y) and q squared L2 distance
89  Mat2 W_;//inverse of observation covariance (information matrix)
90  Mat<2,5> J_;//Joint Jacobian, Block will depend on order
91  bool reversedNodeOrder_;//flag to keep order when building the adjacency matrix. This should be transparent for the user
92 
93  public:
94  EIGEN_MAKE_ALIGNED_OPERATOR_NEW // as proposed by Eigen
95 
96 };
97 
98 
99 }
100 
101 
102 #endif /* FACTOR1POSE1LANDMARK2D_HPP_ */
robustFactorType
Definition: factor.hpp:87
MatRefConst get_obs() const
Definition: factor1Pose1Landmark2d.hpp:80
VectRefConst get_residual() const
Definition: factor1Pose1Landmark2d.hpp:81
MatRefConst get_jacobian([[maybe_unused]] mrob::factor_id_t id=0) const
Definition: factor1Pose1Landmark2d.hpp:83
void evaluate_chi2() override
Definition: factor1Pose1Landmark2d.cpp:121
void evaluate_residuals() override
Definition: factor1Pose1Landmark2d.cpp:65
Definition: factor1Pose1Landmark2d.hpp:61
void print() const
Definition: factor1Pose1Landmark2d.cpp:125
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
void evaluate_jacobians() override
Definition: factor1Pose1Landmark2d.cpp:93
Definition: factor.hpp:81