Commit Graph

130 Commits

Author SHA1 Message Date
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