Commit Graph

82 Commits

Author SHA1 Message Date
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
Randy Mackay 1b29a1af46 Copter: consolidate setting of using-iterlock state 2015-11-17 09:02:31 +09:00
Robert Lefebvre 2b111c2bd6 Copter: fix Helicopter no-build issue
Conflict with another recent change to disarm counter
2015-11-14 10:32:58 +09:00
Fredrik Hedberg a6d2e0d4df Copter: Don't auto-disarm helicopters if rotor is still spinning. 2015-11-13 11:17:43 +09:00
Robert Lefebvre 2632a2e348 Copter: Rework arming proceedures for interlock/Estop
to fix race condition.
2015-11-12 19:37:15 +09:00
Jonathan Challinger 6524222397 Copter: adapt auto disarm check to use a timer 2015-11-09 15:34:41 +09:00
lvale 549695181c Copter: revised and uniformization of severity messages 2015-11-05 12:20:49 +09:00
Lucas De Marchi 84da1f5039 Rename gcs_send_text_P to gcs_send_text 2015-10-30 14:35:07 +09:00
Lucas De Marchi 2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Randy Mackay b49fda4a94 Copter: remove rotor spinning arming check from TradHeli 2015-10-27 09:14:39 +09:00
Jonathan Challinger 28f55766fd Copter: use configured to check whether radio has been calibrated 2015-10-26 11:15:54 +11:00
Lucas De Marchi 09f185eb5e ArduCopter: remove check for max INS instances
For all supported boards the maximum number of instances is 3.
2015-10-21 10:05:17 +11:00
Paul Riseborough d0aba09503 Copter: Access EKF healthy through AHRS object
Enables EKF2 use
2015-10-20 15:21:38 +11:00
Paul Riseborough 7c6b31b585 Copter: Access EKF variance checks through AHRS object
Supports flight using EKF2
2015-10-20 15:21:38 +11:00
Randy Mackay d03489263d Copter: remove gyro cal on first arming 2015-10-19 12:00:41 +09:00