Commit Graph

132 Commits

Author SHA1 Message Date
Peter Barker 047689981b RC_Channel: honour gcs_overrides_enabled as part of set_override
This will stop situations like we currently have where the
MANUAL_CONTROL GCS mavlink packets can still affect the vehicle

Also resolves an issue where has_new_overrides may not be set
appropriately
2018-09-05 11:54:32 +10:00
Peter Barker 7bdd9b1aea RC_Channel: move handling of disable-gcs-rc-overrides-channel-option 2018-09-05 11:54:32 +10:00
Peter Barker 3c8738b4d8 RC_Channel: add clear-waypoints option 2018-09-04 10:32:26 +10:00
Peter Barker a7acc92663 RC_Channel: move rc-channel option for lost-vehicle sound up to base class 2018-09-03 16:57:25 +09:00
Michael du Breuil 80597d5cba RC_Channel: Fix accidental quantization of override_timeout to 1 second 2018-08-28 14:18:54 +10:00
Peter Barker f2b8c9e501 RC_Channel: improve debug when failing to initialise RC channel 2018-08-21 20:34:01 +09:00
Peter Barker e4d3ed7e39 RC_Channel: move handling of sprayer and gripper in from Copter 2018-08-17 15:33:35 +09:00
Michael du Breuil e7ebea55d2 RC_Channel: Fix possible user induced out of bounds write
CID 308348
2018-08-09 10:27:10 +10:00
Peter Barker e4ff937c96 RC_Channel: remove min-max-configured pre-arm checks
These are really, really expensive to run while your RC isn't
configured.

We now have a split between inputs (RC) and servos (SRV), so these
aren't as critical as they were.  We also have range checks to ensure
they're roughly good enough to fly with.
2018-08-07 09:45:09 +10:00
Peter Barker f2b1387c1c RC_Channel: add AUTOTUNE to init_aux_function routine
Also, cark it in SITL if we fail to initialise an aux function
2018-08-05 07:52:28 +10:00
Peter Barker 61c34ea98c RC_Channel: move handling of auxillary switches into RC_Channel
RC_Channel: move handling of Rover's functions into RC_Channel

RC_Channel: move auxsw handling for camera to base RC_Channel

RC_Channel: add responsibility for servorelay events

RC_Channel: move mode switch handling to base class
2018-08-01 12:11:30 +09:00
Michael du Breuil 60f19bbf02 RC_Channel: Allow an input to be ignored 2018-08-01 09:19:20 +10:00
Michael du Breuil 16b6201195 RC_Channel: Allow a RC_OVERRIDE_TIMEOUT of -1 to use the overrides
forever
2018-07-19 07:53:43 +10:00
Michael du Breuil 95eda5d9b7 RC_Channel: Remove unneeded interfaces 2018-06-11 16:29:36 -07:00
Michael du Breuil 0fcf07fde7 RC_Channel: Remove input() method from individual channels 2018-06-05 09:51:09 +10:00
Michael du Breuil 4253c7f74d RC_Channel: Move overrides out of the HAL 2018-06-05 09:51:09 +10:00
Michael du Breuil c8fdb90ab5 RC_Channel: Rework set_pwm_no_deadzone() to a recompute function 2018-04-14 14:05:20 +10:00
Andrew Tridgell e5813effff RC_Channel: improved efficiency of min_max_configured
this is quite a costly function due to scan in AP_Param. It takes
about 4 to 5 milliseconds when done as part of AP_Arming
2018-01-10 16:42:51 +09:00
Andrew Tridgell 0155434057 RC_Channel: fixed bug in manual with TRIM == MIN
This fixes the bug described here:

https://discuss.ardupilot.org/t/arduplane-reverse-thrust-setup/18324/5

which otherwise would prevent output with TRIM == MIN or TRIM == MAX
2017-08-26 20:30:54 +10:00
Dr.-Ing. Amilcar Do Carmo Lucas ed07d5b5c9 RC_Channel: Improve the PWM parameters descriptions 2017-06-06 11:06:26 +10:00
Dr.-Ing. Amilcar Do Carmo Lucas 8661bdda8a RC_Channel: Use SI units conventions in parameter units
Follow the rules from:
http://physics.nist.gov/cuu/Units/units.html
http://physics.nist.gov/cuu/Units/outside.html
and
http://physics.nist.gov/cuu/Units/checklist.html
one further constrain is that only printable (7bit) ASCII characters are allowed
2017-05-17 18:07:25 +10:00
Andrew Tridgell d6d94bd26c RC_Channel: improved doc string 2017-02-07 16:32:57 +11:00
Andrew Tridgell 11afd0c7d4 RC_Channel: split RC_Channels.cpp out to separate cpp file
this is needed for automatic parameter documentation generation
2017-02-06 15:12:32 +11:00
Andrew Tridgell 0791186cd2 RC_Channel: split SRV_Channel into separate directory 2017-01-12 17:39:37 +11:00
Andrew Tridgell 64aa13e7f4 RC_Channel: 2nd stage of SRV_Channels conversion
allow for 16 output channel objects
2017-01-12 17:39:37 +11:00
murata c808ee2f49 Global: To nullptr from NULL.
RC_Channel: To nullptr from NULL.

