Commit Graph

437 Commits

Author SHA1 Message Date
Randy Mackay 06fbe8f3a7 Copter: rename FlightMode class to Mode
also remove unused print_FlightMode method
2017-12-12 10:39:26 +09:00
Randy Mackay 0ac708b5a0 Copter: remove ability to disable PosHold flight mode
This flight mode is stable and regularly used so it is unlikely that we ever want to disable it
2017-12-12 10:39:26 +09:00
Randy Mackay 8870897847 Copter: FlightMode objects use lower case 2017-12-12 10:39:26 +09:00
Peter Barker 5d33cf08e1 Copter: eliminate calc_home_distance_and_bearing
Calling update_simple_mode_bearing calls get-heading
rather than the other way around

This will have the advantage of not calculating home bearing
when we stop calling update_simple_mode_bearing unnecesarily
2017-12-09 16:26:09 +09:00
khancyr b44ba29a05 AC_Avoidance: replace AP_InertialNav by AHRS 2017-12-08 11:27:37 +09:00
Peter Barker 103e2cc711 Copter: calculate wp bearing and distance on demand
Move responsibility for calculating wp bearing/distance
into the FlightMode object doing the navigation

Calculating these variables was being done at 50Hz where they
were used at 10Hz max.
2017-12-07 07:43:08 +09:00
Peter Barker 4ae2be55aa Copter: fix up autotune namespacing
This moves static variables into the autotune flightmode object.

It also adjusts namespacing on everything to take advantage of
having everything encapsulated in the AutoTune object
2017-12-07 07:35:37 +09:00
Peter Barker 7b637334f4 Copter: eliminate mode_has_manual_throttle 2017-12-06 10:09:58 +09:00
Peter Barker 4fd61ed6dc Copter: make exit_mode take FlightMode objects as arguments 2017-12-06 10:09:58 +09:00
Peter Barker 477ae8f7be Copter: pass heli_flags into flightmode constructor 2017-12-06 08:24:24 +09:00
Peter Barker 83d0a71e10 Copter: FlightMode - simplify flight mode initialization 2017-12-06 08:24:24 +09:00
Peter Barker ef1489e87a Copter: eliminate mode_requires_gps 2017-12-06 08:24:24 +09:00
Peter Barker a4859e13c1 Copter: eliminate mode_allows_arming 2017-12-06 08:24:24 +09:00
Peter Barker 9c60c1de58 Copter: FlightMode - convert SMARTRTL flight mode 2017-12-06 08:24:24 +09:00
Peter Barker b0e34bd307 Copter: FlightMode - convert GUIDED_NOGPS flight mode 2017-12-06 08:24:24 +09:00
Peter Barker cf423ce681 Copter: FlightMode - convert THROW flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 37c706c24e Copter: FlightMode - convert AVOID_ADSB flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 51cd143012 Copter: FlightMode - convert BRAKE flight mode 2017-12-06 08:24:24 +09:00
Peter Barker cafce01357 Copter: FlightMode - convert POSHOLD flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 67063d6b1e Copter: FlightMode - convert AUTOTUNE flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 018c70d224 Copter: FlightMode - convert FLIP flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 5e3e831152 Copter: FlightMode - convert SPORT flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 6a38664ff4 Copter: FlightMode - convert DRIFT flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 682f3c0e7e Copter: FlightMode - convert RTL flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 3b1ca99b95 Copter: FlightMode - convert LAND flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 2db09ba0f7 Copter: FlightMode - convert GUIDED flight mode 2017-12-06 08:24:24 +09:00
Peter Barker f2495b2d08 Copter: FlightMode - convert LOITER flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 871ba5630f Copter: FlightMode - convert CIRCLE flight mode 2017-12-06 08:24:24 +09:00
Peter Barker e2b70c3a0a Copter: FlightMode - convert AUTO flight mode 2017-12-06 08:24:24 +09:00
Peter Barker a95a35c134 Copter: FlightMode - convert STABILIZE flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 79c06974b7 Copter: FlightMode - convert ALT_HOLD flight mode 2017-12-06 08:24:24 +09:00
Peter Barker d74f0c72da Copter: FlightMode - convert ACRO flight mode 2017-12-06 08:24:24 +09:00
Peter Barker 527a536b78 Copter: FlightMode - remove function parameters
Use current control_mode in place of parameters

