mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 20:23:34 +08:00
ekf2: scope RngCtrl enum
This commit is contained in:
@@ -141,7 +141,7 @@ enum class GnssCtrl : uint8_t {
|
||||
YAW = (1<<3)
|
||||
};
|
||||
|
||||
enum RngCtrl : uint8_t {
|
||||
enum class RngCtrl : uint8_t {
|
||||
DISABLED = 0,
|
||||
CONDITIONAL = 1,
|
||||
ENABLED = 2
|
||||
@@ -418,7 +418,7 @@ struct parameters {
|
||||
|
||||
#if defined(CONFIG_EKF2_RANGE_FINDER)
|
||||
// range finder fusion
|
||||
int32_t rng_ctrl{RngCtrl::CONDITIONAL};
|
||||
int32_t rng_ctrl{static_cast<int32_t>(RngCtrl::CONDITIONAL)};
|
||||
|
||||
float range_delay_ms{5.0f}; ///< range finder measurement delay relative to the IMU (mSec)
|
||||
float range_noise{0.1f}; ///< observation noise for range finder measurements (m)
|
||||
|
||||
@@ -586,7 +586,7 @@ bool EstimatorInterface::initialise_interface(uint64_t timestamp)
|
||||
|
||||
#if defined(CONFIG_EKF2_RANGE_FINDER)
|
||||
// using range finder
|
||||
if ((_params.rng_ctrl != RngCtrl::DISABLED)) {
|
||||
if ((_params.rng_ctrl != static_cast<int32_t>(RngCtrl::DISABLED))) {
|
||||
max_time_delay_ms = math::max(_params.range_delay_ms, max_time_delay_ms);
|
||||
}
|
||||
#endif // CONFIG_EKF2_RANGE_FINDER
|
||||
|
||||
@@ -121,8 +121,8 @@ void Ekf::controlRangeHeightFusion()
|
||||
}
|
||||
|
||||
// determine if we should use height aiding
|
||||
const bool do_conditional_range_aid = (_params.rng_ctrl == RngCtrl::CONDITIONAL) && isConditionalRangeAidSuitable();
|
||||
const bool continuing_conditions_passing = ((_params.rng_ctrl == RngCtrl::ENABLED) || do_conditional_range_aid)
|
||||
const bool do_conditional_range_aid = (_params.rng_ctrl == static_cast<int32_t>(RngCtrl::CONDITIONAL)) && isConditionalRangeAidSuitable();
|
||||
const bool continuing_conditions_passing = ((_params.rng_ctrl == static_cast<int32_t>(RngCtrl::ENABLED)) || do_conditional_range_aid)
|
||||
&& measurement_valid
|
||||
&& _range_sensor.isDataHealthy();
|
||||
|
||||
@@ -165,13 +165,13 @@ void Ekf::controlRangeHeightFusion()
|
||||
|
||||
} else {
|
||||
if (starting_conditions_passing) {
|
||||
if ((_params.height_sensor_ref == HeightSensor::RANGE) && (_params.rng_ctrl == RngCtrl::CONDITIONAL)) {
|
||||
if ((_params.height_sensor_ref == static_cast<int32_t>(HeightSensor::RANGE)) && (_params.rng_ctrl == static_cast<int32_t>(RngCtrl::CONDITIONAL))) {
|
||||
// Range finder is used while hovering to stabilize the height estimate. Don't reset but use it as height reference.
|
||||
ECL_INFO("starting conditional %s height fusion", HGT_SRC_NAME);
|
||||
_height_sensor_ref = HeightSensor::RANGE;
|
||||
bias_est.setBias(_state.pos(2) + measurement);
|
||||
|
||||
} else if ((_params.height_sensor_ref == HeightSensor::RANGE) && (_params.rng_ctrl != RngCtrl::CONDITIONAL)) {
|
||||
} else if ((_params.height_sensor_ref == static_cast<int32_t>(HeightSensor::RANGE)) && (_params.rng_ctrl != static_cast<int32_t>(RngCtrl::CONDITIONAL))) {
|
||||
// Range finder is the primary height source, the ground is now the datum used
|
||||
// to compute the local vertical position
|
||||
ECL_INFO("starting %s height fusion, resetting height", HGT_SRC_NAME);
|
||||
|
||||
@@ -57,12 +57,12 @@ void EkfWrapper::setRangeHeightRef()
|
||||
|
||||
void EkfWrapper::enableRangeHeightFusion()
|
||||
{
|
||||
_ekf_params->rng_ctrl = RngCtrl::ENABLED;
|
||||
_ekf_params->rng_ctrl = static_cast<int32_t>(RngCtrl::ENABLED);
|
||||
}
|
||||
|
||||
void EkfWrapper::disableRangeHeightFusion()
|
||||
{
|
||||
_ekf_params->rng_ctrl = RngCtrl::DISABLED;
|
||||
_ekf_params->rng_ctrl = static_cast<int32_t>(RngCtrl::DISABLED);
|
||||
}
|
||||
|
||||
bool EkfWrapper::isIntendingRangeHeightFusion() const
|
||||
|
||||
Reference in New Issue
Block a user