MROB
factor2Poses3d.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  * factor2Poses3d.hpp
17  *
18  * Created on: Feb 28, 2018
19  * Author: Gonzalo Ferrer
20  * g.ferrer@skoltech.ru
21  * Mobile Robotics Lab, Skoltech
22  */
23 
24 #ifndef FACTOR2POSES3D_HPP_
25 #define FACTOR2POSES3D_HPP_
26 
27 
28 #include "mrob/matrix_base.hpp"
29 #include "mrob/SE3.hpp" //requires including and linking SE3 library
30 #include "mrob/factor.hpp"
31 
32 namespace mrob{
33 
73 class Factor2Poses3d : public Factor
74 {
75  public:
76  Factor2Poses3d(const Mat4 &observation, std::shared_ptr<Node> &nodeOrigin,
77  std::shared_ptr<Node> &nodeTarget, const Mat6 &obsInf, bool updateNodeTarget=false,
78  Factor::robustFactorType robust_type = Factor::robustFactorType::QUADRATIC);
79  Factor2Poses3d(const SE3 &observation, std::shared_ptr<Node> &nodeOrigin,
80  std::shared_ptr<Node> &nodeTarget, const Mat6 &obsInf, bool updateNodeTarget=false,
81  Factor::robustFactorType robust_type = Factor::robustFactorType::QUADRATIC);
82  ~Factor2Poses3d() override = default;
86  void evaluate_residuals() override;
90  virtual void evaluate_jacobians() override;
91  virtual void evaluate_chi2() override;
92 
93  virtual void print() const;
94 
95  MatRefConst get_obs() const override {return Tobs_.T();}
96  VectRefConst get_residual() const override {return r_;}
97  MatRefConst get_information_matrix() const override {return W_;}
98  MatRefConst get_jacobian([[maybe_unused]]factor_id_t id = 0) const override {return J_;}
99 
100  protected:
101  // The Jacobians' correspondant nodes are ordered on the vector<Node>
102  // being [0]->J_origin and [1]->J_target
103  // declared here but initialized on child classes
104  SE3 Tobs_; // Transformation from observation. NOTE: In Xorigin frame
105  Mat61 r_; //and residuals
106  SE3 Tr_; // Residual Transformation
107  Mat6 W_;//inverse of observation covariance (information matrix)
108  Mat<6,12> J_;//Joint Jacobian
109 
110  public:
111  EIGEN_MAKE_ALIGNED_OPERATOR_NEW // as proposed by Eigen
112 
113 };
114 
115 
116 }
117 
118 
119 
120 
121 #endif /* FACTOR2POSES3D_HPP_ */
virtual void print() const
Definition: factor2Poses3d.cpp:111
const Eigen::Ref< const Mat4 > T() const
Definition: SE3.cpp:237
robustFactorType
Definition: factor.hpp:87
Definition: SE3.hpp:50
Definition: factor2Poses3d.hpp:73
void evaluate_residuals() override
Definition: factor2Poses3d.cpp:87
VectRefConst get_residual() const override
Definition: factor2Poses3d.hpp:96
MatRefConst get_obs() const override
Definition: factor2Poses3d.hpp:95
virtual void evaluate_jacobians() override
Definition: factor2Poses3d.cpp:100
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
virtual void evaluate_chi2() override
Definition: factor2Poses3d.cpp:107
Definition: factor.hpp:81