mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-19 14:23:57 -04:00
Copter: add option to disable BRAKE flight mode
This commit is contained in:
parent
a7fe242e31
commit
86b162e32f
@ -24,6 +24,7 @@
|
||||
//#define SPRAYER DISABLED // disable the crop sprayer feature (two ESC controlled pumps the speed of which depends upon the vehicle's horizontal velocity)
|
||||
//#define WINCH_ENABLED DISABLED // disable winch support
|
||||
//#define MODE_AUTO_ENABLED DISABLED // disable auto mode support
|
||||
//#define MODE_BRAKE_ENABLED DISABLED // disable brake mode support
|
||||
//#define MODE_DRIFT_ENABLED DISABLED // disable drift mode support
|
||||
//#define MODE_GUIDED_ENABLED DISABLED // disable guided mode support
|
||||
//#define MODE_LOITER_ENABLED DISABLED // disable loiter mode support
|
||||
|
@ -962,7 +962,9 @@ private:
|
||||
#if AUTOTUNE_ENABLED == ENABLED
|
||||
ModeAutoTune mode_autotune;
|
||||
#endif
|
||||
#if MODE_BRAKE_ENABLED == ENABLED
|
||||
ModeBrake mode_brake;
|
||||
#endif
|
||||
ModeCircle mode_circle;
|
||||
#if MODE_DRIFT_ENABLED == ENABLED
|
||||
ModeDrift mode_drift;
|
||||
|
@ -1303,11 +1303,15 @@ void GCS_MAVLINK_Copter::handleMessage(mavlink_message_t* msg)
|
||||
bool shot_mode = (!is_zero(packet.param1) && (copter.control_mode == GUIDED || copter.control_mode == GUIDED_NOGPS));
|
||||
|
||||
if (!shot_mode) {
|
||||
#if MODE_BRAKE_ENABLED == ENABLED
|
||||
if (copter.set_mode(BRAKE, MODE_REASON_GCS_COMMAND)) {
|
||||
copter.mode_brake.timeout_to_loiter_ms(2500);
|
||||
} else {
|
||||
copter.set_mode(ALT_HOLD, MODE_REASON_GCS_COMMAND);
|
||||
}
|
||||
#else
|
||||
copter.set_mode(ALT_HOLD, MODE_REASON_GCS_COMMAND);
|
||||
#endif
|
||||
} else {
|
||||
// SoloLink is expected to handle pause in shots
|
||||
}
|
||||
|
@ -273,6 +273,12 @@
|
||||
# define MODE_AUTO_ENABLED ENABLED
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Brake mode - bring vehicle to stop
|
||||
#ifndef MODE_BRAKE_ENABLED
|
||||
# define MODE_BRAKE_ENABLED ENABLED
|
||||
#endif
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// Drift - fly vehicle in altitude-held, coordinated-turn mode
|
||||
#ifndef MODE_DRIFT_ENABLED
|
||||
|
@ -110,9 +110,11 @@ Copter::Mode *Copter::mode_from_mode_num(const uint8_t mode)
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if MODE_BRAKE_ENABLED == ENABLED
|
||||
case BRAKE:
|
||||
ret = &mode_brake;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case THROW:
|
||||
ret = &mode_throw;
|
||||
|
Loading…
Reference in New Issue
Block a user