Once conversion is complete these functions will disappear
2017-12-06 08:24:24 +09:00
Peter Barker 99a22a263d Copter: a FlightMode base class 2017-12-06 08:24:24 +09:00
Peter Barker e0233f1dc4 Copter: create a takeoff_state_t type 2017-12-06 08:24:24 +09:00
Peter Barker b828fa4ffc Copter: Create an ap_t type 2017-12-06 08:24:24 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas c7a2fcdc37 Copter: Also use fence in Guided_PosVel mode 2017-12-05 08:57:55 +09:00
Dr.-Ing. Amilcar Do Carmo Lucas bd027e4fcb Copter: Move some common functions to AP_Math (NFC) 2017-12-05 08:54:49 +09:00
Peter Barker 398d07a68a Copter: tighten return types of mavlink functions and variables 2017-12-01 17:01:10 +00:00
Dr.-Ing. Amilcar Do Carmo Lucas 9773365237 Copter: NFC spell in comments 2017-11-27 23:13:34 +09:00
Andrew Tridgell a644cff921 Copter: support testing multiple motors with motortest
this matches the quadplane behaviour, allowing a sequence of motors to
be tested
2017-11-27 10:15:31 +09:00
Randy Mackay 9a03ba1bfb Copter: move barometer_accumulate to sensors.cpp
non-functional change
2017-11-22 17:13:14 +09:00
Peter Barker 04c9e966e0 Copter: use AP::PerfInfo library 2017-11-16 15:31:53 +00:00
Peter Barker d959e4b42b Copter: AP_Camera uses GPS singleton 2017-11-16 15:28:37 +00:00
ChrisBird caaeae3d0a Copter: Separate max ascent and descent speeds
Added equivalent parameters to WPNAV_SPEED_UP and WPNAV_SPEED_DN

New parameters named:
PILOT_SPEED_UP (technically renamed PILOT_VELZ_MAX)
PILOT_SPEED_DN

Removed parameter PILOT_VELZ_MAX (technically renamed to PILOT_SPEED_UP).

Flight Modes impacted:
ALTHOLD
AUTOTUNE
CIRCLE
LOITER
POSHOLD
SPORT
TAKEOFF

Update a section in GUIDED mode but I don't think it is ever used but update just in case.

It will use the PILOT_SPEED_UP for ascending max velocity.  For down it will check if
it is 0, if so then it will PILOT_SPEED_UP instead, if non zero it will use PILOT_SPEED_DN.
This retains current behavior and gives the flexibility to change it if desired.
2017-11-09 09:03:54 +09:00
Peter Barker 5b793252ed Copter: stop disarming as part of running rtl as mission item
Fixed #6324