AC_Fence: To nullptr from NULL.

AC_Avoidance: To nullptr from NULL.

AC_PrecLand: To nullptr from NULL.

DataFlash: To nullptr from NULL.

SITL: To nullptr from NULL.

GCS_MAVLink: To nullptr from NULL.

DataFlash: To nullptr from NULL.

AP_Compass: To nullptr from NULL.

Global: To nullptr from NULL.

Global: To nullptr from NULL.
2016-11-02 16:04:47 -02: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 73b9123495 RC_Channel: added set_trim() API to SRV_Channels object 2016-10-15 16:59:35 +11:00
Andrew Tridgell fea7903aa8 RC_Channel: added get_radio_out_normalised() 2016-10-15 16:59:35 +11:00
Andrew Tridgell 96c7d9dde8 RC_Channel: make output_trim() go via _radio_out
this ensures that _radio_out always contains the value that would be
output to the channel. This will be used by the SRV_Channels object
2016-10-15 16:59:35 +11:00
Andrew Tridgell 934d2b6ae4 RC_Channel: added setup_failsafe_trim_mask() 2016-06-30 16:46:57 +10:00
skyscraper d9ab3baf84 RC_Channel: Refactor to make data members private
rename all public data members of RC_Channnels with
leading underscore and make all data members private.
Provide get_xx and set_xx methods for access

 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)

add function to save radio trim
(expression where c is an object of type RC_Channel)
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);
// other
c.min_max_configured() // return true if min and max are configured
c.save_radio_trim()    // save radio trim to eeprom
2016-05-10 16:21:15 +10:00
skyscraper 134ea338da RC_Channel: remove unused control_mix method 2016-05-05 18:58:17 -03:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
Andrew Tridgell 4deb01b8d5 RC_Channel: set AP_PARAM_NO_SHIFT 2016-03-18 12:33:34 +11:00
Andrew Tridgell a07a8aece1 RC_Channel: added pwm_to_angle_dz_trim() 2016-01-06 22:47:21 +11:00
Andrew Tridgell 48b774bc63 RC_Channel: allow more complete separation of input and output of channels
this allows for the type and range of channels to be different on
input and output
2016-01-04 11:23:30 +09:00
Lucas De Marchi 2591261af6 Global: rename min and max macros to uppercase
The problem with using min() and max() is that they conflict with some
C++ headers. Name the macros in uppercase instead. We may go case by
case later converting them to be typesafe.

Changes generated with:

	git ls-files '*.cpp' '*.h' -z | xargs -0 sed -i 's/\([^_[:alnum:]]\)max(/\1MAX(/g'
	git ls-files '*.cpp' '*.h' -z | xargs -0 sed -i 's/\([^_[:alnum:]]\)min(/\1MIN(/g'
2015-12-01 16:28:09 -02:00
Andrew Tridgell 52f2fce1d5 RC_Channel: prevent float exception with bad RCn_MIN/MAX/TRIM
thanks to Michael for finding this
2015-11-30 21:53:54 +11:00
Andrew Tridgell ea5cd99651 RC_Channel: use is_bounded_int32() 2015-11-11 13:45:09 +11:00
Grant Morphett 7edf8c0e0a RC_Channel: New method to detect if channel is in trim location
This is a new method which will return true if an RC_Channel has a PWM
value that is at its TRIM value plus or minus the allowed dead zone
around the TRIM.
2015-11-11 13:39:38 +11:00
Lucas De Marchi 2847af905e RC_Channel: remove checks for HAL_BOARD_APM2 and HAL_BOARD_APM1 2015-11-04 12:14:13 +11:00
Lucas De Marchi 831d8acca5 Remove use of PROGMEM
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:

    git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
    git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'

The 2 commands were done so we don't leave behind spurious spaces.

AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Jonathan Challinger 21e7d46944 RC_Channel: use set_default for runtime param defaults 2015-10-26 11:15:54 +11:00
Grant Morphett 122e88dbed RC_Channel: remove the unused test function get_failsafe 2015-09-09 10:28:02 +10:00
Gustavo Jose de Sousa d2780623f7 RC_Channel: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:38:25 +10:00
Andrew Tridgell c86ff1ac25 RC_Channel: prevent floating exception on bad MIN/MAX/TRIM values 2015-07-27 12:04:03 +10:00
Randy Mackay 1b13250fd8 RC_Channel: small parameter description change 2015-05-14 10:33:08 +09:00
Andrew Tridgell 6959cdbf15 RC_Channel: fixed usage of _reverse to be consistent
users could set RCn_REV to 0 and get very confusing results
2015-02-18 12:47:56 +11:00
Randy Mackay 73f3b50e2f RC_Channel: make get_control_mid const 2014-11-17 18:16:12 -08:00