MROB
node.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  * node.hpp
17  *
18  * Created on: Feb 12, 2018
19  * Author: Gonzalo Ferrer
20  * g.ferrer@skoltech.ru
21  * Mobile Robotics Lab, Skoltech
22  */
23 
24 #ifndef NODE_HPP_
25 #define NODE_HPP_
26 
27 #include <vector>
28 #include <memory>
29 #include <cassert>
30 
31 #include "mrob/matrix_base.hpp"
32 #include "mrob/factor.hpp"
33 
34 namespace mrob{
35 
36 
61 class Node{
62  public:
63  enum nodeMode{STANDARD = 0, ANCHOR, SCHUR_MARGI};
64 
65  Node(uint_t dim, nodeMode mode = STANDARD);
66  virtual ~Node();
76  virtual void update(VectRefConst &dx) = 0;
80  virtual void update_from_auxiliary(VectRefConst &dx) = 0;
85  virtual void set_state(MatRefConst &x) = 0;
89  virtual void set_auxiliary_state(MatRefConst &x) = 0;
96  virtual const MatRefConst get_state() const = 0;
101  virtual MatRefConst get_auxiliary_state() const = 0;
102  virtual void print() const {}
103  factor_id_t get_id() const {return id_;}
104  void set_id(factor_id_t id) {id_ = id;}
105  factor_id_t get_dim(void) const {return dim_;}
106 
113  bool is_connected_to_EF() const {return isConnected2EF_;}
114  void set_connected_to_EF(bool state = true) {isConnected2EF_ = state;}
115 
116 
117  void set_node_mode(nodeMode mode){node_mode_ = mode;}
118  nodeMode get_node_mode(){return node_mode_;}
119 
120 
121  protected:
122  factor_id_t id_;
123  uint_t dim_;
124  nodeMode node_mode_;
135  // This variable is to know if there is an Eigen Factor connected to this node. The alternative
136  // is a list of factors connected, but removed this option since it was not really necessary.
138 };
139 
143 double wrap_angle(double angle);
144 
145 
146 }
147 
148 
149 
150 #endif /* NODE_HPP_ */
virtual void set_state(MatRefConst &x)=0
virtual void update(VectRefConst &dx)=0
bool isConnected2EF_
Definition: node.hpp:137
double wrap_angle(double angle)
Definition: node.cpp:39
virtual MatRefConst get_auxiliary_state() const =0
bool is_connected_to_EF() const
Definition: node.hpp:113
virtual const MatRefConst get_state() const =0
Definition: node.hpp:61
virtual void update_from_auxiliary(VectRefConst &dx)=0
virtual void set_auxiliary_state(MatRefConst &x)=0
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