Commit Graph

93 Commits

Author SHA1 Message Date
Randy Mackay 23f8227e36 AP_Motors: bug fix to save params on disarm
Previously was saving during arming  as well as disarming.
Thanks to OXINARF for finding this!
2016-06-18 11:55:49 +09:00
Randy Mackay a1b573ed0a AP_Motors: rename throttle_ave_max to throttle_avg_max 2016-06-18 11:55:49 +09:00
Randy Mackay 25778a24e2 AP_MotorsMulticopter: add HOVER_LEARN param 2016-06-18 11:55:49 +09:00
Leonard Hall 5a8fc6283e AP_Motors: replace throttle_rpy_mix with throttle_avg
AC_AttitudeControl now calculates throttle vs attitude control
prioritisation and simply provides overall maximum throttle (aka
throttle_avg) to the motors library
2016-06-18 11:55:49 +09:00
Randy Mackay 72b86a3f99 AP_Motors: remove unused stabilizing flag
Also initialise some members to resolve converity warnings
2016-05-28 15:45:29 +09:00
Andrew Tridgell a44b0e0011 AP_Motors: don't setup oneshot for a zero output mask 2016-05-26 12:18:49 +10:00
skyscraper daec4ea10e AP_Motors: 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
Randy Mackay e41f798ba1 AP_Motors: remove unused set_stabilizing 2016-05-07 10:08:36 +09:00
Randy Mackay 72a7f674ec AP_Motors: protect against out-of-bounds memory access
resolves a compiler warning
2016-04-23 21:06:18 +10:00
Andrew Tridgell fd7c87e629 AP_Motors: allow enabling oneshot on a subset of motors 2016-04-22 13:24:04 +10:00
Andrew Tridgell f2c63e24c5 AP_Motors: allow tricopter motor 7 to be moved to any output 2016-04-22 08:32:03 +10:00
Andrew Tridgell 6df4d11d3f AP_Motors: ensure OneShot125 is within 125 to 250usec 2016-04-16 18:52:12 +10:00
Andrew Tridgell fe2065cd72 AP_Motors: rename MOT_PWM_MODE to MOT_PWM_TYPE
Randy prefers TYPE
2016-04-14 08:05:07 +10:00
Andrew Tridgell f54bcc6c7f AP_Motors: added oneshot support via MOT_PWM_MODE
MOT_PWM_MODE=0 is normal
MOT_PWM_MODE=1 is oneshot
MOT_PWM_MODE=2 is oneshot125
2016-04-14 08:05:05 +10:00
Randy Mackay 5ba3a6c536 AP_Motors: add set_radio_passthrough 2016-04-01 11:59:30 +09:00
Randy Mackay 61cf8e1698 AP_Motors: add calc_pwm_output_1to1 and 0to1
Convenience functions to convert from -1 to +1 input to pwm output
2016-04-01 11:59:30 +09:00
Leonard Hall ae4e495698 AP_Motors: roll, pitch, yaw input in -1 to +1 range 2016-04-01 11:59:30 +09:00
Leonard Hall 649a8c461d AP_Motors: remove unused throttle_radio_min, max
Moved to AP_MotorsMulticopter
2016-04-01 11:59:30 +09:00
Leonard Hall e84011603c AP_Motors: remove unused throttle_pwm_scalar, rpy_pwm_scalar 2016-04-01 11:59:30 +09:00
Leonard Hall 8e1351e474 AP_Motors: init member to resolve compiler warning 2016-04-01 11:59:30 +09:00
Leonard Hall ed51c7a28d AP_Motors: replace throttle_control_input with throttle_in
throttle_control_input was 0 to 1000 range, throttle_in is 0 to 1
2016-04-01 11:59:30 +09:00
Andrew Tridgell 7c9ee9363b AP_Motors: added rc_map_mask() function 2016-01-06 22:09:40 +11:00
Andrew Tridgell dfccf8f713 AP_Motors: also wrap set_freq and enable_ch for motor mapping 2016-01-06 22:09:40 +11:00
Andrew Tridgell 77af00c5e1 AP_Motors: allow arbitrary mapping of channels on multirotors
using RCn_FUNCTION with motor1, motor2 etc
2016-01-06 22:09:40 +11:00
Andrew Tridgell d31ba2b380 AP_Motors: added rc_write function
this is intended to make remapping motors and rescaling output easier
2016-01-04 16:56:54 +11:00
Lucas De Marchi d97d97dc54 AP_Motors: get rid of _motor_to_channel_map
This was only used for supporting APM1. The removal was mostly automatic
with:

    sed -i 's/pgm_read_byte(&_motor_to_channel_map\[\([^]]*\)\])/\1/g' libraries/AP_Motors/*.cpp
    sed -i 's/_motor_to_channel_map\[\([^]]*\)\]/\1/g' libraries/AP_Motors/*.cpp

And then remove references to MOTOR_TO_CHANNEL_MAP and
_motor_to_channel_map and make sure the variable used in shifts is
unsigned
2015-09-29 11:59:25 +09:00
Gustavo Jose de Sousa 1e619c6c59 AP_Motors: 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:19 +10:00
Leonard Hall 1a583c5382 AP_Motors: calc_roll_pwm based on throttle pwm range 2015-08-03 14:12:49 +09:00
Randy Mackay c9dedbd3b2 AP_Motors: remove multicopter only features
Also rename uses of Multirotor to Multicopter
2015-07-21 16:25:28 +09:00
Robert Lefebvre 61d6c5aa1d AP_Motors: Creation of AP_Motors_Multirotor class 2015-07-21 16:24:38 +09:00
Robert Lefebvre 11214b3414 AP_Motors: move constraints to set_throttle 2015-06-22 13:52:59 +09:00
Randy Mackay 2849430341 AP_Motors: init flags
resolves coverity issue
2015-06-08 14:46:16 +09:00
Randy Mackay 71e4bccecb AP_Motors: init members in constructor
Also add f to end of float constants
2015-05-25 22:13:41 +09:00
Robert Lefebvre b8181b6b90 AP_Motors: RCMAP fix
Remove all RC Input channels passed as reference into AP_Motors.  All input handling self-contained inside AP_Motors.
Rework Tricopter to use internal servo calcs.
2015-05-25 22:13:32 +09:00
Jonathan Challinger 28731d2bdc AP_Motors: add throttle filter input constraint from -100 to 1100 2015-05-22 16:12:27 +09:00
Leonard Hall 0f894ac1a8 AP_Motors: Rename and move Throttle Mix / Comp 2015-05-08 14:14:17 +09:00
Robert Lefebvre 6bdace30d2 AP_Motors: Add throttle interlock functionality
AP_MotorsMatrix's output_armed_zero_throttle uses output_min default from base class
2015-05-01 14:30:24 +09:00
Randy Mackay bae1722946 AP_Motors: get_compensation_gain gets div-by-zero check 2015-04-29 14:36:22 +09:00
Jonathan Challinger 41ae7207c7 AP_Motors: scale roll/pitch/yaw gain for air density 2015-04-29 14:36:15 +09:00
Jonathan Challinger e2ba351149 AP_Motors: refactor apply_thrust_curve_and_volt_scaling 2015-04-29 14:36:12 +09:00
Tom Pittenger a5ffadf201 AP_Motors: fix compile warnings re float constants 2015-04-24 14:04:00 +09:00
Jonathan Challinger 4993fd4d71 AP_Motors: use new lowpass filter 2015-04-17 10:46:47 +09:00
Jonathan Challinger e80776f1f5 AP_Motors: remove MOT_THR_FILT parameter and add interface to configure filter 2015-04-16 21:00:01 +09:00
Jonathan Challinger 8e442675a7 AP_Motors: introduce set_stabilize(bool), specifies whether torque demands should be output 2015-04-16 20:59:40 +09:00
Jonathan Challinger a2c69fe90d AP_Motors: add optional motor output throttle filter 2015-04-16 20:59:31 +09:00
Leonard Hall 791fbcf9b3 AP_Motors_Class: time constants of throttle comp 2015-04-16 13:29:46 +09:00
Jonathan Challinger 1828515b3b AP_Motors: bug fix to _batt_voltage_filt 2015-04-01 10:15:06 -07:00
Randy Mackay 5e26450a6f AP_Motors: make THR_LOW_COMP a variable instead of param 2015-03-10 12:20:27 +09:00
Leonard Hall 007c96a3d8 AP_Motors: Low throttle compensation setters 2015-03-10 12:20:21 +09:00
Leonard Hall 6275ee0289 AP_Motors: Check for battery voltage reading fail 2015-03-10 12:20:19 +09:00