Commit Graph

5402 Commits

Author SHA1 Message Date
Peter Barker 996115c0d3 Copter: eliminate MAIN_LOOP_SECONDS macro 2018-01-20 15:35:58 +11:00
Michael du Breuil 0ddcb0a6fb Copter: Support AP_BattMonitor_Params 2018-01-17 22:21:55 +00:00
Alexey Bulatov 8accfb97f6 ArduCopter: Check for nullptr for motors class pointer
Because of added initialisation of UAVCAN send_heartbeat function
starts before motors initialisation. So we need check is object created.
2018-01-17 07:24:17 -08:00
Dylan Herman c772e2d3fd Copter: sets SmartRTL home after AHRS home is set
Now calls AP_SmartRTL::set_home when arming. In addition, it calls it whenever
the ahrs home is set to the current location, whether by GCS or in-flight

Copter: merge
2018-01-17 11:04:46 +09:00
Randy Mackay e85b1ac740 Copter: pass dt to avoidance calls 2018-01-16 12:13:48 +09:00
Leonard Hall 48d0ad26a6 Copter: mode_land sends dt to sqrt controller 2018-01-16 12:13:48 +09:00
Randy Mackay b47d575f65 Copter: minor spelling fix
non-functional change
2018-01-12 16:51:25 +09:00
Peter Barker 6bcdab55d0 Copter: rename sys_status methods from geofence_ to sys_status_ 2018-01-09 17:15:19 +00:00
Peter Barker 077b062701 Copter: change pre-arm checks to allow interlock to be enabled
With this change we will continue to tell the user their interlock is
enabled, but we will not fail the pre-arm checks.

This will mean that the blinking-LED indicators will show the vehicle as
armable (flashing green / flashing blue), even if the interlock would
prevent arming.

This has the advantage that you don't need your vehicle in the
"dangerous" state to work out whether arming will work when you attempt
to arm it.

Note that we repeat the interlock switch check in the arming checks, and
it WILL fail if the interlock switch is enabled.
2018-01-09 08:13:06 +09: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 8d658e1dbc Copter: correct misleading comment in mode_throw 2018-01-08 12:02:49 +00:00
Peter Barker cb129fbdaf Copter: remove argument to check()
Also, check() was check_fence()
2017-12-28 15:38:37 +00:00
Peter Barker d1201e4776 Copter: tidy zero_throttle_and_relax (NFC) 2017-12-27 12:09:06 +00:00
Peter Barker 71ad1b5815 Copter: use zero_throttle_and_relax_ac function 2017-12-27 12:09:06 +00:00
Peter Barker 41dc8554c0 Copter: pull out a zero_throttle_and_relax 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 dda38d65eb Copter: AP_AHRS no longer requires GPS in constructor 2017-12-27 00:58:02 +00:00
Matt 5d6c979f70 COPTER: Fix MOUNT_CONTROL yaw in missions
If a the mount instances (gimbal) does not support yaw/pan control, the
copter needs to yaw in response to a DO_MOUNT_CONTROL command in
missions.  Checking if the mount has pan control, and if not, yawing the
copter was missing from the mission commands logic. As such, a
MOUNT_CONTROL command would control pitch but not yaw/pan.  This patch
impliments checking for pan control, and initiating copter yaw as
required.
2017-12-23 10:57:31 +09:00
Matt c0f0e3eca3 COPTER: Fix MOUNT_CONTROL yaw in guided
If the mount instance does not support yaw/pan, the copter needs to yaw in
response to MSG_MOUNT_CONTROL and MAV_COMMAND_DO_MOUNT_CONTROL commands from
a GCS or co-computer. There was no checking for mount pan in the GCS_Mavlink
logic.  As such, no yaw takes place when a mount control command calls for it.
This patch impliments copter yaw control for both MSG_MOUNT_CONTROL and
MAV_COMMAND_DO_MOUNT_CONTROL in copter GCS_Mavlink.
2017-12-23 10:57:31 +09:00
Peter Barker 4dcb5aa3de Copter: stop setting home distance in fence 2017-12-15 01:42:49 +00:00
Peter Barker bf5f51a616 Copter: factor out takeoff_trigger from althold, sport and loiter 2017-12-14 23:45:54 +00:00
Randy Mackay 2c0df87585 Copter: Copter.h method reordering 2017-12-15 08:26:45 +09:00
Peter Barker 6c82f7671d Copter: move all commands logic into AUTO flightmode 2017-12-14 14:08:01 +09:00
Andrew Tridgell 8ab0ac8a16 Copter: removed create() method for objects
See discussion here:

  https://github.com/ArduPilot/ardupilot/issues/7331

we were getting some uninitialised variables. While it only showed up in
AP_SbusOut, it means we can't be sure it won't happen on other objects,
so safest to remove the approach

Thanks to assistance from Lucas, Peter and Francisco
2017-12-14 08:12:28 +11:00
Peter Barker 7222380598 Copter: populate system status bits for fence 2017-12-13 10:04:50 +09:00
Peter Barker 377466ddda Copter: fence no longer requires AP_InertialNav 2017-12-13 10:04:50 +09:00
Peter Barker d09b0696db Copter: correct checking of heli mode change
init() may have changed all sorts of things about the
vehicle - wp navigation, position controllers, attitude controllers...

Do the heli check before doing any of that so we don't change state and
then fail to change mode
2017-12-13 08:49:01 +09:00
Randy Mackay 7504237fbb Copter: rename flight_mode.cpp to mode.cpp 2017-12-12 20:39:48 +09:00
Randy Mackay 99bafb0df1 Copter: rename heli_control_xx to mode_xx_heli 2017-12-12 10:39:26 +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
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 6e9de7e609 Copter: flight_mode formatting changes
non-functional change
2017-12-12 10:39:26 +09:00
Randy Mackay 2e71a641c3 Copter: FlightMode allow_arming format changes
non-functional change
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 7494eb2e77 Copter: alphabetise flight mode header file 2017-12-12 10:39:26 +09:00
Randy Mackay a90979ec8e Copter: remove FlightMode_Avoid_ADSB.h file 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
Randy Mackay 20d7216179 Copter: remove comments
non-functional change
2017-12-12 10:39:26 +09:00
Randy Mackay ac8c2b3f03 Copter: resolve compiler warning from flight-mode declaration 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 adf4140b9b Copter: fix heli-flags compilation issue 2017-12-06 08:24:24 +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