Note that the land-as-mission-item code is duplicated from the
rtl-as-mode code but omits the disarm part, so doesn't suffer from the
same bug.
2017-11-06 19:07:28 +00:00
Peter Barker c7216a2740 Copter: call ins periodic function 2017-10-27 16:33:45 +11:00
Randy Mackay 787954fa37 Copter: integrate winch library
fixes after peer review:
rename winch-disable to winch-relaxed
add DO_WINCH to do-verify
winch release-length accepts rate
2017-10-27 09:20:38 +09:00
Andrew Tridgell 951ed95eb9 Copter: support inverted flight CH7 option 2017-10-03 10:16:41 +11:00
Lucas De Marchi beabae6a98 global: use static method to construct AP_AHRS_NavEKF 2017-09-26 03:01:21 +01:00
Lucas De Marchi c9fbf7b722 global: use static method to construct AP_NavEKF3 2017-09-26 03:01:21 +01:00
Lucas De Marchi e2fe36357a global: use static method to construct AP_NavEKF2 2017-09-26 03:01:21 +01:00
Lucas De Marchi 6781a44046 global: use static method to construct AP_Avoidance_* 2017-09-26 03:01:21 +01:00
Lucas De Marchi 6d009cdf6e global: use static method to construct AP_ADSB 2017-09-26 03:01:21 +01:00
Lucas De Marchi 1263e20a0d ArduCopter: use static method to construct AC_InputManager 2017-09-26 03:01:21 +01:00
Lucas De Marchi e21e02cfdb ArduCopter: use static method to construct AC_PrecLand 2017-09-26 03:01:21 +01:00
Lucas De Marchi cf6ea9642e global: use static method to construct AP_Terrain 2017-09-26 03:01:21 +01:00
Lucas De Marchi 70d8a08626 ArduCopter: use static method to construct AP_LandingGear 2017-09-26 03:01:21 +01:00
Lucas De Marchi 31db77e47b global: use static method to construct AP_Parachute 2017-09-26 03:01:21 +01:00
Lucas De Marchi 57bbb2e1d9 ArduCopter: use static method to construct AC_Sprayer 2017-09-26 03:01:21 +01:00
Lucas De Marchi eadd650d78 global: use static method to construct AP_RSSI 2017-09-26 03:01:21 +01:00
Lucas De Marchi 4f42facefc global: use static method to construct AC_Avoid 2017-09-26 03:01:21 +01:00
Lucas De Marchi b05610870c global: use static method to construct AP_Rally 2017-09-26 03:01:21 +01:00
Lucas De Marchi c6eb48009b global: use static method to construct AC_Fence 2017-09-26 03:01:21 +01:00
Lucas De Marchi 18aa88b329 global: use static method to construct AP_Mount 2017-09-26 03:01:21 +01:00
Lucas De Marchi c3647f0185 global: use static method to construct AP_Camera 2017-09-26 03:01:21 +01:00
Lucas De Marchi cc53e7bc4b global: use static method to construct AP_ServoRelayEvents 2017-09-26 03:01:21 +01:00
Lucas De Marchi 13d7f58036 global: use static method to construct AP_Relay 2017-09-26 03:01:21 +01:00
Lucas De Marchi 9ce6019138 global: use static method to construct AP_Frsky_Telem 2017-09-26 03:01:21 +01:00
Lucas De Marchi b022c02029 global: use static method to construct AP_BattMonitor 2017-09-26 03:01:21 +01:00
Lucas De Marchi 69b6d95cb2 global: use static method to construct AP_Board_Config{,_CAN} 2017-09-26 03:01:21 +01:00
Lucas De Marchi a74e700006 global: use static method to construct RCMapper 2017-09-26 03:01:21 +01:00
Lucas De Marchi 72fd2d6f05 global: use static method to construct AP_SerialManager 2017-09-26 03:01:21 +01:00
Lucas De Marchi fbe0d9761c global: use static method to construct AP_OpticalFlow 2017-09-26 03:01:21 +01:00
Lucas De Marchi 10529feae6 ArduCopter: use static method to construct AP_Arming_Copter 2017-09-26 03:01:21 +01:00
Lucas De Marchi b36a5919f5 global: use static method to construct AP_Mission
This also move the initialization to be in the header for those that
weren't already to maintain consistency.
2017-09-26 03:01:21 +01:00
Lucas De Marchi de5e044b02 global: use static method to construct AP_RPM 2017-09-26 03:01:21 +01:00
Lucas De Marchi 40fd1b346c global: remove rangefinder from AP_AHRS_NavEKF
AP_AHRS_NavEKF doesn't use the rangefinder, it just delegates the
calls to the right estimator.

