Commit Graph

24 Commits

Author SHA1 Message Date
Thomas Watson fa31a5e838 AP_ServoRelayEvents: allow mavlink command of rcin scaled functions
Allow `MAV_CMD_DO_SET_SERVO` and `MAV_CMD_DO_REPEAT_SERVO` to be used on
a servo output set to an RCINnScaled function (i.e. k_rcinN_mapped).

Scaling is applied so that a commanded servo PWM of <=1000 maps to
SERVOn_MIN, a PWM of 1500 maps to SERVOn_TRIM, and a PWM of >=2000 maps to
SERVOn_MAX. Linear interpolation is performed between ranges.
2023-10-17 10:32:39 +11:00
Peter Barker e092d4be44 AP_ServoRelayEvents: allow more libraries to compile with no HAL_GCS_ENABLED 2023-09-05 22:23:51 +10:00
Peter Barker 27c3f8525d AP_ServoRelayEvents: add option to disable relay and servorelay libraries 2023-06-20 09:36:39 +10:00
jackhong12 4a4f361a17 all: use CLASS_NO_COPY() macro 2022-10-04 11:23:04 +11:00
Randy Mackay d40862de9c AP_ServoRelayEvents: do-set-servo affects sprayer and gripper 2020-02-11 11:08:02 +11:00
Peter Barker c515d17a4a AP_ServoRelayEvents: use Relay singleton 2019-07-03 23:59:24 -07:00
Randy Mackay fb284ff26a AP_ServoRelayEvents: minor formatting fix 2019-06-13 09:51:21 +09:00
Tatsuya Yamaguchi 012fcae388 AP_ServoRelayEvents: allow DO_SET_SERVO commands while rc pass-thru 2019-06-13 09:51:21 +09:00
Michael du Breuil 588d1898cd AP_ServoRelayEvents: More robust check if a channel is available 2018-08-20 21:31:06 -07:00
Peter Barker 544ac03ca6 AP_ServoRelayEvents: add singleton 2018-04-18 20:31:55 +09:00
Andrew Tridgell 1cdbb09466 AP_ServoRelayEvents: 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
Lucas De Marchi df29015533 AP_ServoRelayEvents: add static create method 2017-09-26 03:01:21 +01:00
Jacob Walser 98b7dac870 AP_ServoRelayEvents: Remove constraint on 'channel' value
This was preventing proper function of Relay #0, and the intention of
this check was redundant
2017-04-04 09:14:07 +10:00
Andrew Tridgell 2ef6473816 AP_ServoRelayEvents: fix do_set_servo
this was broken by the recent SRV_Channels changes

thanks to Jacob for noticing this!
2017-03-15 12:36:48 +11:00
Andrew Tridgell c133b515e0 AP_ServoRelayEvents: fixed trim bug
thanks to Buzz for noticing!
2017-01-12 17:39:37 +11:00
Andrew Tridgell f73f3bedda AP_ServoRelayEvents: adapt to new RC_Channel API 2017-01-12 17:39:37 +11: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
skyscraper c4aa55a6d9 AP_ServoRelayEvents: Fix up after RC_Channels refactor
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:15 +10:00
Lucas De Marchi 9c28730815 AP_ServoRelayEvents: replace header guard with pragma once 2016-03-16 18:40:43 +11:00
Caio Marcelo de Oliveira Filho 7c9a5dc1b9 AP_ServoRelayEvents: use millis/micros/panic functions 2015-11-20 12:34:39 +09:00
Gustavo Jose de Sousa c7d8682969 AP_ServoRelayEvents: 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:23 +10:00
Randy Mackay 46369badb3 ServoRelayEvents: init members to resolve compiler warning 2014-08-14 11:27:35 +09:00
Andrew Tridgell 264c092aa6 AP_ServoRelayEvents: fixed disabling repeated events on set_servo() 2014-02-06 10:03:26 +11:00
Andrew Tridgell 67aab44566 AP_ServoRelayEvents: library for handling servo and relay events 2014-01-20 17:06:29 +11:00