Commit Graph

36 Commits

Author SHA1 Message Date
Andrew Tridgell 5614fd1ccc Plane: use calloc in preferance to malloc 2018-01-17 11:22:05 +11:00
Andrew Tridgell 3d16ca7144 Plane: fixed MANUAL_RCMASK
ensure it only applies in MANUAL, and fixed input scaling in px4io
2017-09-19 17:05:56 +10:00
Andrew Tridgell 9b16836da5 Plane: cope better with more RC trim/min/max values
when min > trim we need to do RC scaling via rc_config. This loses the
ability to go beyond RC limits, but that can be coped with using
MANUAL_RCMASK
2017-08-01 08:25:32 +10:00
Andrew Tridgell 99df31f6ec Plane: fixes from review
thanks Francisco
2017-08-01 08:25:32 +10:00
Andrew Tridgell ea1a4bc176 Plane: improve px4_mixer handling of servo trim/min/max 2017-08-01 08:25:32 +10:00
Andrew Tridgell cff692ca48 Plane: implement MANUAL_RCMASK
this replaces the functionality of the old "with input"
aileron/elevator functions, but in a much more flexible way. It means
that people who want to fly in MANAUL mode will have the ability to
have full control of trims and mixing using transmitter mixers if they
need that functionality
2017-08-01 08:25:32 +10:00
Andrew Tridgell 5d91e29cea Plane: fixed px4_mixer for new function based mixing
this fixes the OVERRIDE_CHAN functionality to work correctly with the
new function based mixing code

It isn't a perfect match for ArduPilot mixing, but it is very close
for the key control surfaces, including mixed surfaces
2017-08-01 08:25:32 +10:00
Andrew Tridgell 2cb511c049 Plane: deprecate old aileron_with_input and elevator_with_input
these have very rarely been used and don't work well with new trimming
mechanisms. Now treat them as ordinary ailerons/elevators
2017-07-03 11:17:42 +10:00
Andrew Tridgell c9e4423997 Plane: re-implement flaperons
implement as scaled output instead of PWM output

this will break some peoples setups, but gives much easier setup and
more consistent behaviour
2017-07-03 11:17:42 +10:00
Randy Mackay f7e830cfad Plane: pixhawk mixer supports motors 9 to 12 2017-05-27 14:21:13 +09:00
murata 2492b9db7e Plane: Unify from print or println to printf. 2017-01-27 18:20:22 +11:00
Andrew Tridgell b83f50be0f Plane: use new SRV_Channels API 2017-01-12 17:39:37 +11:00
murata 0ee8edc29d Plane: Change from printf statement to print, println statement. 2016-11-25 15:57:15 -08:00
murata ab99ea54eb Plane: To nullptr from NULL. 2016-10-29 10:32:05 -03: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 9b83781b4f Plane: fixed mixer arming error with FMUv4
thanks to Tim Gold for reporting this
2016-09-11 08:25:40 +10:00
Michael du Breuil d0da7411b2 Plane: Fetch mixer status for assessing mixer success 2016-09-06 08:42:16 +10:00
Andrew Tridgell b357a254f6 Plane: use force_safety_no_wait() when re-enabling safety off in mixer 2016-08-16 12:53:34 +10:00
Andrew Tridgell 76b6cbbda1 Plane: prevent motor startup on reboot in quadplanes
we need to prevent RC overrides within px4io from running
2016-08-16 12:53:34 +10:00
Michael du Breuil 037a7980d6 Plane: fix calculation of override PWM 2016-06-06 16:23:43 -07:00
Andrew Tridgell 5a544002cb Plane: fixed memory leak in mixer setup 2016-06-06 15:21:17 +10:00
Michael du Breuil bb9086b87f Plane: setup mixer in the one second loop when disarmed 2016-06-06 15:17:37 +10:00
Andrew Tridgell c54d553df1 Plane: prevent continually loading the mixer 2016-06-06 15:14:28 +10:00
Michael du Breuil 7f73da535a Plane: if setting a mixer fails then clear the last crc so that it will be attempted again 2016-06-06 07:50:43 +10:00
Tom Pittenger e3930b45df Plane: force the safety_state immediately because we want it to be in effect while we make mixer changes 2016-05-27 21:34:40 +10:00
Tom Pittenger 4785650c95 Plane: remove redundant calls to safety_state 2016-05-27 21:34:40 +10:00
Andrew Tridgell 9f47e6417b Plane: always build with MAVLink2 headers 2016-05-21 15:25:16 +10:00
Andrew Tridgell 309dbef2ec Plane: fixed mavlink1 dependency on px4 2016-05-21 15:25:15 +10:00
Ricardo de Almeida Gonzaga 1fad971851 ArduPlane: Fix typos 2016-05-13 19:20:07 -03:00
skyscraper 7f29903287 ArduPlane: Fix up after refactoring RC_Channel class
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:16 +10:00
Michael du Breuil bcc939930c Plane: Only resend the mixer configuration if its changed 2016-01-29 12:20:14 +11:00
Andrew Tridgell d43d070e75 Plane: ensure throttle reverse is obeyed in all states
need to use radio_max for failsafe if reversed
2015-09-14 09:42:20 +10:00
Andrew Tridgell 4aac2c5c96 Plane: trigger OVERRIDE_CHAN in px4io
setup the MODESWITCH channel as our OVERRIDE_CHAN, allowing for
instant manual passthru in px4io when OVERRIDE_CHAN goes above 1750

This makes for faster switching, and avoids bugs where a still enabled
FMU channel disables override
2015-06-21 18:19:16 +10:00
Andrew Tridgell 3e74b82bc4 Plane: fixed two bugs in px4io override code
First bug is going via microSD to poulate mixer. We can't rely on the
microSD being writeable or functioning properly. Instead create the
buffer in memory and only write a copy to the filesystem.

Second bug is related to extreme trim values on channels. If trim
values are well out of range then the mixer fails and override fails.
2015-06-02 21:48:18 +10:00
Andrew Tridgell 1520d8f734 Plane: catch a px4_mixer failure case 2015-05-30 11:17:56 +10:00
Andrew Tridgell 18c37935c9 Plane: convert from .pde to .cpp files 2015-05-21 07:48:52 +10:00