For libraries/AP_AHRS/examples/AHRS_Test/AHRS_Test.cpp the initialization
order has also been modified to match the order on vehicles. It's more
correct since it passes a reference when EKF2/EKF3 are already
constructed, while thos constructors use a pointer.  Ideally these
should be moved to an init() method though, or use a get_instance().
2017-09-26 03:01:21 +01:00
Lucas De Marchi 9027a55696 global: use static method to construct RangeFinder 2017-09-26 03:01:21 +01:00
Lucas De Marchi 62ac0ab8aa global: use static method to construct AP_Notify 2017-09-26 03:01:21 +01:00
Lucas De Marchi de680dac5b global: use static method to construct AP_Scheduler 2017-09-26 03:01:21 +01:00
Lucas De Marchi 8094482f21 global: use static method to construct AP_GPS 2017-09-26 03:01:21 +01:00
Lucas De Marchi 87b30b4552 global: use static method to construct AP_InertialSensor 2017-09-26 03:01:21 +01:00
Lucas De Marchi c1a957fbf3 global: use static method to construct Compass 2017-09-26 03:01:21 +01:00
Lucas De Marchi 91feec0e14 global: use static method to construct AP_Baro 2017-09-26 03:01:21 +01:00
Lucas De Marchi cd5b018d82 ArduCopter: move version to a static member
We should never include version.h or ap_version.h headers directly
on a header since this will trigger a complete rebuild of the
codebase when we commit to the repository. The ap_version.h header
is auto-generated containing information from the current commit.

If we include it in a header, every other file that ends up including
that header (directly or indirectly) will need to be rebuilt. No
ccache's cache beats having to do nothing when the header is just
not included.

