mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-14 22:53:33 +08:00
Suggestions for boat and rover handling
This commit is contained in:
committed by
Tomas Twardzik
parent
f419124e28
commit
e907fb0aa2
@@ -572,12 +572,10 @@ transition_result_t Commander::arm(arm_disarm_reason_t calling_reason, bool run_
|
||||
return TRANSITION_DENIED;
|
||||
}
|
||||
|
||||
if ((!_failsafe_flags.manual_control_signal_lost) &&
|
||||
((!_vehicle_control_mode.flag_control_climb_rate_enabled &&
|
||||
!_is_throttle_low) ||
|
||||
((_vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROVER ||
|
||||
_vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_BOAT) &&
|
||||
!_is_throttle_near_center))) {
|
||||
if (!_vehicle_control_mode.flag_control_climb_rate_enabled &&
|
||||
!_failsafe_flags.manual_control_signal_lost && !_is_throttle_low
|
||||
&& _vehicle_status.vehicle_type != vehicle_status_s::VEHICLE_TYPE_ROVER
|
||||
&& _vehicle_status.vehicle_type != vehicle_status_s::VEHICLE_TYPE_BOAT) {
|
||||
|
||||
mavlink_log_critical(&_mavlink_log_pub, "Arming denied: high throttle\t");
|
||||
events::send(events::ID("commander_arm_denied_throttle_high"), {events::Log::Critical, events::LogInternal::Info},
|
||||
@@ -586,6 +584,17 @@ transition_result_t Commander::arm(arm_disarm_reason_t calling_reason, bool run_
|
||||
return TRANSITION_DENIED;
|
||||
}
|
||||
|
||||
if ((_vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROVER
|
||||
|| _vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_BOAT)
|
||||
&& !_failsafe_flags.manual_control_signal_lost && !_is_throttle_near_center) {
|
||||
|
||||
mavlink_log_critical(&_mavlink_log_pub, "Arming denied: throttle not centered\t");
|
||||
events::send(events::ID("commander_arm_denied_throttle_not_centered"), {events::Log::Critical, events::LogInternal::Info},
|
||||
"Arming denied: throttle not centered");
|
||||
tune_negative(true);
|
||||
return TRANSITION_DENIED;
|
||||
}
|
||||
|
||||
} else if (calling_reason == arm_disarm_reason_t::stick_gesture
|
||||
|| calling_reason == arm_disarm_reason_t::rc_switch
|
||||
|| calling_reason == arm_disarm_reason_t::rc_button) {
|
||||
@@ -1728,8 +1737,6 @@ void Commander::updateParameters()
|
||||
&& _vtol_vehicle_status.vehicle_vtol_state != vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW);
|
||||
const bool is_fixed = is_fixed_wing(_vehicle_status) || (is_vtol(_vehicle_status)
|
||||
&& _vtol_vehicle_status.vehicle_vtol_state == vtol_vehicle_status_s::VEHICLE_VTOL_STATE_FW);
|
||||
const bool is_rover = is_rover_type(_vehicle_status);
|
||||
const bool is_boat = is_boat_type(_vehicle_status);
|
||||
|
||||
/* disable manual override for all systems that rely on electronic stabilization */
|
||||
if (is_rotary) {
|
||||
@@ -1738,14 +1745,13 @@ void Commander::updateParameters()
|
||||
} else if (is_fixed) {
|
||||
_vehicle_status.vehicle_type = vehicle_status_s::VEHICLE_TYPE_FIXED_WING;
|
||||
|
||||
} else if (is_rover) {
|
||||
} else if (is_rover_type(_vehicle_status)) {
|
||||
_vehicle_status.vehicle_type = vehicle_status_s::VEHICLE_TYPE_ROVER;
|
||||
|
||||
} else if (is_boat) {
|
||||
} else if (is_boat_type(_vehicle_status)) {
|
||||
_vehicle_status.vehicle_type = vehicle_status_s::VEHICLE_TYPE_BOAT;
|
||||
}
|
||||
|
||||
|
||||
_vehicle_status.is_vtol = is_vtol(_vehicle_status);
|
||||
_vehicle_status.is_vtol_tailsitter = is_vtol_tailsitter(_vehicle_status);
|
||||
|
||||
@@ -2943,8 +2949,8 @@ void Commander::manualControlCheck()
|
||||
// but only if actually in air.
|
||||
if (manual_control_setpoint.sticks_moving
|
||||
&& !_vehicle_control_mode.flag_control_manual_enabled
|
||||
&& (_vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING ||
|
||||
_vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_BOAT)
|
||||
&& (_vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROTARY_WING
|
||||
|| _vehicle_status.vehicle_type == vehicle_status_s::VEHICLE_TYPE_BOAT)
|
||||
) {
|
||||
bool override_enabled = false;
|
||||
|
||||
|
||||
@@ -207,8 +207,8 @@ MissionBlock::is_mission_item_reached_or_completed()
|
||||
}
|
||||
|
||||
} else if (_mission_item.nav_cmd == NAV_CMD_TAKEOFF &&
|
||||
(_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROVER ||
|
||||
_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_BOAT)) {
|
||||
(_navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROVER
|
||||
|| _navigator->get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_BOAT)) {
|
||||
// Accept takeoff waypoint to be reached if the distance in 2D plane is within acceptance radius
|
||||
if (dist_xy >= 0.0f && dist_xy <= _navigator->get_acceptance_radius()) {
|
||||
_waypoint_position_reached = true;
|
||||
|
||||
@@ -1137,10 +1137,8 @@ float Navigator::get_altitude_acceptance_radius()
|
||||
return _param_nav_fw_alt_rad.get();
|
||||
}
|
||||
|
||||
} else if (get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROVER) {
|
||||
return INFINITY;
|
||||
|
||||
} else if (get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_BOAT) {
|
||||
} else if (get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_ROVER
|
||||
|| get_vstatus()->vehicle_type == vehicle_status_s::VEHICLE_TYPE_BOAT) {
|
||||
return INFINITY;
|
||||
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user