mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-23 07:33:33 +08:00
Navigator: delay neutral gimbal command (#25551)
* Set gimbal neutral after delay
This commit is contained in:
@@ -904,6 +904,8 @@ void Navigator::run()
|
||||
publish_mission_result();
|
||||
}
|
||||
|
||||
neutralize_gimbal_if_control_activated();
|
||||
|
||||
publish_navigator_status();
|
||||
|
||||
publish_distance_sensor_mode_request();
|
||||
@@ -1629,6 +1631,27 @@ void Navigator::set_gimbal_neutral()
|
||||
publish_vehicle_command(vehicle_command);
|
||||
}
|
||||
|
||||
void Navigator::activate_set_gimbal_neutral_timer(const hrt_abstime timestamp)
|
||||
{
|
||||
if (_gimbal_neutral_activation_time == UINT64_MAX) {
|
||||
_gimbal_neutral_activation_time = timestamp;
|
||||
}
|
||||
}
|
||||
|
||||
void Navigator::neutralize_gimbal_if_control_activated()
|
||||
{
|
||||
const hrt_abstime now{hrt_absolute_time()};
|
||||
|
||||
// The time delay must be sufficiently long to allow flight tasks to complete its
|
||||
// destruction and release gimbal control before the navigator takes control of the gimbal.
|
||||
if (_gimbal_neutral_activation_time != UINT64_MAX && now > _gimbal_neutral_activation_time + 250_ms) {
|
||||
acquire_gimbal_control();
|
||||
set_gimbal_neutral();
|
||||
release_gimbal_control();
|
||||
_gimbal_neutral_activation_time = UINT64_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
void Navigator::sendWarningDescentStoppedDueToTerrain()
|
||||
{
|
||||
mavlink_log_critical(&_mavlink_log_pub, "Terrain collision risk, descent is stopped\t");
|
||||
|
||||
Reference in New Issue
Block a user