Commit Graph

132 Commits

Author SHA1 Message Date
Peter Barker dba3158446 Copter: correct mode change for GCS failsafe in SmartRTL mode
In the case that you:
 - have previously done a successful SmartRTL flight
 - get a mid-air gcs failsafe and enter SmartRTL
 - recover from that gcs failsafe but remain in SmartRTL
 - get another mid-air failsafe

then without this patch you will enter LAND mode.

When determining our failsafe action, we were looking at whether we
should just continue landing.  To do that, we ask the current mode if we
are landing.  Problem is that SmartRTL was handing back the wrong answer
- it was handing back ModeRTL's answer rather than its own, and
ModeRTL's answer was "yes, I'm landing", as that's the last state that
step 1 in the above list leaves that mode in.

This patch simply hands back the correct answer for, "am I landing"
2020-09-08 09:05:03 +09:00
Peter Barker 397b95154c Copter: remove superfluous RETURN_TARGET_ALTTYPE_ from enum class names
Just repeats what's in the required prefix for the enum class
2020-09-08 10:01:59 +10:00
Peter Barker afa153fb6f Copter: remove wrapper for get_avoidance_adjusted_climbrate
Only the modes are interested in this - there's no point having it on
the Copter object.
2020-08-22 08:31:25 +09:00
Randy Mackay 30c8d7bf40 Copter: dev option so set-attitude-target thrust field used as thrust 2020-08-01 08:32:23 +09:00
Andy Piper 12c9578a66 Copter: add in additional acro options
Air-mode for multicopters
Rate only for multicopters and trad-heli
if air-mode aux switch is toggled in acro do not reset air-mode on exit
2020-07-14 15:54:24 +09:00
Tatsuya Yamaguchi cde7ae246e Copter: add ZIGZ_AUTO_ENABLE parameter 2020-06-03 15:21:21 +09:00
Tatsuya Yamaguchi 78fd5fac04 Copter: allow to resume in ZigZag Auto 2020-06-03 15:21:21 +09:00
Tatsuya Yamaguchi cee7e94ebc Copter: add zigzag_line_num parameter 2020-06-03 15:21:21 +09:00
Tatsuya Yamaguchi 7bc528097d Copter: support zigzag auto feature 2020-06-03 15:21:21 +09:00
Tatsuya Yamaguchi 60fb275501 Copter: rename zigzag_auto_pump to zigzag_sprayer 2020-06-03 15:21:21 +09:00
murata 923237ffd3 Copter: Enumerate A and B points of ZigZag 2020-06-03 15:21:21 +09:00
Andrew Tridgell 4c2cf2139e Copter: fixed use of timestamps in autorotate
fixes wrap handling
2020-04-20 07:10:21 +10:00
Andrew Tridgell ffd601aca4 Copter: fixed build warnings in autorotate
unused code, and incorrect use of abs()
2020-04-20 07:10:21 +10:00
Tatsuya Yamaguchi 735498e160 Copter: move zigzag exit into mode_zigzag.cpp 2020-03-26 14:56:40 +09:00
Randy Mackay db2229f684 Copter: ModeGuided::do_user_takeoff_start arg rename
this makes it more consistent with the method it is overriding
2020-03-19 15:17:11 -07:00
Randy Mackay 90883624bc Copter: fix use of wp-navmin-alt 2020-03-11 10:39:18 +09:00
Randy Mackay 8d99f204b0 Copter: integrate landing gear option and make edge based
also guided mode now retracts landing gear after takeoff
previously landing gear deployment was "level based" meaning the pilot could not override the gear's position
2020-02-26 08:01:00 +09:00
Sachchit Vekaria f6125b26e8 Copter: Allowing Terrain Following in Guided Mode
Uses frame type of MAVLINK_MSG_ID_SET_POSITION_TARGET_GLOBAL_INT message to decide the value of terrain_alt boolean.
2020-02-17 14:42:42 +09:00
Randy Mackay 495c4ad6b6 Copter: remove unused ModeAuto::wp_start
this version accepts an offset from the ekf origin which is not required.  All callers provide a Location
2020-02-17 14:30:18 +09:00
Randy Mackay d244162587 Copter: zigzag supports arming, takeoff and landing 2020-02-13 07:37:29 +09:00
Matt Lawrence 809b170015 Copter: Circle mode pilot control of rate & radius
RC pitch stick controls circle mode radius.  RC roll stick controls circle mode rate (speed) and direction.
2020-01-07 09:30:33 +09:00
Peter Barker 72e6446204 Copter: make requires_terrain a callback on the flightmode
This will prompt new modes to consider whether failsafe should be active
for terrain.
2019-12-24 09:46:19 +09:00
Randy Mackay ea22e888c7 Copter: improve RTL terrain following
RTL_ALT_TYPE replaces TERRAIN_FOLLOW param
return path built using rangefinder or terrain database
pre-arm checks for RTL_ALT_TYPE parameter
pre-arm checks of terrain data only run if RTL might use it
2019-12-17 20:02:01 +09:00
Randy Mackay 39a6b104dd Copter: move RTLState to ModeRTL 2019-12-17 20:02:01 +09:00
Randy Mackay 54582814aa Copter: use SID_AXIS to hide other SystemID mode params 2019-12-03 14:53:55 +08:00
Peter Barker 2296448027 Copter: make private enum class for LAND mode's state 2019-12-03 07:38:22 +08:00
Gone4Dirt 180d4e713c Copter: Added autorotation flight mode and support 2019-11-29 08:06:10 +08:00
Peter Barker e6c6189fe5 Copter: cope with change in namespace of LogEvent enum
Also move Acro Trainer types into an enum class as the global defines
interfere with the Event names.

