Commit Graph

214 Commits

Author SHA1 Message Date
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
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
Josh Henderson
f65c4df358 ArduCopter: make Location(Vector3f) require ALTFRAME 2021-03-30 08:56:35 +09:00
Tatsuya Yamaguchi
0cce5699b2 Copter: change from control_mode to flightmode 2021-03-23 22:48:20 +11:00
Randy Mackay
1c350514ca Copter: auto mode starts or updates mission from run method 2021-03-23 10:12:08 +09:00
Tatsuya Yamaguchi
ed8384b45a Copter: add option to disable LANDING_GEAR 2021-03-17 10:41:11 +09:00
Randy Mackay
be29b23195 Copter: do-mount-control ignored if no mount
Co-authored-by: srirajshukla <srirajshukla@gmail.com>
Co-authored-by: Yash Vadi <yvadi9274@yahoo.com>
2021-03-16 10:07:16 +09:00
James O'Shannessy
d055d7a581 ArduCopter: Cleanup - removes autoenabling of fence with AC_Fence parameter 2021-03-05 14:52:46 +11:00
James O'Shannessy
f14e1c2799 ArduCopter: Ensure fence has opportunity to auto disable for landing 2021-03-05 14:52:46 +11:00
James O'Shannessy
a88f2721a8 ArduCopter: Use auto enable and auto disable from AC_Fence 2021-03-05 14:52:46 +11:00
James O'Shannessy
f228adfa75 ArduCopter: Improve auto-enable/disable of fence 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
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
Leonard Hall
5efe94a771 Copter: use AP_Math control functions 2021-01-20 18:19:40 +11:00
Randy Mackay
0b83d45163 Copter: verify land and payload place record flow-of-control internal error 2021-01-20 09:12:02 +09:00
Randy Mackay
b8c58bd900 Copter: payload place fixups 2020-12-05 08:35:03 +09: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
7a90ed4bb5 Copter: auto allows arming casts param to uint32_t 2020-10-20 23:04:45 +09:00
Randy Mackay
c1c9d87efe Copter: move auto allows_arming in mode_auto.cpp
this should be a non-functional change
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
Randy Mackay
29a2be2d63 Copter: minor comment fix 2020-09-09 15:32:37 +09:00
Randy Mackay
925f76c048 Copter: integrate winch changes
includes the following changes
winch_update called at 50hz
removed ability to set winch rate from ch6 tuning
remove wheel encoder
call winch library to log at 10hz
fix winch param prefix
2020-08-07 21:55:07 +09:00
Andy Piper
54c3d07547 Copter: make make/gimbal configurable on a per-board basis 2020-08-04 09:18:14 +10:00
Randy Mackay
d2b94bd45d Copter: verify_circle removes redundant setting of circle center
the circle center is already set in circle_movetoedge_start
2020-06-03 10:08:52 +09:00
Andrew Tridgell
e673bd8909 Copter: implement disarm on land based on MIS_OPTIONS
only continue with mission if MIS_OPTIONS bit is set
2020-06-02 09:12:22 +09:00
murata
520782d7f2 Copter: Correction of spelling errors (NFC) 2020-05-18 13:26:11 +10:00
Randy Mackay
d9ecf51457 Copter: auto mode loiter-turns accepts pilot yaw input 2020-04-27 09:39:46 +09:00
Randy Mackay
c4b5d47e1f Copter: white space fixes 2020-04-23 13:17:11 +09:00
Rishabh
1edf1d265c Copter: Set correct yaw for circle in Mode Auto 2020-04-21 20:12:38 +09:00
Randy Mackay
71cbedb178 Copter: support circle with terrain altitude 2020-04-16 17:30:29 +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
Peter Barker
ce5f23810b ArduCopter: log disarm method 2020-02-22 12:16:29 +11: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
39a6b104dd Copter: move RTLState to ModeRTL 2019-12-17 20:02:01 +09:00
Peter Barker
2296448027 Copter: make private enum class for LAND mode's state 2019-12-03 07:38:22 +08:00
Randy Mackay
de5945bea5 Copter: use const reference when retrieving wpnav destination 2019-11-12 08:50:05 +08:00
Randy Mackay
d0d07776ec Copter: auto stays in takeoff submode after reaching altitude 2019-11-12 08:50:05 +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
Michael du Breuil
b42b1c08c4 Copter: Support new AP_Vehicle::set_mode 2019-10-25 08:48:22 +08: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
Peter Barker
c0774e74e0 Copter: fix format-string compilation warning
../../ArduCopter/mode_auto.cpp: In member function 'void ModeAuto::do_nav_delay(const AP_Mission::Mission_Command&)':
../../ArduCopter/mode_auto.cpp:1372:84: warning: format '%u' expects argument of type 'unsigned int', but argument 4 has type 'long unsigned int' [-Wformat=]
     gcs().send_text(MAV_SEVERITY_INFO, "Delaying %u sec",nav_delay_time_max_ms/1000);
                                                                                    ^

