Commit Graph

649 Commits

Author SHA1 Message Date
Andrew Tridgell 4e5e301c4e AP_Motors: fixed servo constructor for heli 2016-05-26 16:41:06 +10:00
Andrew Tridgell f9fb098222 AP_Motors: fixed channel output for SingleCopter 2016-05-26 16:26:43 +10:00
Andrew Tridgell 65eb9ceb32 AP_Motors: expose min/max pwm 2016-05-26 14:33:57 +10:00
Andrew Tridgell a44b0e0011 AP_Motors: don't setup oneshot for a zero output mask 2016-05-26 12:18:49 +10:00
Fredrik Hedberg 75d5c87788 AP_Motors: Fix setpoint bug with 0~1 conversion in AP_MotorsHeli 2016-05-25 09:27:40 +09:00
Randy Mackay 8d1f50e78f AP_Motors: rename get_pwm_min to get_pwm_output_min 2016-05-24 10:00:25 +09:00
Randy Mackay 0c225cf498 AP_MotorsMulticopter: fix typo in comments 2016-05-24 10:00:25 +09:00
Randy Mackay ff93524ba4 AP_Motors: rename MOT_THST_MAX to MOT_SPIN_MAX
Also renamed:
MOT_THST_BAT_MIN,MAX to MOT_BAT_VOLT_MIN,MAX
MOT_CURR_MAX to MOT_BAT_CURR_MAX
2016-05-24 10:00:25 +09:00
Randy Mackay f1cbdbe914 AP_Motors: update some comments 2016-05-24 10:00:25 +09:00
Randy Mackay 49b14b3cb6 AP_Motors: add PWM_MIN, MAX
These parameters allow the motor PWM output range to be different from receiver's throttle input range
Also renamed throttle_pass_through to set_throttle_passthrough_for_esc_calibration and change the method's input to the 0 to 1 range instead of direct PWM value
2016-05-24 10:00:25 +09:00
Ricardo de Almeida Gonzaga 2802775e7d AP_Motors: Fix typos 2016-05-13 19:20:06 -03:00
Andrew Tridgell 60b3625950 AP_Motors: added hook for vehicle based thrust compensation
allow vehicle code to compensate for thrust effectiveness changes due
to properties outside the scope of AP_Motors. This allows for
compensation in tiltrotors and tiltwings.
2016-05-11 05:55:23 +10:00
Andrew Tridgell 37d6b5fdaf AP_Motors: added output_motor_mask()
this will be used for tiltrotors in forward flight
2016-05-11 05:55:23 +10:00
dgrat 41661f815f AP_Math: Replace the pythagorous* functions with a variadic template
The new function can deal with a variable number of function parameters.
Additionally, I renamed the functions to norm(), because this is the
standard name used in several other projects.
2016-05-10 11:41:26 -03:00
skyscraper de5130fa13 AP_Motors: RC_Channel refactor
More fixing up of RC_Channel change access to
data members to functions
2016-05-10 16:21:16 +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
Andrew Tridgell ff96085bd3 AP_Motors: allow arbitrary motor mapping with tricopters 2016-04-28 22:36:41 +10:00
Randy Mackay 7af9892bd1 AP_MotorsMatrix: make const a float
resolves compiler warning
2016-04-23 23:06:25 -07: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 8d77bdec15 AP_MotorsMulti: minor comment fix 2016-04-14 05:45:24 +09:00
Randy Mackay f6eabfdab2 AP_MotorsMulticopter: formatting fixes 2016-04-01 11:59:30 +09:00
Randy Mackay 6807b961e2 AP_MotorsMulticopter: protect against div-by-zero if MOT_SPIN_ARMED is zero 2016-04-01 11:59:30 +09:00
Randy Mackay b39798ad90 AP_Motors: remove unused DESIRED_SPIN_MIN_THROTTLE 2016-04-01 11:59:30 +09:00
Randy Mackay dc86e1472c AP_MotorsTri: protect against div-by-zero if MOT_YAW_SV_ANGLE param was set to 90 2016-04-01 11:59:30 +09:00
Randy Mackay 9b5b6f3779 AP_MotorsHeli: constrain filtered throttle
This is required because we have removed the constraint on the throttle input.  This also insures that there is no lag caused by the filtered throttle straying far outside the 0 to 1 range
2016-04-01 11:59:30 +09:00
Randy Mackay b4a61e6ccf AP_Motors: remove constrain on throttle input
This constraint is redundant because we already constrain the filtered throttle
2016-04-01 11:59:30 +09:00
Leonard Hall fce426409e AP_MotorsTri: fix stab patch 2016-04-01 11:59:30 +09:00
Randy Mackay 49562c5ca3 AP_MotorsMulticopter: reduce num bits used for spool-up-down-mode 2016-04-01 11:59:30 +09:00
Randy Mackay 3ee88fd8c7 AP_MotorsCoax: remove output_min
This is now implemented by parent AP_MotorsMulticopter
2016-04-01 11:59:30 +09:00
Randy Mackay 8566a61660 AP_MotorsSingle: remove output_min
This is now implemented by parent AP_MotorsMulticopter
2016-04-01 11:59:30 +09:00
Randy Mackay 8621774040 AP_MotorsTri: remove output_min
This is now implemented by parent AP_MotorsMulticopter
2016-04-01 11:59:30 +09:00
Randy Mackay f4d94806e5 AP_MotorsMatrix: remove output_min
This is now implemented by parent AP_MotorsMulticopter
2016-04-01 11:59:30 +09:00
Randy Mackay b4b33db79b AP_MotorsMulticopter: promote output_min from Matrix class 2016-04-01 11:59:30 +09:00
Randy Mackay 2e8acf1f74 AP_MotorsHeli: calculate_scalars made protected
No functional change
2016-04-01 11:59:30 +09:00
Randy Mackay bc1b8f415a AP_Motors: example sketch output limit flags 2016-04-01 11:59:30 +09:00
Randy Mackay c9055ccdb1 AP_Motors: example sketch tests Single and Coax 2016-04-01 11:59:30 +09:00
Randy Mackay 41c55ffbe7 AP_MotorsTri: use YAW_SV_REV to reverse yaw output 2016-04-01 11:59:30 +09:00
Leonard Hall 13d727c2c6 AP_MotorsTri: add YAW_SV_ANGLE parameter to capture yaw servo lean angle max 2016-04-01 11:59:30 +09:00
Randy Mackay c939cc1551 AP_MotorsTri: clarify YAW_SV parameter descriptions and comments 2016-04-01 11:59:30 +09:00
Leonard Hall 267513d864 AP_MotorsTri: fixes to output_armed_stabilizing
Also minor comment fixes
2016-04-01 11:59:30 +09:00
Leonard Hall 250a444e57 AP_MotorsCoax: fixes to stab patch
Fix throttle_lower flag
Also some formatting changes
2016-04-01 11:59:30 +09:00
Randy Mackay 20565580ed AP_MotorsCoax: remove disabling of output ch7 2016-04-01 11:59:30 +09:00
Randy Mackay 63fefae7cf AP_MotorsCoax: use calc_pwm_output_1ot1 instead of local calc_pivot_radio_output 2016-04-01 11:59:30 +09:00
Leonard Hall 840e60c930 AP_MotorsSingle: fixes to stab patch
Fixes throttle_lower flag
Also some formatting changes
2016-04-01 11:59:30 +09:00
Randy Mackay af9b18329c AP_MotorsSingle: use calc_pwm_output_1to1 instead of local calc_pivot_radio_output 2016-04-01 11:59:30 +09:00
Randy Mackay c4b88aafef AP_MotorsHeli: swash and tail servo objects moved into class 2016-04-01 11:59:30 +09:00
Randy Mackay 4f1e62d551 AP_MotorsHeli: remove reset_radio_passthrough 2016-04-01 11:59:30 +09:00
Randy Mackay b5593431bf AP_MotorsHeli_Single: replace collective_mid_pwm with collective_mid_pct 2016-04-01 11:59:30 +09:00
Randy Mackay 9790245bf1 AP_MotorsHeli: replace collective_mid_pwm with collective_mid_pct 2016-04-01 11:59:30 +09:00
Randy Mackay a39bbc5421 AP_MotorsHeli: servo_test in range -1 to 1 2016-04-01 11:59:30 +09:00
Randy Mackay a42706bdcc AP_Motors: remove unused example sketch to test timing
This test was only important on the slower AVR boards
2016-04-01 11:59:30 +09:00
Randy Mackay a3450b712c AP_Motors: fix example sketch 2016-04-01 11:59:30 +09:00
Leonard Hall 753b72b28c AP_MotorsY6: call normalise_rpy_factors in motor setup 2016-04-01 11:59:30 +09:00
Leonard Hall 13ab3ecfea AP_MotorsQuad: call normalise_rpy_factors in motor setup 2016-04-01 11:59:30 +09:00
Leonard Hall 7ac4fc5569 AP_MotorsOctaQuad: call normalise_rpy_factors in motor setup 2016-04-01 11:59:30 +09:00
Leonard Hall e182c10625 AP_MotorsOcta: call noramlise_rpy_factors in motor setup 2016-04-01 11:59:30 +09:00
Leonard Hall 733b89cf3c AP_MotorsHexa: call noramlise_rpy_factors in motor setup 2016-04-01 11:59:30 +09:00
Leonard Hall 8f8eb7e214 AP_MotorsMatrix: add normalise_rpy_factors 2016-04-01 11:59:30 +09:00
Randy Mackay e7ba5ae451 AP_MotorsMulticopter: fix get_hover_throttle_as_high_end_pct 2016-04-01 11:59:30 +09:00
Randy Mackay 4514e8d100 AP_MotorsHeli: remove slow_start 2016-04-01 11:59:30 +09:00
Randy Mackay c41a5dc3bd AP_MotorsMulticopter: remove slow_start
This has been replaced with the spool logic feature
2016-04-01 11:59:30 +09:00
Randy Mackay b436dde60c AP_Motors: remove slow_start
This has been replaced with the spool logic feature
2016-04-01 11:59:30 +09:00
Randy Mackay e863f0b9c0 AP_MotorsHeli: use AP_Motors set_radio_passthrough in 0 to 1 range 2016-04-01 11:59:30 +09:00
Randy Mackay 68a6408a23 AP_MotorsMulticopter: remove set_radio_passthrough
This has been moved up to the AP_Motors class
2016-04-01 11:59:30 +09:00
Randy Mackay 5ba3a6c536 AP_Motors: add set_radio_passthrough 2016-04-01 11:59:30 +09:00
Randy Mackay fe4733121d AP_MotorsHeli_Single: ext_gyro_gain in 0 to 1 range 2016-04-01 11:59:30 +09:00
Randy Mackay e1e4e37c92 AP_MotorsHeli_Single: use RSC class's get_idle_output function
No functional change
2016-04-01 11:59:30 +09:00
Randy Mackay 2cdc5da226 AP_MotorsHeli_Single: rotor speed functions in 0 to 1 range 2016-04-01 11:59:30 +09:00
Randy Mackay 68945df45d AP_MotorsHeli_Single: write_aux uses 0 to 1 range 2016-04-01 11:59:30 +09:00
Randy Mackay b3334c3ae5 AP_MotorsHeli: rotor speed function in 0 to 1 range 2016-04-01 11:59:30 +09:00
Randy Mackay 832a226f13 AP_MotorsHeli_RSC: rotor speeds in 0 to 1 range
Also move recalc_scalers functionality into update_rotor_ramp and update_rotor_runup
2016-04-01 11:59:30 +09:00
Randy Mackay 4775843e3c AP_MotorsHeli_RSC: add get_idle_output accessor 2016-04-01 11:59:30 +09:00
Randy Mackay a63dba5b13 AP_MotorsHeli_Single: servo_test becomes protected 2016-04-01 11:59:30 +09:00
Randy Mackay cefd114964 AP_MotorsHeli_Single: remove unused accessors for tail_type, ext_gyro_gain, phase_angle 2016-04-01 11:59:30 +09:00
Randy Mackay f2fc39943e AP_MotorsHeli_Single: remove unused delta_phase_angle 2016-04-01 11:59:30 +09:00
Randy Mackay 381f538aca AP_HotorsHeli_Single: remove unused definition 2016-04-01 11:59:30 +09:00
Randy Mackay 27fed39671 AP_MotorsHeli_Single: remove roll_scalar, pitch_scalar 2016-04-01 11:59:30 +09:00
Randy Mackay 756236af35 AP_MotorsHeli: remove unused delta_phase_angle 2016-04-01 11:59:30 +09:00
Randy Mackay 16ac92be82 AP_MotorsHeli: remove unused definitions 2016-04-01 11:59:30 +09:00
Randy Mackay aeef6692cb AP_MotorsHeli: remove unused roll_scalar, pitch_scalar, collective_range 2016-04-01 11:59:30 +09:00
Randy Mackay 1a690772e1 AP_Motors: example sketch outputs headers 2016-04-01 11:59:30 +09:00
Randy Mackay 361b64f817 AP_Motors: example sketch uses AP_Motors set_desired_spool_state 2016-04-01 11:59:30 +09:00
Randy Mackay d4998089c8 AP_Motors: example sketch provides roll, pitch, yaw in -1 to +1 range 2016-04-01 11:59:30 +09:00
Randy Mackay 93597d152f AP_Motors: example sketch can test helicopter 2016-04-01 11:59:30 +09:00
Randy Mackay 47873c1d34 AP_MotorsHeli: fix RSC_SETPOINT param description 2016-04-01 11:59:30 +09:00
Randy Mackay bcbe6b279e AP_MotorsHeli: explicitely set ServoControlModes enum
Non functional change but this enum is tied to a parameter value so the exact value is important
2016-04-01 11:59:30 +09:00
Randy Mackay 8febcedf4b AP_MotorsHeli: remove unnecessary static declaration 2016-04-01 11:59:30 +09:00
Randy Mackay f022e504b0 AP_MotorsHeli: remove unused get_collective_mid and out methods 2016-04-01 11:59:30 +09:00
Randy Mackay a18722a2fc AP_MotorsHeli: output_min uses new move_actuators in -1 to +1 range 2016-04-01 11:59:30 +09:00
Randy Mackay 1197a439af AP_MotorsHeli: move_actuators to -1 to +1 range 2016-04-01 11:59:30 +09:00
Randy Mackay 8057d2fc58 AP_MotorsMatrix: remove unnecessary virtual declarations 2016-04-01 11:59:30 +09:00
Randy Mackay 71866be652 AP_MotorsHeliSingle: move_yaw in -1 to +1 range 2016-04-01 11:59:30 +09:00
Randy Mackay f6120b801b AP_MotorsHeliSingle: move_actuators in -1 to +1 range 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