Skip to content

Commit

Permalink
ekf2-pos bias estimator: use enum
Browse files Browse the repository at this point in the history
  • Loading branch information
bresch committed Dec 5, 2023
1 parent ddd0850 commit 8a955fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/modules/ekf2/EKF/ekf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1140,11 +1140,11 @@ class Ekf final : public EstimatorInterface
void resetQuatStateYaw(float yaw, float yaw_variance);

HeightSensor _height_sensor_ref{HeightSensor::UNKNOWN};
uint8_t _position_sensor_ref{static_cast<uint8_t>(PositionSensor::GNSS)};
PositionSensor _position_sensor_ref{PositionSensor::GNSS};

#if defined(CONFIG_EKF2_EXTERNAL_VISION)
HeightBiasEstimator _ev_hgt_b_est{HeightSensor::EV, _height_sensor_ref};
PositionBiasEstimator _ev_pos_b_est{static_cast<uint8_t>(PositionSensor::EV), _position_sensor_ref};
PositionBiasEstimator _ev_pos_b_est{PositionSensor::EV, _position_sensor_ref};
AlphaFilter<Quatf> _ev_q_error_filt{0.001f};
bool _ev_q_error_initialized{false};
#endif // CONFIG_EKF2_EXTERNAL_VISION
Expand Down
7 changes: 4 additions & 3 deletions src/modules/ekf2/EKF/position_bias_estimator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@
#define EKF_POSITION_BIAS_ESTIMATOR_HPP

#include "bias_estimator.hpp"
#include "common.h"

class PositionBiasEstimator
{
public:
PositionBiasEstimator(uint8_t sensor, const uint8_t &sensor_ref):
PositionBiasEstimator(PositionSensor sensor, const PositionSensor &sensor_ref):
_sensor(sensor),
_sensor_ref(sensor_ref)
{}
Expand Down Expand Up @@ -107,8 +108,8 @@ class PositionBiasEstimator
private:
BiasEstimator _bias[2] {};

const uint8_t _sensor;
const uint8_t &_sensor_ref;
const PositionSensor _sensor;
const PositionSensor &_sensor_ref;

bool _is_sensor_fusion_active{false}; // TODO: replace by const ref and remove setter when migrating _control_status.flags from union to bool
};
Expand Down

0 comments on commit 8a955fc

Please sign in to comment.