ekf_cal  0.4.0
A Kalman filter-based sensor calibration package
fiducial_updater.hpp
1 // Copyright 2023 Jacob Hartzer
2 //
3 // This program is free software: you can redistribute it and/or modify
4 // it under the terms of the GNU General Public License as published by
5 // the Free Software Foundation, either version 3 of the License, or
6 // (at your option) any later version.
7 //
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
12 //
13 // You should have received a copy of the GNU General Public License
14 // along with this program. If not, see <https://www.gnu.org/licenses/>.
15 
16 #ifndef EKF__UPDATE__FIDUCIAL_UPDATER_HPP_
17 #define EKF__UPDATE__FIDUCIAL_UPDATER_HPP_
18 
19 #include <eigen3/Eigen/Eigen>
20 
21 #include <memory>
22 #include <string>
23 #include <vector>
24 
25 #include "ekf/types.hpp"
26 #include "ekf/update/updater.hpp"
27 #include "infrastructure/data_logger.hpp"
28 
33 class FiducialUpdater : public Updater
34 {
35 public:
46  explicit FiducialUpdater(
47  unsigned int fiducial_id,
48  unsigned int camera_id,
49  bool is_fid_extrinsic,
50  bool is_cam_extrinsic,
51  const std::string & log_file_directory,
52  double data_log_rate,
53  std::shared_ptr<DebugLogger> logger
54  );
55 
60  void RefreshStates(EKF & ekf);
61 
67  Eigen::MatrixXd GetMeasurementJacobian(EKF & ekf);
68 
74  Eigen::VectorXd PredictMeasurement(EKF & ekf);
75 
82  void UpdateEKF(
83  EKF & ekf,
84  const double time,
85  const BoardDetection & board_detection);
86 
87 private:
88  bool m_is_fid_extrinsic;
89  bool m_is_cam_extrinsic;
90  DataLogger m_fiducial_logger;
91  unsigned int m_camera_id;
92  bool m_is_first_estimate{true};
93  Eigen::Vector3d m_pos_f_in_l;
94  Eigen::Quaterniond m_ang_f_to_l;
95  Eigen::Vector3d m_pos_c_in_b;
96  Eigen::Quaterniond m_ang_c_to_b;
97 };
98 
99 #endif // EKF__UPDATE__FIDUCIAL_UPDATER_HPP_
DataLogger class.
Definition: data_logger.hpp:26
Calibration EKF class.
Definition: ekf.hpp:39
EKF Updater Class for Fiducial Camera Measurements.
Definition: fiducial_updater.hpp:34
void RefreshStates(EKF &ekf)
Refresh the EKF state indices.
Definition: fiducial_updater.cpp:73
void UpdateEKF(EKF &ekf, const double time, const BoardDetection &board_detection)
EKF updater function.
Definition: fiducial_updater.cpp:150
Eigen::VectorXd PredictMeasurement(EKF &ekf)
Predict Fiducial measurement.
Definition: fiducial_updater.cpp:129
Eigen::MatrixXd GetMeasurementJacobian(EKF &ekf)
Measurement Jacobian method.
Definition: fiducial_updater.cpp:84
FiducialUpdater(unsigned int fiducial_id, unsigned int camera_id, bool is_fid_extrinsic, bool is_cam_extrinsic, const std::string &log_file_directory, double data_log_rate, std::shared_ptr< DebugLogger > logger)
MSCKF EKF Updater constructor.
Definition: fiducial_updater.cpp:39
Base class for EKF updater classes.
Definition: updater.hpp:29
BoardDetection structure.
Definition: types.hpp:305