This is with a mini-pix build.
2019-08-21 18:48:45 +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
liang
e422f2b2fd Copter: mode_auto: retract the landing gear automatically 2019-07-30 09:46:18 +09:00
Leonard Hall
c56acb49d6 Copter: Add missing Loiter initialisation lines.
This command is missing to define the desired acceleration that loiter will initalise to.
loiter_nav->clear_pilot_desired_acceleration();
2019-07-20 16:40:51 +09:00
Randy Mackay
b7a748df88 Copter: auto's wp_start accepts terrain alts 2019-07-18 09:01:09 +09:00
Peter Barker
e3da6d69d5 Copter: mode_auto: don't set takeoff dest from bad current location 2019-06-18 09:07:56 +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
Peter Barker
6dce39cbe1 Copter: use AP_Arming methods to arm and disarm vehicle
Really just changing the namespace of init_arm_motors
2019-05-30 07:37:30 +09:00
Randy Mackay
791b6effdd Copter: fix wp distance and bearing reporting during LOITER_TURNS 2019-05-07 13:54:31 +09:00
Pierre Kancir
caf925eda5 Copter: factorize arm or land check 2019-04-16 10:17:47 +09:00
Peter Barker
46a6f45e4a Copter: adjust for desired spool state and spool state renames 2019-04-14 12:18:03 +09:00
bnsgeyer
94738c3f86 Copter: change make_safe_shut_down to make_safe_spool_down 2019-04-08 09:42:21 +09:00
bnsgeyer
f96da56ad6 Copter: Allow safe shutdown before disarming 2019-04-08 09:42:21 +09:00
Leonard Hall
593925567b Copter: formatting fixes 2019-04-08 09:42:21 +09:00
Randy Mackay
a6bfafefb0 Copter: move loiter and wpnav init out of make_safe_shut_down
resolves autotest RTLSpeed test failure
2019-04-08 09:42:21 +09:00
Leonard Hall
38cc5a817f Copter: consolidate mode state decisions
bnsgeyer and rmackay9 contributed to these changes