version.h contains information that is kept on a struct inside
each vehicle. Rather than using the macros from each vehicle,
the getter should be preferred, which returns an AP_FWVersion
referente.
2017-09-23 21:37:45 -07:00
Peter Barker ff82f23cf6 Copter: factor out a ekf_check_position_problem method 2017-09-19 12:44:43 +01:00
Randy Mackay 1b3cc9289b Copter: support SET_GPS_GLOBAL_ORIGIN
also remove setting of origin from DO_SET_HOME command
initialise ekf_origin location when consuming SET_GPS_GLOBAL_ORIGIN
set_ekf_origin performs sanity check on location
2017-09-19 10:30:15 +09:00
Randy Mackay 44a436642b Copter: complete rename to SmartRTL
Also fix parameter description for CH7_OPT
2017-09-15 08:58:14 +09:00
Peter Barker 6b5fd5fbdd Copter: move gcs_out_of_time into GCS object 2017-09-12 18:28:07 +01:00
squilter 4b57a4a231 Copter: rename SafeRTL to SmartRTL 2017-09-09 14:05:41 +09:00
squilter ba0e08552f Copter: add SafeRTL flight mode 2017-09-09 14:05:41 +09:00
Peter Barker 470e790117 Copter: add constant structure holding firmware version 2017-08-30 15:54:46 +01:00
Peter Barker 30fac9160e Copter: mavlink PERF messages also spit out average and standard deviation 2017-08-29 21:31:46 +01:00
Peter Barker aa06fc499c Copter: use GCS_MAVLINK subclasses to handle set_mode 2017-08-16 11:58:10 +10:00
Peter Barker c6b9c84d1f Copter: remove CLI 2017-08-14 10:23:50 +09:00
Jani Hirvinen bdbe26eb28 Copter: minor comment fix
small edit on comments to kickoff autobuild
2017-08-09 20:14:22 +09:00
Peter Barker 431e3443bd Copter: move try_send_message send_hwstatus up 2017-08-03 14:33:37 +01:00
Peter Barker 3e5665735f Copter: move try_send_message mission handling up 2017-08-03 14:24:47 +01:00
Peter Barker cdf9ebcb39 Copter: camera is responsible for taking distance-based-images and logging 2017-07-28 14:27:53 +01:00
Randy Mackay f97e43919b Copter: add gps glitch notification and pre-arm check 2017-07-27 14:16:23 +09:00
khancyr 49755063ab Copter: move send_proximity to GCS common code (NFC) 2017-07-24 13:44:43 +01:00
Peter Barker e45efeb829 Copter: move starting of new logs into DataFlash 2017-07-19 16:37:28 +01:00
Randy Mackay 2b98fd765d Copter: guided_set_destination accepts relative yaw 2017-07-12 13:27:45 +09:00
Randy Mackay 4c9e118ceb Copter: set_auto_yaw_look_at_heading takes bool for relative angle arg
No functional change
2017-07-12 13:27:45 +09:00
Randy Mackay 9b05f1d9c7 Copter: add auto-yaw-rate and replace guided_angle_state.use_yaw_rate
We use the auto_yaw_mode in auto and guided modes to allow various yaw behaviours
This commit adds a new AUTO_YAW_RATE control to the mode and uses it within guided mode.
This new RATE control is not currently used within auto mode because there is no way (yet) for a mission command to specify a desired rate.
2017-07-12 13:27:45 +09:00
kouseii 4dd7d9eaff Copter: guided mode supports heading and yaw-rate target 2017-07-12 13:27:45 +09:00
Peter Barker 358555446b Copter: eliminate gcs_send_mission_item_reached wrapper 2017-07-11 23:45:16 +01:00
Peter Barker 0ac045febe Copter: eliminate gcs_send_message wrapper 2017-07-11 23:45:16 +01:00
Peter Barker f60389d4aa Copter: use send_text method on the GCS singleton 2017-07-09 17:17:29 -04:00
Peter Barker d9b45cc202 Copter: create GCS subclass, use inheritted methods 2017-07-07 16:18:37 +01:00
Eugene Shamaev 24c390ade0 ArduCopter: move of CAN parameters into separate group 2017-07-03 11:44:32 +01:00
Peter Barker 8b57405143 Copter: handle knowledge of in_log_download in DataFlash 2017-06-27 03:10:43 +01:00
Leonard Hall 7eab1239c7 Copter: attitude logging at 400hz 2017-06-22 15:18:04 +09:00
Pierre Kancir 261eb387eb ArduCopter: change rangefinder msg for common one 2017-06-08 01:31:43 +01:00
Randy Mackay cb76bd8f3d Copter: compass set-initial-location uses ahrs location
Previously it could attempt to use a gps location even if gps was not being used
Also compass-accumulate moved to sensors.cpp
2017-06-07 13:01:38 +09:00
Randy Mackay 814cadac68 Copter: consolidate set_home functions
added lock argument instead of having twice as many functions
no functional change
2017-06-07 13:01:38 +09:00
Peter Barker 0bc17645fb Copter: AutoTune: add gcs messages detailing wait-for-level state 2017-05-18 09:36:00 +09:00
Peter Barker 586a5df814 Copter: add GCS messaging during autotune 2017-05-18 09:36:00 +09:00
Randy Mackay 91d4b4777b Copter: respond to param list request after motor init 2017-05-15 14:13:43 +09:00
Randy Mackay a3450a955d Copter: fix LED notify during auto esc calibration 2017-05-11 11:30:05 +09:00
Randy Mackay 713c08672f Copter: integrate AP_VisualOdom 2017-04-19 11:04:40 +09:00
Jonathan Challinger 054aab738b Copter: remove const qualifier from do_precision_loiter 2017-03-29 14:06:12 +09:00
Andrew Tridgell 6bb5c16fb8 Copter: allow for HELI_DUAL configurations 2017-03-25 16:22:10 +11:00
Randy Mackay 8140353c64 Copter: log event when primary GPS changes 2017-03-13 11:31:51 +11:00
Peter Barker 1d70a337dd Copter: remove unused desired_climb_rate variable 2017-03-09 19:52:58 +11:00
Andrew Tridgell 0d1bcd3b94 Copter: added automatic yaw to autotune position control 2017-02-27 19:34:44 +09:00
Andrew Tridgell 37fca03db3 Copter: implement simple position hold during autotune
this holds position during tuning with low gain
2017-02-27 19:34:36 +09:00
Randy Mackay 51c00f8144 Copter: use only downward facing rangefinder 2017-02-27 15:18:16 +09:00
Peter Barker 029aeeb4fd Copter: support for a GCS singleton 2017-02-13 09:32:01 +11:00
Peter Barker f49f153da0 Copter: rename gcs[] to gcs_chan[]
Wish to use gcs() to return the gcs singleton
2017-02-13 09:32:01 +11:00
Randy Mackay cb1f7ba4bb Copter: remove setting position control's altitude max
AC_Avoid now takes responsibility for enforcing the alt limit and accesses inertial nav's limit directly
2017-01-18 09:35:47 +09:00
Randy Mackay b15d341850 Copter: add avoidance adjusted climb rate 2017-01-18 09:35:47 +09:00
Randy Mackay cc217550c0 Copter: rename arming_checks to AP_Arming 2017-01-17 11:45:08 +09:00
Peter Barker bd6ffc025e Copter: start conversion to AP_Arming_Copter 2017-01-17 11:45:08 +09:00
Andrew Tridgell 1297a7dedb Copter: convert the rest of motors class for tricopter 2017-01-12 17:39:37 +11:00
Andrew Tridgell 0f6d0c5ba9 Copter: combined tri, single, coax and multicopter into a single build
this allows copter to be just 2 builds, one for heli, and one for
everything else
2017-01-12 17:39:37 +11:00
Andrew Tridgell 5a87ae3f01 Copter: use new SRV_Channels API 2017-01-12 17:39:37 +11:00
Francisco Ferreira 11b635df12
Copter: correct limit status to fence status 2017-01-12 02:00:51 +00:00
Peter Barker a233024e05 Copter: fix compilation when fence andd proximity are disabled
This adds AC_AVOID_ENABLED; avoidance must be disabled if either
of fence or proximity are disabled.