Also eliminate the Log_Write_Event wrappers.
2019-11-05 08:19:26 +08:00
Peter Barker 5ece75a09a Copter: AC_AutoTune writes events itself now 2019-11-01 14:47:52 +08:00
Michael du Breuil b42b1c08c4 Copter: Support new AP_Vehicle::set_mode 2019-10-25 08:48:22 +08:00
Randy Mackay 2cb3e446ab Copter: systemid mode formatting and name changes 2019-10-16 08:17:09 +09:00
Leonard Hall c11f2247eb Copter: System ID mode 2019-10-16 08:17:09 +09:00
Leonard Hall 91be844b66 Copter: Let modes stop Attitude Logging 2019-10-16 08:17:09 +09:00
Randy Mackay ca92f0505e Copter: follow mode restores offsets to zero on exit 2019-10-07 08:30:45 +09:00
Peter Barker b4537bebd8 Copter: move control_mode_t into being Mode::Number enum class
Fixes this compiler error:

In file included from ../../ArduCopter/sensors.cpp:1:
In file included from ../../ArduCopter/Copter.h:195:
../../ArduCopter/mode.h:1291:9: fatal error: declaration shadows a variable in the global namespace [-Wshadow]
        AUTO,           // after A and B defined, pilot toggle the switch from one side to the other, vehicle flies autonomously
        ^
../../ArduCopter/defines.h:38:5: note: previous declaration is here
    AUTO =          3,  // fully automatic waypoint control using mission commands
    ^
1 error generated.
2019-09-13 13:12:08 +09:00
Tom Pittenger 0983a04d52 Copter: NAV_Delay variable timers to be all unsigned and labeled as _ms 2019-08-19 15:24:06 -07:00
Randy Mackay 709c874d8b Copter: integrate AP_OAPathPlanner 2019-08-17 09:42:43 +09:00
Leonard Hall 0e34d8b1ff Copter: PosHold fix for low brake_rate 2019-07-18 11:13:51 +09:00
Randy Mackay b7a748df88 Copter: auto's wp_start accepts terrain alts 2019-07-18 09:01:09 +09:00
Rishabh 00f6dc9b05 Copter: brake moved in from AC_WPNav 2019-06-13 09:02:46 +09:00
Peter Barker 676d75c391 Copter: correct namespacing of Copter modes
This makes us look like Rover and Plane in terms of namespacing for the
Mode classes, and removes a wart where we #include mode.h in the middle
of the Mode class.

This was done mechanically for the most part.

I've had to remove the convenience reference for ap as part of this.
2019-06-11 09:18:22 +09:00
Bill Geyer 0c64cdc565 Copter: TradHeli - add virtual flybar to heli acro flight mode 2019-06-04 09:57:13 +09:00
Peter Barker 08a18d6a0a Copter: avoid working with uninitialised home location 2019-05-29 09:04:37 +09:00
Peter Barker d34c4b01f4 Copter: build return path in run() rather than init()
This avoids attempting to build a return path if we don't currently have
a home or origin
2019-05-29 09:04:37 +09:00
Peter Hall 3fe63d5bc0 Copter: only save autotune gains if disarmed in autotue 2019-05-07 09:23:50 +10:00
Peter Barker 37c07e1d89 Copter: use enum class for roll/pitch mode
This adds some type-safety and helps distinguish between the many
defines which are used within PosHold mode

Saves about 210 bytes of flash
2019-04-30 08:36:59 +09:00
Peter Barker 462d87e5d0 Copter: remove unused PosHoldModeState enumeration 2019-04-30 08:36:59 +09:00
Peter Barker e28c6b9dc6 Copter: remove redundant poshold_ prefix on PosHold methods 2019-04-30 08:36:59 +09:00
Peter Barker f57a9f11cc Copter: move poshold state variables into mode object
This was simply moving the members from the poshold struct into the
class then mechanically removing poshold. from in front of the member
access.
2019-04-30 08:36:59 +09:00
Randy Mackay 8a5141f751 Copter: mode autoyaw lower in mode.h
make ordering of some declarations consistent across child classes
2019-04-20 10:04:33 +09:00