make_safe_shut_down waits for spool down before disarming
remove use of attitude_control::set_throttle_out_unstabilized to consolidate logic between multicopters and tradhelis
2019-04-08 09:42:21 +09:00
Peter Barker
c7e21d95ef Copter: move Log_Write_Error into library 2019-03-27 12:36:40 +11:00
Peter Barker
366051c39f Copter: use enum class for AltFrame enumeration 2019-03-19 10:31:18 +11:00
Randy Mackay
e57ec068f0 Copter: remove duplicate guided limit-init-time-and-pos
this is called from nav_guided_start()
2019-03-15 14:51:35 +09:00
Randy Mackay
8d66c5f547 Copter: move do_payload_place handler
commands are placed in numerical order
2019-03-15 14:51:35 +09:00
Peter Barker
281dbfcef8 Copter: support send_extended_sys_state 2019-03-12 09:16:13 +09:00
Peter Barker
fab2d59a1c Copter: move check for position up 2019-03-01 13:43:20 +09:00
Randy Mackay
384bca9482 Copter: stop at waypoint depending upon next command 2019-02-27 13:30:40 +09:00
Arjun Vinod
d02d897928 Copter: make LOITER_TIME send "Reached command" message to GCS 2019-02-26 10:19:37 +09:00
Arjun Vinod
8044d98382 Copter: do an early-return if the time hasn't been reached 2019-02-26 10:14:56 +09:00
Peter Barker
5ae52038fa Copter: make setting of home boolean in preparation for sanity checks 2019-02-15 08:28:45 +11:00
Peter Barker
228d7b676d Copter: move responsibility for parachute deployment up 2019-02-13 09:25:27 +09:00
Peter Barker
587e02e92e Copter: remove pv_ functions that duplicate Location functions 2019-02-06 11:02:50 +09:00
Randy Mackay
42c7f5ceb4 Copter: integrate WPNAV::set_speed_z split to set_speed_up and set_speed_down 2019-01-31 19:34:32 +09:00
Randy Mackay
717fb4d823 Copter: integrate AC_WPNav::get_speed rename to get_default_speed 2019-01-31 19:34:32 +09:00
Peter Barker
6fc76a32af GLOBAL: use AP::logger() and strip redundant Log_ from methods 2019-01-18 18:08:20 +11:00
Peter Barker
b47733142f GLOBAL: rename DataFlash_Class to AP_Logger 2019-01-18 18:08:20 +11:00
Peter Barker
845f015648 Copter: adjust for Location_Class and Location unification 2019-01-16 11:45:29 +11:00
Peter Barker
73940df48e Copter: move mission into mode_auto 2018-11-09 13:35:40 +09:00
Peter Barker
7e581da1cf Copter: implement misson LOITER_TO_ALT 2018-10-30 17:50:46 +09:00
Peter Barker
a339d77f08 Copter: let AP_Mission handle common camera commands 2018-10-30 15:37:18 +11:00
Peter Barker
f97281eb48 Copter: move servorelayevents mission handling into AP_Mission 2018-10-30 15:37:18 +11:00
Peter Barker
1eec264d6c Copter: mission library handles gripper 2018-10-30 15:37:18 +11:00
Dr.-Ing. Amilcar Do Carmo Lucas
b74ae2d912 Copter: Obey and preserve DO_SET_ROI commands when executing LOITER_TURNS mission commands 2018-10-23 10:19:05 +09:00
Peter Barker
7af119b497 Copter: factor out loc_from_cmd from three functions 2018-10-16 10:17:12 +11:00
Peter Barker
5f552a6ce3 Copter: stop shadowing members of Copter
These references were taken to make the breaking out of Modes in Copter.

A lot of other code has already caused these sorts of things to go away,
but these particular ones seem reasonable to fix by pointing the users
at the copter object directly.
2018-10-16 10:17:12 +11:00
Peter Barker
e02a645354 Copter: use fabsf() instead of labs()
wrap_180_cd returns a float

substracting a float from an int32 returns a float
2018-10-16 10:17:12 +11:00
chobitsfan
d94663d5af Copter: support changing vertical speed in DO_CHANGE_SPEED 2018-10-13 13:16:26 +09:00
Peter Barker
26ca75efae Copter: make libraries get EKF control limits themselves 2018-10-09 10:47:38 +11:00
Leonard Hall
1b5b46dab5 Copter: Missing Loiter Init on accel 2018-09-19 17:29:55 +09:00
Michael du Breuil
470548a100 Copter: Allow starting mission commands to fail 2018-09-11 06:42:00 +10:00
Pierre Kancir
17c12dab2a Copter: correct payload_place flytolocation 2018-08-17 21:14:57 +09:00
Pierre Kancir
84ff9c6928 Copter: switch to pos control when takeoff finish 2018-07-31 10:40:57 +10:00
Peter Barker
22f7f29045 Copter: move all of waypoint-takeoff into Mode namespace 2018-07-27 13:08:27 +10:00
Peter Barker
11aeec6dd1 Copter: factor out auto_takeoff_run from auto and guided
This code was identical.
2018-07-27 13:08:27 +10:00
Peter Barker
078d90132c Copter: use AP_RTC
Co-authored-by: patrickelectric@gmail.com

