Commit Graph

312 Commits

Author SHA1 Message Date
Peter Barker 319cfa766b RC_Channel: add method to get current radio out for a function 2016-12-02 12:04:05 +11:00
Peter Barker 7200692137 RC_Channel: make EPM a subclass of AP_Gripper_Backend 2016-11-05 10:20:41 +09:00
Peter Barker d2e798d549 RC_Channel: alias k_epm to k_kgripper 2016-11-05 10:20:31 +09: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 f9dd31b6e5 RC_Channel: support automatic servo trimming 2016-10-16 15:20:47 +11:00
Andrew Tridgell 992bf2368e RC_Channel: cope with SERVO_RNG_ENABLE changing while booted
this prevents a one second throttle up on scaled ESCs when
enabling/disabling the servo output mapping
2016-10-15 16:59:37 +11:00
Andrew Tridgell 4a9ddf52e0 RC_Channel: constrain output to servo range
don't allow servos past configured range in any mode
2016-10-15 16:59:36 +11:00
Andrew Tridgell 2ceddddd3b RC_Channel: don't call output() in SRV_Channel
we may need to run another mixer
2016-10-15 16:59:36 +11:00
Andrew Tridgell 78ef3b77c6 RC_Channel: added disable_passthrough() method 2016-10-15 16:59:36 +11:00
Andrew Tridgell 2ec439d7e3 RC_Channel: added set_esc_scaling() to SRV_Channels 2016-10-15 16:59:36 +11:00
Andrew Tridgell 73b9123495 RC_Channel: added set_trim() API to SRV_Channels object 2016-10-15 16:59:35 +11:00
Andrew Tridgell c7f8b255e7 RC_Channel: added SRV_Channels object for remapping output channels
this allows for decoupling RC input ranges from servo output ranges
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
Lucas De Marchi ae53920e5b build: don't build examples with old build system
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file.  Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11:00
Andrew Tridgell 38fff6d43d RC_Channel: expanded docs for RCn_FUNCTION 2016-08-16 16:16:09 +10:00
Andrew Tridgell 62f3818b83 RC_Channel: added k_throttle
for secondary throttle on planes
2016-08-16 16:14:34 +10:00
Andrew Tridgell be2b6e47aa RC_Channel: added output types for choke, ignition and starter 2016-07-25 10:06:03 +10:00
Andrew Tridgell 7ea68f8f80 RC_Channel: fixed function indexes above 64 2016-07-24 19:46:01 +10:00
Andrew Tridgell 3377714300 RC_Channel: fixed typo 2016-07-01 15:35:55 +10:00
Andrew Tridgell 934d2b6ae4 RC_Channel: added setup_failsafe_trim_mask() 2016-06-30 16:46:57 +10:00
Andrew Tridgell 120564f094 RC_Channel: set_radio() should not constrain values
caller is supplying direct PWM value. The MIN/MAX should not apply
2016-06-14 13:08:35 +10:00
Andrew Tridgell 4e3dd315cb RC_Channel: fixed double channel assignment
this fixes RC_Channel_aux::set_aux_channel_default from assigning
k_heli_rsc twice, once at default channel and once at user designated
channel
2016-06-05 05:54:56 +10:00
Andrew Tridgell 2094cb2d88 RC_Channel: fixed example for MAVLink2 2016-05-21 15:25:17 +10:00
Ricardo de Almeida Gonzaga 099fc69032 RC_Channel: Fix typos 2016-05-13 19:20:05 -03:00
Andrew Tridgell a41ffc176c RC_Channel: added motor tilt auxillary channel 2016-05-11 05:55:23 +10:00
skyscraper c0c8f1a5cc RC_Channel: RC_Channel refactor
Fix up RC_Channel examples.

Change direct access to data members
to access via member functions
2016-05-10 16:21:17 +10:00
skyscraper d16659331f RC_Channel_aux: Rename static member functions
Further to refactor of RC_Channel class which included
adding get_xx set_xx methods, some methods names are now
in conflict with those in the derived RC_Channel_aux class.
To keep a uniform naming convention in RC_Channel where
functions are most used and most numerous, the offending
functions in RC_Channel__aux are renamed as follows

 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:15 +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
