Commit Graph

96 Commits

Author SHA1 Message Date
Peter Barker e7e56dde7a Copter: move handling of RC switches into RC_Channel 2018-08-01 12:11:30 +09:00
Peter Barker df83cb034e Copter: use ArmingMethod enumeration 2018-07-03 15:16:38 +10:00
Peter Barker fd9ce90b8e Copter: option to force arm, bypassing checks 2018-06-20 11:43:38 +10:00
Peter Barker e3ddf7dadd Copter: rename SPRAYER-enabled-define to SPRAYER_ENABLED 2018-06-01 15:13:05 +09:00
Peter Barker c09ccf5b61 Copter: split home-set and home-locked state 2018-05-29 14:38:45 +10:00
Andrew Tridgell 2425c65e74 Copter: implement 'air-mode' for copter
this implements what betaflight calls 'air-mode'. This gives attitude
control when throttle is at zero, allowing for zero-throttle maneuvers,
plus keeping the copter level on the ground.

This was already implemented if an interlock switch was setup, but it
should also work with an arming switch. If using an arming switch then
throttle should not be considered zero as long as the arming switch
hasn't gone low.
2018-05-29 10:27:14 +09:00
Michael du Breuil 291531e056 Copter: Support new battery failsafes 2018-03-27 22:12:21 +01:00
Peter Barker 45f2312bfe Copter: move home state into AP_AHRS 2018-03-19 10:32:37 +09:00
Peter Barker 9b440d6b25 Copter: add option to disable SmartRTL mode
Saves 5.5k of Flash
2018-02-27 07:43:13 +09:00
Peter Barker b9ad2bc8db Copter: add option to disable AUTO mode
Saves ~12k of flash
2018-02-27 07:43:13 +09:00
Peter Barker 80a3d63264 Copter: use AP_Scheduler's loop() function 2018-02-13 17:15:05 +11:00
Peter Barker 40d74584ac Copter: remove shims used in scheduler 2018-02-12 11:19:34 +09:00
Andrew Tridgell af4f0c29ba Copter: enable TMODE (ToyMode) support
this is for the skyviper button based transmitter control
2018-02-08 17:36:33 +11: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 2d23e1f7c7 Copter: rename flightmode_ objects to mode_ 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
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 67063d6b1e Copter: FlightMode - convert AUTOTUNE flight mode 2017-12-06 08:24:24 +09:00
Andrew Tridgell 23b20307af Copter: use cork/push wrapper 2017-11-21 14:10:54 +11:00
Peter Barker 04c9e966e0 Copter: use AP::PerfInfo library 2017-11-16 15:31:53 +00:00
Randy Mackay 44a436642b Copter: complete rename to SmartRTL
Also fix parameter description for CH7_OPT
2017-09-15 08:58:14 +09: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
squilter f7a00b911e Copter: minor format fix for motors.cpp 2017-07-31 17:27:15 +09:00
Peter Barker f60389d4aa Copter: use send_text method on the GCS singleton 2017-07-09 17:17:29 -04:00
Peter Barker d36e8fa51e Copter: eliminate calls to manipulate _writes_enabled 2017-06-11 20:34:12 +01: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
Andrew Tridgell 2ba6e7af35 Copter: fixed aux servos in RC failsafe
we should always output to channels
2017-05-01 14:32:18 +10:00
Andrew Tridgell ebde6e1ce3 Copter: output any servo channels on motor output
if we have any auxillary servo channels we need to calculate the
output value
2017-04-18 09:34:42 +09:00
Peter Barker bd6ffc025e Copter: start conversion to AP_Arming_Copter 2017-01-17 11:45:08 +09: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
Randy Mackay 742cdf6b13 Copter: fix arming while armed bug
If a mavlink command was sent to arm the vehicle while it was already armed, the in_arm_motors boolean was left as true meaning the vehicle could never be armed again using a mavlink message.  This resolves issue #5546.
2017-01-11 21:38:22 +09:00
Randy Mackay 5135a11fbc Copter: protect against arming while already armed
Previously it was possible to arm the vehicle (from the GCS) even thought the vehicle was already armed which would lead to the motors stopping for 2 seconds
2016-12-01 10:24:53 +09:00
Peter Barker f9802204df Copter: inform dataflash of vehicle arm state 2016-11-28 09:42:09 -08:00
Mathieu OTHACEHE 152edf7189 Global: remove mode line from headers
Using a global .dir-locals.el file is a better alternative than
reincluding the same emacs header in every file of the project.
2016-10-24 09:42:01 -02:00
Andrew Tridgell f18e0dadc9 Copter: added optional AdvancedFailsafe for copter and heli 2016-08-25 14:14:18 +10:00
Jonathan Challinger 80f3541933 Copter: add configurable arming delay 2016-08-04 15:19:22 +09:00
Andrew Tridgell 7e1ef905d3 Copter: removed 30ms delay on arming
this is the last of the delays that can cause the EKF to get unhappy
on arming in copter. The comment says it is waiting for RC input, but
I don't think that makes any sense any more.
2016-05-24 15:42:53 +10:00
skyscraper 6f200fa923 ArduCopter: Fix up after refactoring RC_Channel class
Further to refactor of RC_Channel class which included
adding get_xx set_xx methods, change reads and writes to the public members
to calls to  get and set functionsss

