mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-11-25 00:30:50 +08:00
perf(vision_target_estimator): reduce diagnostic flash usage (#29401)
Co-authored-by: jonas <jonas.perolini@rigi.tech>
This commit is contained in:
1 parent
45683413a1
commit
1f664e1c93
6 files changed
+26
-84
No files matched your search
@@ -455,8 +455,20 @@ On the autopilot shell, the first command to run is
|
||||
vision_target_estimator status
|
||||
```
|
||||
|
||||
which reports whether the module is alive, which task is currently active, which filters are running, and which aid sources are enabled.
|
||||
It is the quickest way to confirm a configuration is taking effect before opening a log.
|
||||
The command provides a compact health summary:
|
||||
|
||||
- Target model, active task and hexadecimal task mask.
|
||||
- Configured and effective hexadecimal aid masks.
|
||||
Decode the masks using [VTE_TASK_MASK](../advanced_config/parameter_reference.md#VTE_TASK_MASK) and [VTE_AID_MASK](../advanced_config/parameter_reference.md#VTE_AID_MASK).
|
||||
- Position and yaw filter enablement, availability, running state, fusion enablement and timeout state.
|
||||
`enabled` reflects the current parameter value; `available` reflects enablement latched when the module started.
|
||||
Changes to [VTE_POS_EN](../advanced_config/parameter_reference.md#VTE_POS_EN) and [VTE_YAW_EN](../advanced_config/parameter_reference.md#VTE_YAW_EN) require a reboot.
|
||||
- For running filters: initialisation, validity and prediction/update ages in seconds (`-1` when no timestamp is available).
|
||||
The position filter also reports output validity, bias readiness, bias averaging and the pre-bias reference.
|
||||
|
||||
`fusing: yes` means fusion is enabled; check `vte_aid_*` for individual measurement acceptance or rejection.
|
||||
State values and individual input ages are not included in this summary.
|
||||
Use `listener vte_position` for position, velocity and bias, `listener vte_orientation` for yaw and yaw rate, and the input topics' timestamps to investigate input freshness.
|
||||
|
||||
For deeper inspection, the following uORB topics are the most useful entry points into a log:
|
||||
|
||||
|
||||
@@ -1057,7 +1057,8 @@ A few tips to make iteration on real hardware and SITL easier.
|
||||
On hardware builds, compile with the debug configuration or enable the console log level before running tests so the additional diagnostics appear on the shell.
|
||||
- Keep the estimator alive on the bench by setting [VTE_TASK_MASK](../advanced_config/parameter_reference.md#VTE_TASK_MASK)=3.
|
||||
The debug bit enables the continuous update of the position and orientation estimators (if enabled via [VTE_YAW_EN](../advanced_config/parameter_reference.md#VTE_YAW_EN) and [VTE_POS_EN](../advanced_config/parameter_reference.md#VTE_POS_EN)).
|
||||
- Use shell helpers while iterating: `listener landing_target_pose`, `listener vte_bias_init_status`, `listener vte_aid_fiducial_marker` (or the relevant `vte_aid_*`) to inspect bias averaging and innovations, `listener vte_input 5` for prediction inputs, and `vision_target_estimator status` to ensure both filters are running.
|
||||
- Use `vision_target_estimator status` for the compact [health summary](../advanced_features/vision_target_estimator.md#monitoring).
|
||||
Inspect state values with `listener vte_position` and `listener vte_orientation`, published output with `listener landing_target_pose`, bias averaging with `listener vte_bias_init_status`, innovations with `listener vte_aid_fiducial_marker` (or the relevant `vte_aid_*`), and prediction inputs with `listener vte_input 5`.
|
||||
|
||||
<a id="sitl-simulation-pipeline"></a>
|
||||
|
||||
|
||||
@@ -309,20 +309,8 @@ void VTEOrientation::print_status() const
|
||||
|
||||
const bool orientation_valid = _estimator_initialized && !hasTimedOut(_last_update, _target_valid_timeout_us);
|
||||
|
||||
PX4_INFO(" orientation state: initialized: %s, valid: %s, last predict/update age: %.3f / %.3f s",
|
||||
PX4_INFO(" initialized: %s, valid: %s, predict/update age: %.3f / %.3f s",
|
||||
yes_no(_estimator_initialized), yes_no(orientation_valid), age_s(_last_predict), age_s(_last_update));
|
||||
|
||||
if (!_estimator_initialized) {
|
||||
return;
|
||||
}
|
||||
|
||||
const OrientationStateVec &state = _target_est_yaw.getState();
|
||||
|
||||
PX4_INFO(" yaw: %.3f rad (%.1f deg)",
|
||||
(double)state(KF_orientation::kYaw),
|
||||
(double)math::degrees(state(KF_orientation::kYaw)));
|
||||
PX4_INFO(" yaw rate: %.3f rad/s",
|
||||
(double)state(KF_orientation::kYawRate));
|
||||
}
|
||||
|
||||
void VTEOrientation::updateParams()
|
||||
|
||||
@@ -1339,59 +1339,17 @@ void VTEPosition::print_status() const
|
||||
|
||||
const bool relative_position_valid = _estimator_initialized && !hasTimedOut(_last_update, _target_valid_timeout_us);
|
||||
|
||||
PX4_INFO(" position state: initialized: %s, valid: %s, last predict/update age: %.3f / %.3f s",
|
||||
PX4_INFO(" initialized: %s, valid: %s, predict/update age: %.3f / %.3f s",
|
||||
yes_no(_estimator_initialized), yes_no(relative_position_valid), age_s(_last_predict), age_s(_last_update));
|
||||
PX4_INFO(" rel pos/vel/ekf2 vel valid: %s / %s / %s",
|
||||
PX4_INFO(" output valid: position: %s, velocity: %s, EKF2 velocity: %s",
|
||||
yes_no(_target_pose.rel_pos_valid),
|
||||
yes_no(_target_pose.rel_vel_valid),
|
||||
yes_no(_target_pose.rel_vel_ekf2_valid));
|
||||
|
||||
if (_estimator_initialized) {
|
||||
const EstimatorState &state_x = _target_est_pos[vtest::Axis::x].getState();
|
||||
const EstimatorState &state_y = _target_est_pos[vtest::Axis::y].getState();
|
||||
const EstimatorState &state_z = _target_est_pos[vtest::Axis::z].getState();
|
||||
|
||||
PX4_INFO(" rel pos: [%.3f, %.3f, %.3f]",
|
||||
(double)state_x(vtest::State::pos_rel),
|
||||
(double)state_y(vtest::State::pos_rel),
|
||||
(double)state_z(vtest::State::pos_rel));
|
||||
PX4_INFO(" gnss bias: [%.3f, %.3f, %.3f]",
|
||||
(double)state_x(vtest::State::bias),
|
||||
(double)state_y(vtest::State::bias),
|
||||
(double)state_z(vtest::State::bias));
|
||||
|
||||
#if defined(CONFIG_VTEST_MOVING)
|
||||
PX4_INFO(" target vel: [%.3f, %.3f, %.3f]",
|
||||
(double)state_x(vtest::State::vel_target),
|
||||
(double)state_y(vtest::State::vel_target),
|
||||
(double)state_z(vtest::State::vel_target));
|
||||
PX4_INFO(" target acc: [%.3f, %.3f, %.3f]",
|
||||
(double)state_x(vtest::State::acc_target),
|
||||
(double)state_y(vtest::State::acc_target),
|
||||
(double)state_z(vtest::State::acc_target));
|
||||
#endif // CONFIG_VTEST_MOVING
|
||||
}
|
||||
|
||||
PX4_INFO(" bias set: %s, averaging: %s, pre-bias reference: %s",
|
||||
PX4_INFO(" bias set: %s, averaging: %s, pre-bias reference: %s",
|
||||
yes_no(_bias.set),
|
||||
yes_no(_bias.averaging_active),
|
||||
pre_bias_reference_name());
|
||||
PX4_INFO(" position inputs: local pos: %s age %.3f s, local vel: %s age %.3f s",
|
||||
yes_no(_local_position.valid), age_s(_local_position.timestamp),
|
||||
yes_no(_local_velocity.valid), age_s(_local_velocity.timestamp));
|
||||
PX4_INFO(" uav gps pos: %s age %.3f s, uav gps vel: %s age %.3f s, pad reference pos: %s",
|
||||
yes_no(_uav_gps_position.valid), age_s(_uav_gps_position.timestamp),
|
||||
yes_no(_uav_gps_vel.valid), age_s(_uav_gps_vel.timestamp),
|
||||
yes_no(_mission_land_position.valid));
|
||||
PX4_INFO(" gnss rel pos: %s age %.3f s, gps pos offset: %s age %.3f s, vel offset: %s age %.3f s",
|
||||
yes_no(_pos_rel_gnss.valid), age_s(_pos_rel_gnss.timestamp),
|
||||
yes_no(_gps_pos_is_offset && _gps_pos_offset_ned.valid), age_s(_gps_pos_offset_ned.timestamp),
|
||||
yes_no(_velocity_offset_ned.valid), age_s(_velocity_offset_ned.timestamp));
|
||||
|
||||
#if defined(CONFIG_VTEST_MOVING)
|
||||
PX4_INFO(" target gps vel: %s age %.3f s",
|
||||
yes_no(_target_gps_vel.valid), age_s(_target_gps_vel.timestamp));
|
||||
#endif // CONFIG_VTEST_MOVING
|
||||
}
|
||||
|
||||
void VTEPosition::checkMeasurementInputs()
|
||||
|
||||
@@ -732,35 +732,18 @@ bool VisionTargetEst::updateWhenIntervalElapsed(hrt_abstime &last_time, const hr
|
||||
int VisionTargetEst::print_status()
|
||||
{
|
||||
const auto yes_no = [](const bool value) { return value ? "yes" : "no"; };
|
||||
SensorFusionMaskU configured_aid_mask{};
|
||||
configured_aid_mask.value = static_cast<uint16_t>(_param_vte_aid_mask.get());
|
||||
|
||||
PX4_INFO("VTE running");
|
||||
#if defined(CONFIG_VTEST_MOVING)
|
||||
PX4_INFO("target model: moving");
|
||||
PX4_WARN("Caution: VTE for moving targets is a beta feature");
|
||||
PX4_INFO("target model: moving (beta)");
|
||||
#else
|
||||
PX4_INFO("target model: static");
|
||||
#endif // CONFIG_VTEST_MOVING
|
||||
PX4_INFO("work queue: %s", px4::wq_configurations::vte.name);
|
||||
PX4_INFO("current task: %s", _current_task_ptr ? _current_task_ptr->name() : "none");
|
||||
PX4_INFO("task mask: 0x%02x (prec_land: %s, prec_takeoff: %s, debug: %s)",
|
||||
static_cast<unsigned>(_vte_task_mask),
|
||||
yes_no(isTaskMaskBitEnabled(task_bits::kPrecLand)),
|
||||
yes_no(isTaskMaskBitEnabled(task_bits::kPrecTakeoff)),
|
||||
yes_no(isTaskMaskBitEnabled(task_bits::kDebug)));
|
||||
PX4_INFO("task: %s, mask: 0x%02x", _current_task_ptr ? _current_task_ptr->name() : "none",
|
||||
static_cast<unsigned>(_vte_task_mask));
|
||||
PX4_INFO("aid mask: configured 0x%04x, effective 0x%04x",
|
||||
static_cast<unsigned>(_param_vte_aid_mask.get()), static_cast<unsigned>(_vte_aid_mask.value));
|
||||
PX4_INFO(" vision pos: %s, target gps pos: %s, mission land pos: %s, home pos: %s",
|
||||
yes_no(configured_aid_mask.flags.use_vision_pos),
|
||||
yes_no(configured_aid_mask.flags.use_target_gps_pos),
|
||||
yes_no(configured_aid_mask.flags.use_mission_pos),
|
||||
yes_no(configured_aid_mask.flags.use_home_pos));
|
||||
PX4_INFO(" uav gps vel: %s, target gps vel: %s",
|
||||
yes_no(configured_aid_mask.flags.use_uav_gps_vel),
|
||||
yes_no(configured_aid_mask.flags.use_target_gps_vel));
|
||||
|
||||
PX4_INFO("position vte: enabled: %s, available: %s, running: %s, fusing: %s, timed out: %s",
|
||||
PX4_INFO("%s: enabled: %s, available: %s, running: %s, fusing: %s, timed out: %s", "position",
|
||||
yes_no(_param_vte_pos_en.get()),
|
||||
yes_no(_vte_position_enabled),
|
||||
yes_no(_position_estimator_running),
|
||||
@@ -771,7 +754,7 @@ int VisionTargetEst::print_status()
|
||||
_vte_position.print_status();
|
||||
}
|
||||
|
||||
PX4_INFO("orientation vte: enabled: %s, available: %s, running: %s, fusing: %s, timed out: %s",
|
||||
PX4_INFO("%s: enabled: %s, available: %s, running: %s, fusing: %s, timed out: %s", "yaw",
|
||||
yes_no(_param_vte_yaw_en.get()),
|
||||
yes_no(_vte_orientation_enabled),
|
||||
yes_no(_orientation_estimator_running),
|
||||
|
||||
@@ -182,7 +182,7 @@ static inline bool alignFutureSampleTime(hrt_abstime &ts, const hrt_abstime now)
|
||||
}
|
||||
|
||||
// Rate limit a warning to one per kWarnThrottleIntervalUs.
|
||||
static inline bool shouldEmitWarning(hrt_abstime &last_warn)
|
||||
inline bool shouldEmitWarning(hrt_abstime &last_warn)
|
||||
{
|
||||
const hrt_abstime now = nowUs();
|
||||
|
||||
|
||||
Reference in new issue
Block a user