Parameter definitions have been reordered to avoid compiler warnings;
this make sthe numbering non-linear
2017-01-03 10:44:03 +09:00
Randy Mackay 01bcf5e528 Copter: add arming checks for motor setup 2016-12-31 10:55:23 +09:00
Randy Mackay 217757fdc8 Copter: default FRAME_CLASS 2016-12-31 10:55:23 +09:00
Randy Mackay 0ac00dbfd6 Copter: add FRAME_CLASS parameter 2016-12-31 10:55:23 +09:00
Andrew Tridgell c3b9dbf5c8 ArduCopter: Add EKF3 and remove EKF1 2016-12-19 08:07:09 +11:00
Pierre Kancir 3fc17a5ed5 Copter: avoid must be initialized after fence as it use it 2016-12-05 10:59:45 -08:00
Peter Barker 556eb88fe5 Copter: fix compile when precland is not selected
Fixes #5327
2016-12-05 20:03:00 +09:00
Peter Barker 289aba4350 Copter: support for NAV_CMD_PLACE 2016-12-02 12:52:53 +11:00
Randy Mackay 74c9c4aa9d Copter: add beacon data flash logging
Added to Copter vehicle because currently only used by Copter
2016-11-30 17:56:59 +09:00
Randy Mackay 21c7ea1df7 Copter: integrate AP_Beacon 2016-11-30 17:56:55 +09:00
Andrew Tridgell bcea3ac8d4 Copter: handle rangefinder glitches in alt tracking
this handles glitches from the rangefinder when tracking the
ground. It requires 3 readings in a row to settle on a new target
altitude

thanks to discussions with Leonard and Randy
2016-11-28 17:36:01 +11:00