old public member(int16_t)   get function -> int16_t     set function (int16_t)
(expression where c is an object of type RC_Channel)
c.radio_in                     c.get_radio_in()           c.set_radio_in(v)
c.control_in                   c.get_control_in()         c.set_control_in(v)
c.servo_out                    c.get_servo_out()          c.set_servo_out(v)
c.pwm_out                      c.get_pwm_out()            // use existing
c.radio_out                    c.get_radio_out()          c.set_radio_out(v)
c.radio_max                    c.get_radio_max()          c.set_radio_max(v)
c.radio_min                    c.get_radio_min()          c.set_radio_min(v)
c.radio_trim                   c.get_radio_trim()         c.set_radio_trim(v);

c.min_max_configured() // return true if min and max are configured

Because data members of RC_Channels are now private and so cannot be written directly
 some overloads are provided in the Plane classes to provide the old functionality

new overload Plane::stick_mix_channel(RC_Channel *channel)
which forwards to the previously existing
void stick_mix_channel(RC_Channel *channel, int16_t &servo_out);

new overload Plane::channel_output_mixer(Rc_Channel* , RC_Channel*)const
which forwards to
(uint8_t mixing_type, int16_t & chan1, int16_t & chan2)const;

Rename functions

 RC_Channel_aux::set_radio_trim(Aux_servo_function_t function)
    to RC_Channel_aux::set_trim_to_radio_in_for(Aux_servo_function_t function)

 RC_Channel_aux::set_servo_out(Aux_servo_function_t function, int16_t value)
    to RC_Channel_aux::set_servo_out_for(Aux_servo_function_t function, int16_t value)

 Rationale:

        RC_Channel is a complicated class, which combines
        several functionalities dealing with stick inputs
        in pwm and logical units, logical and actual actuator
        outputs, unit conversion etc, etc
        The intent of this PR is to clarify existing use of
        the class. At the basic level it should now be possible
        to grep all places where private variable is set by
        searching for the set_xx function.

        (The wider purpose is to provide a more generic and
        logically simpler method of output mixing. This is a small step)
2016-05-10 16:21:16 +10:00
Andrew Tridgell 111eb2ccc1 Copter: use DataFlash::log_while_disarmed() 2016-05-09 12:05:52 +10:00
Andrew Tridgell 54d1cc7e50 Copter: only save offsets for Compass::LEARN_EKF
this means by default that one flight one affect the next one, which
makes it more robust in case of a bad flight
2016-04-30 16:43:14 +10:00
Jonathan Challinger c9b1b02b8e Copter: loop through compasses and save offsets 2016-04-21 09:53:03 +10:00
Jonathan Challinger 8ded496f8b Copter: log mode change reason 2016-04-14 12:24:04 +09:00
Paul Riseborough a7b69366a1 Copter: Add flight mode for throw launch
The is commit adds a new flight mode called 'Throw' to Copter that enables the copter to be thrown into the air to start motors. This mode can only be netered when the copters EKF has a valid position estimate and goes through the following states

Throw_Disarmed - The copter is disarmed and motors are off.
Throw_Detecting - The copter is armed, but motors will not spin unless THROW_MOT_START has been set to 1. The copter is waiting to detect the throw. A throw with an upwards velocity of at least 50cm/s is required to trigger the detector.
Throw_Uprighting - The throw has been detected and the copter is being uprighted with 50% throttle to maximise control authority. This state transitions when the copter is within 30 degrees of level.
Throw_HgtStabilise - The copter is kept level and height is stabilised about the target height which is 3m above the height at which the throw release was detected. This state transitions when the height is no more than 0.5m below the demanded height.
Throw_PosHold - The horizontal motion is arrested and the copter is kept at a constant position and height.
2016-03-03 12:18:13 +09:00
Randy Mackay 1f3fa3e272 Copter: formatting fixes to arming checks 2015-12-24 14:11:38 +09:00
Jonathan Challinger 933ffb2b10 Copter: move prearm logic to arming_checks.cpp 2015-12-24 14:10:23 +09:00
Luis Vale Gonçalves 3199829d45 Copter: revisions to text strings sent to GCS 2015-11-27 16:16:58 +09:00