Commit Graph

119 Commits

Author SHA1 Message Date
Peter Barker 41ab59dcdb AP_Motors: eliminate flags structure
Saves about 44 bytes
2020-09-22 20:26:24 +10:00
Randy Mackay 2d8c5a7bc4 AP_Motors: remove names from cpp files 2020-07-14 13:27:07 +10:00
Gone4Dirt 98a4335af4 AP_Motors: Added support for autorotation 2019-11-29 08:06:10 +08:00
Leonard Hall 036b47ec56 AP_Motors: Add seperate roll and pitch limits 2019-08-03 12:06:32 +09:00
Leonard Hall 77f8ec9f43 AP_Motors: formatting fixes 2019-07-12 09:29:40 +09:00
Peter Barker 1e606cdc5b AP_Motors: make desired spool state and spool state enum-classes
This will help avoid getting the enumerations mixed up
2019-04-14 12:18:03 +09:00
Tom Pittenger 3bbd80a5de AP_Mount: unify singleton naming to _singleton and get_singleton() 2019-02-10 19:09:58 -07:00
bnsgeyer ac87b3e1e5 AP_Motors: spool state moved from multi to parent
Also rename SPIN_WHEN_ARMED to GROUND_IDLE
2019-01-15 11:41:44 +09:00
Leonard Hall 4774cb8daf AP_Motors: improved motor loss redundancy
This detects a failed motor on copters with at least 6 motors
and recalculates the mixer to compensate
2018-10-16 00:44:50 +09:00
Peter Barker 937d8dac97 AP_Motors: remove unneeded initialisations 2018-07-23 16:30:40 +09:00
bnsgeyer dec8c5de77 AP_Motors: convert heli code to use SRV_Channels
this converts the heli code to use the SRV_Channels output
functions. It does not change behaviour, but removes the last vehicle
type that did its own servo output calculations.  This change also
fixed servo initialization conflicts.

Note that this also allows helis to be setup with more than one
channel for a particular output (eg. two separate channels for tail
servo if they are wanted). This isn't likely to be used much, but does
make heli consistent with other vehicle types
2018-07-16 12:41:16 +10:00
Andrew Tridgell 4e414c02f5 AP_Motors: use scaled actuators for single and coax frames
this allows for multiple servos with the same motor function
2018-05-21 13:04:13 +10:00
Andrew Tridgell 819de4acd5 AP_Motors: don't scale oneshot125 in AP_Motors
handle it in the HAL backends, to allow for correct resolution
2018-04-07 09:10:29 +10:00
Andrew Tridgell 80a1688361 AP_Motors: make a singleton
this is used by AP_ESCSerial
2018-04-07 09:10:29 +10:00
Andrew Tridgell 2c84d77306 AP_Motors: setup for DShot output modes 2018-04-07 09:10:29 +10:00
Michael du Breuil 98e327640d AP_Motors: Use battery singleton 2018-03-27 22:12:21 +01:00
Andrew Tridgell 45d6f3bf75 AP_Motors: fixed motor channel handling 2017-10-25 11:39:11 +11:00
Andrew Tridgell 1e62b5d5c7 AP_Motors: many to one mapping of motors
this allows multiple outputs for one motor number
2017-10-22 15:52:50 +11:00
Andrew Tridgell 03e1f6967f AP_Motors: removed enable() API
all output channels are already enabled by SRC_Channels::enable_aux_servos()
2017-10-22 15:52:50 +11:00
Andrew Tridgell abd0831239 AP_Motors: changed BRUSHED16kHz to BRUSHED 2017-06-17 17:37:45 +10:00
Randy Mackay d00725b2ed AP_Motors: rc_write handles motors 9 to 12 2017-05-27 14:21:13 +09:00
Andrew Tridgell 638f1364be AP_Motors: adapt to new RC_Channel API 2017-01-12 17:39:37 +11:00
Randy Mackay ffa6d1a5b9 AP_Motors: init fixes for frame_class, type and initialised_ok
Thanks to OXINARF for spotting these
2016-12-31 10:55:23 +09:00
Randy Mackay 7be0f437a9 AP_Motors: consolidate matrix multicopters
AP_MOTORS_x_FRAME definitions moved to motor_frame_type enum
init function and now accepts frame-class and type to perform initial motor setup
set_frame_class_and_type allows real-time changing of motor setup
initialised_ok flag and accessor records whether setup was successful
2016-12-31 10:55:23 +09:00
Andrew Tridgell ce517384e1 AP_Motors: support MODE_PWM_BRUSHED16KHZ 2016-11-30 10:53:26 +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
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