ekf_cal  0.4.0
A Kalman filter-based sensor calibration package
gps_updater.hpp
1 // Copyright 2024 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__GPS_UPDATER_HPP_
17 #define EKF__UPDATE__GPS_UPDATER_HPP_
18 
19 #include <memory>
20 #include <string>
21 #include <vector>
22 
23 #include "ekf/ekf.hpp"
24 #include "ekf/types.hpp"
25 #include "ekf/update/updater.hpp"
26 #include "infrastructure/data_logger.hpp"
27 
32 class GpsUpdater : public Updater
33 {
34 public:
43  GpsUpdater(
44  unsigned int gps_id,
45  bool is_extrinsic,
46  const std::string & log_file_directory,
47  double data_log_rate,
48  std::shared_ptr<DebugLogger> logger
49  );
50 
56  Eigen::MatrixXd GetMeasurementJacobian(EKF & ekf);
57 
63  Eigen::Vector3d PredictMeasurement(EKF & ekf);
64 
72  void UpdateEKF(
73  EKF & ekf,
74  const double time,
75  const Eigen::Vector3d & gps_lla,
76  const Eigen::MatrixXd & pos_covariance);
77 
82  void MultiUpdateEKF(EKF & ekf);
83 
84 private:
85  bool m_is_extrinsic {false};
86  DataLogger m_data_logger;
87  bool m_is_first_estimate{true};
88  Eigen::Vector3d m_pos_a_in_b{0.0, 0.0, 0.0};
89 };
90 
91 #endif // EKF__UPDATE__GPS_UPDATER_HPP_
DataLogger class.
Definition: data_logger.hpp:26
Calibration EKF class.
Definition: ekf.hpp:39
EKF Updater Class for GPS Sensors.
Definition: gps_updater.hpp:33
GpsUpdater(unsigned int gps_id, bool is_extrinsic, const std::string &log_file_directory, double data_log_rate, std::shared_ptr< DebugLogger > logger)
GPS EKF Updater Constructor.
Definition: gps_updater.cpp:34
Eigen::Vector3d PredictMeasurement(EKF &ekf)
Predict GPS measurement.
Definition: gps_updater.cpp:80
void UpdateEKF(EKF &ekf, const double time, const Eigen::Vector3d &gps_lla, const Eigen::MatrixXd &pos_covariance)
EKF update method for GPS measurements.
Definition: gps_updater.cpp:90
Eigen::MatrixXd GetMeasurementJacobian(EKF &ekf)
Measurement Jacobian method.
Definition: gps_updater.cpp:59
void MultiUpdateEKF(EKF &ekf)
Update/marginalize EKF using GPS measurements used to initialize local frame.
Definition: gps_updater.cpp:150
Base class for EKF updater classes.
Definition: updater.hpp:29