Commit Graph

158 Commits

Author SHA1 Message Date
Randy Mackay 96267553cf Copter: auto detects mission changes 2021-04-03 12:07:59 +09:00
Leonard Hall 328c0655e3 Copter: support for SCurves and position controller changes
wp_start provides next_dest_loc
send next_destination to wp_nav instead of setting fast_waypoint
fixup zigzag for S-curve changes
fixup guided
auto spline fixes
smart rtl rename of next_point to dest_NED
loc_from_cmd accepts default location
auto mode stops before starting land command
auto do_next_wp accepts default location
rename do_next_wp to set_next_wp
also rename get_spline_from_cmd argument
also improve failure to set next waypoint due to missing terrain data
also fixup comment in set_next_wp
also auto stops when moving from straight to spline segments
also auto mode spline fix
also auto mode calls AC_WPNav::set_spline_destination_next

Copter: AutoYaw provides rate from WPNav
2021-04-03 12:07:59 +09:00
Peter Barker 1e0f106ed4 Copter: make AutoTune object private state to ModeAutoTune 2021-03-30 11:23:10 +11:00
Peter Barker d387ad9921 Copter: have allows_arming take a AP_Arming::Method rather than bool from_gcs
This API predates us having the arming methods being passed around.

This makes the calls look like Plane
2021-03-30 09:00:26 +09:00
Peter Barker 3af006019b Copter: mark ModeSystemID as has_manual_throttle, no-arm and no-gps
This has implications for many things, like smoothing transition to auto
modes, and for arming
2021-03-26 10:26:34 +09:00
Peter Barker a274697776 Copter: move LAND state variables to be members rather than static
Also rename one of them as we may be using (e.g.) OF to control position rather
than GPS.
2021-03-25 09:39:29 +11:00
Tatsuya Yamaguchi 069b7142b7 Copter: add allows_flip function to Mode class 2021-03-23 22:48:20 +11:00
Tatsuya Yamaguchi f4eed612d7 Copter: add allows_autotune function to Mode class 2021-03-23 22:48:20 +11:00
Tatsuya Yamaguchi 2b89ac625f Copter: add allows_save_trim function to Mode class 2021-03-23 22:48:20 +11:00
Tatsuya Yamaguchi 1dccc0ceb3 Copter: add mode_number function to Mode class 2021-03-23 22:48:20 +11:00
Randy Mackay 32fb3cb929 Copter: remove unused update_navigation and run_autopilot 2021-03-23 10:12:08 +09:00
Randy Mackay 1c350514ca Copter: auto mode starts or updates mission from run method 2021-03-23 10:12:08 +09:00
chobits b7c937592e Copter: send mission_item_reached in guided 2021-03-09 10:04:24 +09:00
James O'Shannessy 2a9affe517 ArduCopter: Remove unused fence floor enable function 2021-03-05 14:52:46 +11:00
Dr.-Ing. Amilcar do Carmo Lucas 92122e5133 Copter: automatically enable and disable floor fence on automated takeoff and landing 2021-03-05 14:52:46 +11:00
Dr.-Ing. Amilcar do Carmo Lucas 2302f08f75 Copter: run the "point yaw to ROI" controller at full rate (400Hz) instead of 1/4 of full rate (100Hz)
- This should improve pointing at ROI and replaces #11172
 - Remove unused member variable as per review suggestion
 - declare Mode::AutoYaw::roi_yaw() as const
2021-02-16 09:30:21 +09:00
Patrick José Pereira ad82e01270 ArduCopter: Add missing const in member functions
Signed-off-by: Patrick José Pereira <patrickelectric@gmail.com>
2021-02-03 18:45:14 +11:00
Peter Barker f4cbc50ba4 Copter: use an enumeration for pre-throw motor state 2020-12-08 12:04:14 +11:00
Peter Barker bd0dff1b0e Copter: use enum-class and AP_Enum for ThrowType 2020-12-08 12:04:14 +11:00
Michael du Breuil f9b4e81702 Copter: Add ignore pilot yaw to guided, auto and RTL options 2020-11-19 07:22:54 +09:00
Randy Mackay 0f234583d6 Copter: poshold clears wind est when disarmed or landed 2020-11-10 08:56:36 +09:00
Peter Barker 225de23950 Copter: cope with race conditioning popping points on SmartRTL return
There is a race with the cleanup thread.  While thin, it only has to
happen once.  After this patch the race would have to happen... a lot.

Co-authored-by: jasclarke308 <jasclarke308@gmail.com>
2020-10-24 08:59:26 +09:00
Randy Mackay 9104b4800f Copter: correct GuidedOptions enum after peer review
Co-authored-by: Peter Barker <pb-gh@barker.dropbear.id.au>
2020-10-20 23:04:45 +09:00
Randy Mackay eb3aca7acf Copter: add GUIDED_OPTIONS to allow arming from transmitter 2020-10-20 23:04:45 +09:00
Randy Mackay 8b3cc0b255 Copter: fixup auto options 2020-10-01 08:48:06 +09:00
Michael du Breuil 50dfe3f197 Copter: Add AUTO_OPTIONS and support arming and throttle bypass
This allows you to arm the copter without any extra GCS commands while
in auto, and can be done from both the GCS, or the RC Tx. This is useful
for creating a simpler workflow.

This also allows you to set the auto_armed flag internally, which
bypasses the need to raise the throttle stick for the copter to start a
takeoff.

This exposed a problem where we would start running the controllers
before the EKF was at all initialized, if you switched into auto to
early. This now has a check that prevents us from running the mission
state machine until after the origin has been set. This was a suggestion
from @rmackay9.

When combined these options allow you to have the vehicle on the ground,
disarmed in auto with a takeoff waypoint loaded, then just arm the
aircraft and watch it takeoff. This is a feature we've had on quadplanes
for quite awhile now, and it has proven to be very nice for operators.
2020-10-01 08:46:29 +09:00
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