Andrew Tridgell 50908edc91 RC_Channel: added parameter docs for missing RCn_FUNCTION values 2016-05-09 17:33:21 +10:00
Andrew Tridgell ab0b76764f RC_Channel: added set_servo_failsafe_pwm() 2016-05-07 07:25:27 +10:00
skyscraper 134ea338da RC_Channel: remove unused control_mix method 2016-05-05 18:58:17 -03:00
Andrew Tridgell 54f7aeed83 RC_Channel: extend channel mapping to 16 channels
this gives more flexibility, no reason to limit it to 8
2016-04-23 21:03:46 +10:00
Andrew Tridgell ed2f26d7b8 RC_Channel: allow for pass-thru from low channels to any channel
this makes it easier to setup things like ignition cut or bottle drop
with a 8 channel radio
2016-04-10 20:33:12 +10:00
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
Andrew Tridgell 1ecfa6b487 RC_Channel: fixed example in SITL 2016-03-25 21:35:33 +11:00
Andrew Tridgell 4deb01b8d5 RC_Channel: set AP_PARAM_NO_SHIFT 2016-03-18 12:33:34 +11:00
Lucas De Marchi 08cc7b2472 RC_Channel: replace header guard with pragma once 2016-03-16 18:40:44 +11:00
Gustavo Jose de Sousa c2e3f05dbf waf: ardupilotwaf: prefix build context methods with ap_
It helps to distinguish between things from waf and things from ardupilotwaf.
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa 3d22490397 waf: examples: use methods from bld instead of ardupilotwaf 2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa d281067bcc waf: make example binaries be placed in 'examples' dir
This commit makes examples' wscripts use ardupilotwaf.example() instead of
ardupilot.program().
2016-01-15 16:46:41 -02:00
Andrew Tridgell a07a8aece1 RC_Channel: added pwm_to_angle_dz_trim() 2016-01-06 22:47:21 +11:00
Andrew Tridgell 9941c91d36 RC_Channel: prevent a warning message for assigned RC channels 2016-01-06 19:16:12 +11:00
Andrew Tridgell b6155d2cb6 RC_Channel: fixed output for k_motor* 2016-01-05 06:41:51 +11:00
Andrew Tridgell 238e912000 RC_Channel: allow find_channel() to be called early
and fix a bug!
2016-01-05 06:40:48 +11:00
Andrew Tridgell 9123ef9f38 RC_Channel: added find_channel() and channel numbers 2016-01-04 17:06:57 +11:00
Andrew Tridgell 6a58264c6b RC_Channel: added set_aux_channel_default() API
this will allow for a default channel for aux functions. Also adds
heli_rsc and heli_tail_rsc functions
2016-01-04 16:14:09 +11:00
Andrew Tridgell 7cc53b6449 RC_Channel: setup only in or out part of channels for aux channels
this allows separate use of input and output
2016-01-04 11:23:36 +09: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
Jonathan Challinger 027e622a3c RC_Channel: fix example build 2015-12-29 10:46:35 -08:00
Lucas De Marchi a096703b06 Global: don't link with AP_Progmem
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02:00
Andrew Tridgell e1c890eb58 RC_Channel: added RC_UART example
useful for UART -> ESCs
2015-12-27 16:12:27 +11:00
Lucas De Marchi e8e48fd8e0 RC_Channel: remove unused AP_ADC_AnalogSource 2015-12-03 13:32:44 +11:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11: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 8f4ce7f20b build: removed all nocore.inoflag files
these were APM2 specific
2015-11-16 08:05:17 +11:00
Robert Lefebvre 58e918341d RC_Channel: Add motor_run_enable aux function 2015-11-12 19:37:27 +09: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 2a91d2169e RC_Channel: remove check for AVR CPUs
Remove the checks for HAL_CPU_CLASS > HAL_CPU_CLASS_16 and
HAL_CPU_CLASS >= HAL_CPU_CLASS_75. Corresponding dead code will be
removed on separate commits.
2015-11-04 12:14:14 +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
Caio Marcelo de Oliveira Filho e36728d1db RC_Channel: make example compile again
By adding a missing library dependency. Also remove unnecessary
includes, in particular including each board HAL file is not needed
anymore.
2015-10-21 09:16:09 +11:00
Caio Marcelo de Oliveira Filho ec52df991c build: compile only the HAL files needed by the board
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho 2e464a53c2 AP_HAL: make code not depend on concrete HAL implementations
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.

A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.

The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.

Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.

