mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-23 14:07:34 +08:00
FixedWingModeManager: make sure configuration handler publishes after an
external mode has been running. Also don't publish if we are not controlling anything, e.g. in rotary wing mode Signed-off-by: RomanBapst <bapstroman@gmail.com>
This commit is contained in:
@@ -132,3 +132,8 @@ void CombinedControllerConfigurationHandler::setEnforceLowHeightCondition(bool l
|
||||
{
|
||||
_longitudinal_configuration_current_cycle.enforce_low_height_condition = low_height_condition;
|
||||
}
|
||||
|
||||
void CombinedControllerConfigurationHandler::resetLastPublishTime()
|
||||
{
|
||||
_time_last_longitudinal_publish = _time_last_lateral_publish = 0;
|
||||
}
|
||||
|
||||
@@ -75,6 +75,8 @@ public:
|
||||
|
||||
void setLateralAccelMax(float lateral_accel_max);
|
||||
|
||||
void resetLastPublishTime();
|
||||
|
||||
private:
|
||||
bool booleanValueChanged(bool new_value, bool current_value)
|
||||
{
|
||||
|
||||
@@ -1840,8 +1840,15 @@ FixedWingModeManager::Run()
|
||||
|
||||
/* only run controller if position changed and we are not running an external mode*/
|
||||
|
||||
if (!((_nav_state >= vehicle_status_s::NAVIGATION_STATE_EXTERNAL1)
|
||||
&& (_nav_state <= vehicle_status_s::NAVIGATION_STATE_EXTERNAL8)) && _local_pos_sub.update(&_local_pos)) {
|
||||
const bool is_external_nav_state = (_nav_state >= vehicle_status_s::NAVIGATION_STATE_EXTERNAL1)
|
||||
&& (_nav_state <= vehicle_status_s::NAVIGATION_STATE_EXTERNAL8);
|
||||
|
||||
if (is_external_nav_state) {
|
||||
// this will cause the configuration handler to publish immediately the next time an internal flight
|
||||
// mode is active
|
||||
_ctrl_configuration_handler.resetLastPublishTime();
|
||||
|
||||
} else if (_local_pos_sub.update(&_local_pos)) {
|
||||
|
||||
const hrt_abstime now = _local_pos.timestamp;
|
||||
|
||||
@@ -2095,7 +2102,9 @@ FixedWingModeManager::Run()
|
||||
}
|
||||
}
|
||||
|
||||
_ctrl_configuration_handler.update(now);
|
||||
if (_control_mode_current != FW_POSCTRL_MODE_OTHER) {
|
||||
_ctrl_configuration_handler.update(now);
|
||||
}
|
||||
|
||||
// only publish status in full FW mode
|
||||
if (_vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_FIXED_WING
|
||||
|
||||
Reference in New Issue
Block a user