Copter: AP_GPS now sets the system time directly

Copter: use AP_RTC for mission delays

Copter: Remove ap_t bits counter (Patrick José Pereira)

Change bits in ap_t to bool and add a static assert
2018-06-15 08:01:22 +10:00
apinxiko
e440583a7c Copter: Beeping when first reaching waypoint while in holding there 2018-06-11 16:45:48 +09:00
apinxiko
5df4b9f6fd Beeping when first reaching waypoint even while in holding there 2018-06-11 16:45:48 +09:00
apinxiko
a1fd1cb9b2 Copter: avoid keeping buzzing while in holding at waypoint 2018-05-25 14:02:13 +09:00
Peter Barker
7c8583d51d Copter: implement sending of position_target_global_int 2018-05-18 20:26:37 +10:00
Peter Barker
8648db06b4 Copter: create autoyaw.cpp from all the bits of Copter::Mode::AutoYaw 2018-04-18 13:27:43 +09:00
Peter Barker
948b90ed97 Copter: rename roi_WP to just roi
A Vector3f is not a waypoint.

This should really be "Point Of Interest" rather than "Region Of
Interest"
2018-04-18 13:27:43 +09:00
Peter Barker
ba8b3e2415 Copter: create an AutoYaw helper object to hold auto-yaw state 2018-04-18 13:27:43 +09:00
Randy Mackay
59e4749fd0 Copter: integrate AC_Loiter
includes param conversion
2018-04-04 10:45:10 +09:00
Ebin
1ff4019ddf ArduCopter: moved landing control fns from Copter to Mode
land_run_horizontal_control(),land_run_vertical_control(),get_alt_above_ground() moved to Mode
2018-03-29 16:50:00 +01:00
Bruno Camba
7b50517232 Copter: Moved commands_logic to mode_auto
Moved methods from commands_logic.cpp to
the mode_auto.cpp. Method order is
the same as declared in mode.h
2018-03-23 10:07:12 +09:00
Leonard Hall
9544b1763b Copter: replace smoothing gain with AC_AttitudeControl::set_input_tc 2018-03-16 13:50:57 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas
5b7116bbbd Copter: Fix else formating (NFC)
git history on these lines is not important, this is a simple else
2018-03-15 07:51:26 +09:00
Peter Barker
b9ad2bc8db Copter: add option to disable AUTO mode
Saves ~12k of flash
2018-02-27 07:43:13 +09:00
Andrew Tridgell
0ed75052f8 Copter: enable parameters inside mode objects
this adds FHLD_* parameters for FlowHold mode. It is a large patch as
it needs to disentagle the mode class to enable it to be used in
Parameters.h
2018-02-08 17:36:33 +11:00
Peter Barker
114628afe4 Copter: use zero_throttle_and_relax_ac in stab, guided, acro and auto 2018-01-08 12:02:49 +00:00
Peter Barker
71ad1b5815 Copter: use zero_throttle_and_relax_ac function 2017-12-27 12:09:06 +00:00
Peter Barker
4c7491a05b Copter: mode_auto's landing_gear_deploy method defers to mode_rtl
Since we defer our rtl_run behaviour to the RTL flightmode, it should
also specify the landing gear behaviour
2017-12-27 12:08:15 +00:00
Peter Barker
d9235d3d41 Copter: make landing_gear_should_be_deployed a base-class method 2017-12-27 12:08:15 +00:00
Peter Barker
6c82f7671d Copter: move all commands logic into AUTO flightmode 2017-12-14 14:08:01 +09:00
Randy Mackay
2d23e1f7c7 Copter: rename flightmode_ objects to mode_ 2017-12-12 10:39:26 +09:00
Randy Mackay
c3fbf2671c Copter: rename control_xx.cpp files to mode_xx.cpp 2017-12-12 10:39:26 +09:00