The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
2015-10-21 09:16:07 +11:00
Grant Morphett 122e88dbed RC_Channel: remove the unused test function get_failsafe 2015-09-09 10:28:02 +10:00
Andrew Tridgell 1162503199 RC_Channel: fixed example build 2015-08-11 17:00:13 +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 03a336d496 RC_Channel: update_aux_servo_function made public 2015-06-10 16:47:06 +09:00
Andrew Tridgell e234844905 RC_Channel: fixed example sketch 2015-06-01 18:05:50 +10:00
Andrew Tridgell 6c1c2dd8bd RC_Channel: convert example from .pde to .cpp 2015-06-01 17:07:08 +10:00
Randy Mackay b121d83beb RC_Channel: add EPM, LandingGear to FUNCTION param description 2015-05-27 18:05:01 +09:00
Randy Mackay 1b13250fd8 RC_Channel: small parameter description change 2015-05-14 10:33:08 +09:00
Andrew Tridgell fa688a7b14 RC_Channel: fix for HAL_SITL rename 2015-05-05 09:45:57 +10:00
Randy Mackay 5b15c07d47 RC_Channel: fix example sketch 2015-05-01 21:02:57 +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
Robert Lefebvre 4935a42054 RC_Channel_Aux: Add new landing gear control to Aux_servo_function_t enum.
Conflicts:
	libraries/RC_Channel/RC_Channel_aux.h
2015-01-07 11:58:17 +09:00
Andrew Tridgell 86bf02d64c RC_Channel: update example sketch to copy input to output 2014-12-02 16:27:33 +11:00
Kirill A. Kornilov 33e4f44434 RC_Channel: added set_radio_trimmed()
take into account trim value in set_radio()
2014-11-25 08:19:27 +11:00
Randy Mackay 73f3b50e2f RC_Channel: make get_control_mid const 2014-11-17 18:16:12 -08:00
Jonathan Challinger 9375fc8947 RC_Channel: add get_control_mid function 2014-11-17 18:16:09 -08:00
Jonathan Challinger 4d7988b302 RC_Channel: replace long with int32_t 2014-11-17 18:16:08 -08:00
Andrew Tridgell 6b0c15b70f RC_Channel: added norm_input_dz()
normalised input, taking into account dead zone
2014-11-18 12:44:05 +11:00
Andrew Tridgell 2270a904ce RC_Channel: make flaperson range from -4500 to 4500 2014-11-14 11:23:52 +11:00
Andrew Tridgell 16fd113020 RC_Channel: added channel_function()
this is used in the plane mixing code
2014-11-07 10:39:07 +11:00
Randy Mackay 79f95efb71 RC_Channel_aux: add epm to servo function enum 2014-09-17 21:13:30 +09:00
Andrew Tridgell e1a13edf3d RC_Channel: fixed example build 2014-08-13 22:12:30 +10:00
Andrew Tridgell 2e5913df93 RC_Channel: fixed k_manual for set_servo_limit()
this allows for failsafe takeover of k_manual channels, which fixes
the behaviour for ignition failsafe
2014-08-09 22:50:14 +10:00
Andrew Tridgell 0d4985079e RC_Channel: added support for LimitValue settings
this allows you to set a channel failsafe or radio_out to a limit
value
2014-04-21 11:52:41 +10:00
Andrew Tridgell 7f4178d967 RC_Channel: added setup_failsafe_trim_all() function
sets all channels to output trim values on FMU failure
2014-04-21 08:37:24 +10:00
Randy Mackay 8600b9d4f1 RC_Channel: add parachute_release to function enum 2014-04-07 13:36:33 +09:00
Andrew Tridgell 11f196318e RC_Channel: added static functions to simplify operations on all channels
this avoids vehicle code having to loop over all channels for common
operations
2014-04-03 12:18:56 +11:00
Andrew Tridgell 8c0c9c317e RC_Channel: prevent a numerical exception with bad mount parameters 2014-03-26 17:38:27 +11:00
Andrew Tridgell 6039eab442 RC_Channel: support up to 12 aux channels on PX4
this allows RC13 and RC14 to work correctly as aux outputs on Pixhawk
2014-03-25 15:42:48 +11:00
Andrew Tridgell 68462025ba RC_Channel: constrain norm_input() to -1 to 1
if RC is not properly calibrated we could get a value beyond 1, which
could cause some flight modes to exceed the roll/pitch limits of the
aircraft
2014-03-15 20:43:13 +11:00
Andrew Tridgell dd502e98b4 RC_Channel: added support for separate wheel steering channels on planes 2014-03-05 12:57:50 +11:00