AC_PrecLand: use enum-class for EstimatorType
And remove accessor for same
This commit is contained in:
parent
d9144ab47c
commit
1ad9542df3
@ -279,8 +279,8 @@ void AC_PrecLand::run_estimator(float rangefinder_alt_m, bool rangefinder_alt_va
|
||||
{
|
||||
const struct inertial_data_frame_s *inertial_data_delayed = (*_inertial_history)[0];
|
||||
|
||||
switch (_estimator_type) {
|
||||
case ESTIMATOR_TYPE_RAW_SENSOR: {
|
||||
switch ((EstimatorType)_estimator_type.get()) {
|
||||
case EstimatorType::RAW_SENSOR: {
|
||||
// Return if there's any invalid velocity data
|
||||
for (uint8_t i=0; i<_inertial_history->available(); i++) {
|
||||
const struct inertial_data_frame_s *inertial_data = (*_inertial_history)[i];
|
||||
@ -315,7 +315,7 @@ void AC_PrecLand::run_estimator(float rangefinder_alt_m, bool rangefinder_alt_va
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ESTIMATOR_TYPE_KALMAN_FILTER: {
|
||||
case EstimatorType::KALMAN_FILTER: {
|
||||
// Predict
|
||||
if (target_acquired()) {
|
||||
const float& dt = inertial_data_delayed->dt;
|
||||
@ -490,7 +490,7 @@ void AC_PrecLand::Write_Precland()
|
||||
meas_z : target_pos_meas.z,
|
||||
last_meas : last_backend_los_meas_ms(),
|
||||
ekf_outcount : ekf_outlier_count(),
|
||||
estimator : estimator_type()
|
||||
estimator : (uint8_t)_estimator_type
|
||||
};
|
||||
AP::logger().WriteBlock(&pkt, sizeof(pkt));
|
||||
}
|
||||
|
@ -61,9 +61,6 @@ public:
|
||||
// returns time of last time target was seen
|
||||
uint32_t last_backend_los_meas_ms() const { return _last_backend_los_meas_ms; }
|
||||
|
||||
// returns estimator type
|
||||
uint8_t estimator_type() const { return _estimator_type; }
|
||||
|
||||
// returns ekf outlier count
|
||||
uint32_t ekf_outlier_count() const { return _outlier_reject_count; }
|
||||
|
||||
@ -92,9 +89,9 @@ public:
|
||||
static const struct AP_Param::GroupInfo var_info[];
|
||||
|
||||
private:
|
||||
enum estimator_type_t {
|
||||
ESTIMATOR_TYPE_RAW_SENSOR = 0,
|
||||
ESTIMATOR_TYPE_KALMAN_FILTER = 1
|
||||
enum class EstimatorType : uint8_t {
|
||||
RAW_SENSOR = 0,
|
||||
KALMAN_FILTER = 1,
|
||||
};
|
||||
|
||||
// returns enabled parameter as an behaviour
|
||||
@ -117,7 +114,7 @@ private:
|
||||
AP_Int8 _enabled; // enabled/disabled and behaviour
|
||||
AP_Int8 _type; // precision landing sensor type
|
||||
AP_Int8 _bus; // which sensor bus
|
||||
AP_Int8 _estimator_type; // precision landing estimator type
|
||||
AP_Enum<EstimatorType> _estimator_type; // precision landing estimator type
|
||||
AP_Float _lag; // sensor lag in seconds
|
||||
AP_Float _yaw_align; // Yaw angle from body x-axis to sensor x-axis.
|
||||
AP_Float _land_ofs_cm_x; // Desired landing position of the camera forward of the target in vehicle body frame
|
||||
|
Loading…
Reference in New Issue
Block a user