Commit Graph

11324 Commits

Author SHA1 Message Date
Ricardo de Almeida Gonzaga 2802775e7d AP_Motors: Fix typos 2016-05-13 19:20:06 -03:00
Ricardo de Almeida Gonzaga dfe38b61de AP_Mission: Fix typos 2016-05-13 19:20:06 -03:00
Ricardo de Almeida Gonzaga 91e9dd10ba AP_HAL_SITL: Fix typos 2016-05-13 19:20:06 -03:00
Ricardo de Almeida Gonzaga eb418f54ee AP_HAL: Fix typos 2016-05-13 19:20:06 -03:00
Ricardo de Almeida Gonzaga aa4b66509f AP_AccelCal: Fix typos 2016-05-13 19:20:06 -03:00
Ricardo de Almeida Gonzaga fcbed13533 AP_Mount: Fix typos 2016-05-13 19:20:06 -03:00
Ricardo de Almeida Gonzaga af13e2cca4 AP_Declination: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga e6564c2efa AP_BoardConfig: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga 2e58653983 AP_Compass: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga 5237c86bca AP_BattMonitor: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga d5a2c57c5e AP_InertialSensor: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga 08a022fa6a AP_Frsky_Telem: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga 8d6cc587c5 APM_Control: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga 3033c53834 AC_WPNav: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga a8889e5765 AP_Common: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga f6ad89103c AP_Arming: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga 3f92a64b99 GCS_MAVLink: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga e31a37e7a8 AP_Notify: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga 287eb69502 PID: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga dc7acdf03f DataFlash: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga 2ee6a85e67 AP_RangeFinder: Fix typos 2016-05-13 19:20:05 -03:00
Ricardo de Almeida Gonzaga 099fc69032 RC_Channel: Fix typos 2016-05-13 19:20:05 -03:00
Lucas De Marchi 388a6683ad AP_OpticalFlow: fix optical flow initialization
This fixes the initialization for Linux boards using the PX4Flow module.
The problem is that after the conversion to use I2CDevice we now need to
use I2CDeviceManager, which is statically constructed after the vehicle
object.

So, if we try to call hal.i2c_mgr->get_device(), it will call the
get_device() method before the constructor is called and receive a
SIGSEGV:

Program received signal SIGSEGV, Segmentation fault.
0x000b06c0 in OpticalFlow::OpticalFlow (this=0x140914 <copter+4980>, ahrs=...)
    at ../../libraries/AP_OpticalFlow/OpticalFlow.cpp:54
54      ../../libraries/AP_OpticalFlow/OpticalFlow.cpp: No such file or directory.
2016-05-13 11:22:12 -03:00
Lucas De Marchi 37f6b51746 AP_HAL_Linux: Scheduler: set stack sizes to 256k
Running the vehicles we check the stack size doesn't grow too much by
enabling the DEBUG_STACK in the scheduler. Even on 64bit boards the
stack is consistent around 4k. Just to be a little conservative, let it
be a little bit more that that: 256kB.

Since we have RT prio and we call mlock(), the memory for the stack of
each thread is locked in memory. This means we are effectively taking
that much memory. The default stack size varies per distro, but it's
common to have 8MB for 64 bit boards and 4MB for 32 bit boards. Here is
the output of ps -L -o 'comm,rtprio,rss $(pidof arducopter-quad)', showing the
RSS of arducopter-quad before and after this change:

Before:
	COMMAND         RTPRIO   RSS
	arducopter-quad     12 46960
	sched-timer         15 46960
	sched-uart          14 46960
	sched-rcin          13 46960
	sched-tonealarm     11 46960
	sched-io            10 46960

After:
	COMMAND         RTPRIO   RSS
	arducopter-quad     12  7320
	sched-timer         15  7320
	sched-uart          14  7320
	sched-rcin          13  7320
	sched-tonealarm     11  7320
	sched-io            10  7320
2016-05-12 13:35:23 -03:00
Lucas De Marchi b2d4da4b0a AP_HAL_Linux: Thread: allow to set stack size
This allows the code that is creating the thread to set the size of the
stack.
2016-05-12 13:35:23 -03:00
Lucas De Marchi d970451331 AP_HAL_Linux: Scheduler: debug stack usage 2016-05-12 13:35:23 -03:00
Lucas De Marchi f5f4aa7c21 AP_HAL_Linux: Thread: allow to debug stack usage 2016-05-12 13:35:23 -03:00
proficnc 20a569a4d5 AP_Mount: block forwarding of MAVlink by bitmask 2016-05-12 17:44:09 +10:00
proficnc c8b3c527f9 GCS_MAVLink: add route mask for blocking MAVlink forwading 2016-05-12 17:44:06 +10:00
Andrew Tridgell 9bf0ada875 AC_AttitudeControl: removed use of AFF for tail control in heli 2016-05-12 17:37:22 +10:00
Andrew Tridgell a6404cf1ea AC_PID: removed AFF from heli PID
this is not used any more. Discussed with Rob on dev call
2016-05-12 17:37:01 +10:00
Andrew Tridgell cf08c46f30 AC_PID: fixed default leak min for heli 2016-05-12 17:34:23 +10:00
Lucas De Marchi aa974399d0 AP_Math: use inline wrappers for constrain_* functions
This avoids some warnings about "constrain_float defined but not used"
in some compilers.
2016-05-11 22:51:19 -03:00
Vinicius Juvinski 3bae8373e6 AP_Notify: play vehicle lost tone 2016-05-11 22:49:52 -03:00
Vinicius Juvinski c1dd3cb921 AP_Notify: add support for for Buzzer on BBBMini
Use GPIO P8_31 for buzzer in BBBMini
2016-05-11 22:49:52 -03:00
Peter Barker 7510e4d0a7 SITL: setsid() when starting JSBSim so Ctrl-C doesn't kill it in GDB 2016-05-11 14:10:48 +10:00
Andrew Tridgell eeef28be5e AP_HAL_PX4: fixed hexacopter on Pixracer
the _servo_count was 4 as we didn't re-fetch the count after applying
changes in AP_BoardConfig from BRD_PWM_COUNT
2016-05-11 13:01:15 +10:00
Andrew Tridgell 8a7627474f Revert "AP_HAL_PX4: use new I2CDevice interface"
This reverts commit f767918e0e.

These commits broke startup on PX4
2016-05-11 12:19:00 +10:00
Andrew Tridgell 8c06e6cddc Revert "AP_HAL_PX4: embed PX4_I2C object into I2CDevice"
This reverts commit 54fd3702c3.

These commits broke startup on PX4
2016-05-11 12:18:45 +10:00
Staroselskii Georgii a2ae662b3e AP_Compass: add an extra rotation for internal LSM9DS1 on Navio2
In order not to force users to set rotation themselves, we need this
hack to make an extra rotation needed for a second compass.
2016-05-10 17:24:43 -03:00
Staroselskii Georgii 2e5cfc2849 AP_Compass: added external compass autodetection on Navio 2016-05-10 17:24:43 -03:00
Staroselskii Georgii 62f2695e83 AP_Compass: added several compasses' autodetection on Navio 2 2016-05-10 17:24:43 -03:00
Staroselskii Georgii 8be5ef1642 AP_HAL: added possibility to use several compassed on Navio 2 2016-05-10 17:24:43 -03:00
Staroselskii Georgii 71736a0ecc AP_Compass: enable LSM9DS1 magnetometer for boards without default one 2016-05-10 17:24:43 -03:00
Staroselskii Georgii f7846403e1 AP_HAL_Linux: enabled SPI-driven LSM9DS1 for Navio 2 2016-05-10 17:24:43 -03:00
Staroselskii Georgii b677f975e7 AP_Compass: added LSM9DS1 magnetometer support 2016-05-10 17:24:43 -03:00
Andrew Tridgell 88b910c13d SITL: changed firefly motors to be suitable for a pixhawk
get channel groupings right
2016-05-11 05:55:25 +10:00
Andrew Tridgell 3e1cad5df2 SITL: adjust tricopter so default yaw servo values will work 2016-05-11 05:55:24 +10:00
Andrew Tridgell 48ca1a8d92 SITL: increase the mass of the plane to 2kg
less wafty in the air
2016-05-11 05:55:24 +10:00
Andrew Tridgell 9c90709872 SITL: fixed namespace of SITL classes 2016-05-11 05:55:23 +10:00
Andrew Tridgell 91abc636f4 SITL: fixed quadplanes with elevons 2016-05-11 05:55:23 +10:00
Andrew Tridgell a41ffc176c RC_Channel: added motor tilt auxillary channel 2016-05-11 05:55:23 +10:00
Andrew Tridgell 2d47ca8095 SITL: fixed moment of rotated motors 2016-05-11 05:55:23 +10: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
Andrew Tridgell bd8cd71745 SITL: fixed fwd motor angles for tri and y6 frames
should be 60 degrees to have motors evenly spaced around frame for
equal lift per motor when level
2016-05-11 05:55:23 +10:00
Andrew Tridgell 125a9feb3d SITL: added tilttri frame type
tiltrotor tricopter
2016-05-11 05:55:22 +10:00
Lucas De Marchi 68ae619448 AP_Compass: detect compasses for minlure
Minlure has an onboard compass (HMC5883L) as slave of MPU-6000, but also
allows the use of an external HMC5883L compass, which should be
connected to the lure's I2C port.
2016-05-10 16:08:39 -03:00
Lucas De Marchi 424434e31e AP_HAL: allow to build without HAL_COMPASS_DEFAULT
Otherwise we need to change the ifdef chain adding HAL_COMPASS_<BOARD>
definitions.
2016-05-10 16:07:23 -03:00
Lucas De Marchi 3315f46800 AP_HAL_Linux: inline I2C bus options for minlure
We don't need all the comments in the array declaration and we can
inline its declaration in the function call. This makes it easier to
copy it to other places.
2016-05-10 16:06:53 -03:00
Gustavo Jose de Sousa 91246ad8af AP_Compass: HMC5843: apply HMC5883L "arrow" rotation only if external
That rotation is done because of the "arrow" pointing the sensor direction in
3DR GPS+Compass kit (which isn't natural to the sensor orientation, by the
way). Thus, do that rotation only for external HMC5883L compasses.
2016-05-10 16:05:29 -03:00
Gustavo Jose de Sousa 35cddc7af0 AP_Compass: HMC5843: move hardcoded rotation to before call to rotate_field()
That rotation is set for AP_COMPASS_TYPE_HMC5883L, because it's usually
the compass from 3DR GPS+Compass kit, which has an arrow pointing the
"correct" direction. That rotation should be done before rotate_field()
as it represents the "standard" position for the kit.

This patch also makes published values consistent with respect to rotation.
Before this, raw fields used in calibration were published with a
rotation different from the filtered field when _product_id is
AP_COMPASS_TYPE_HMC5883L.
2016-05-10 15:56:38 -03:00
Gustavo Jose de Sousa ad91a810b3 AP_Compass: Backend: add method is_external() 2016-05-10 15:55:58 -03:00
Gustavo Jose de Sousa 670b0071f9 AP_Compass: HMC5843: add parameter force_external to constructor
And to the detection probe() method. That way we don't need to use a board
`#ifdef` inside the class code.  Additionally, we make raspilot board use it.
2016-05-10 15:52:54 -03:00
Lucas De Marchi 54fd3702c3 AP_HAL_PX4: embed PX4_I2C object into I2CDevice
Otherwise we would destroy PX4_I2C object after returning from
I2CDeviceManager::get_device(). Since this implementation is very
simple, just make PX4_I2C as an internal class and embed it into the
I2CDevice object.
2016-05-10 15:39:24 -03:00
Luiz Ywata f767918e0e AP_HAL_PX4: use new I2CDevice interface 2016-05-10 15:12:30 -03:00
Lucas De Marchi 3c7d80a270 AP_Baro: BMP085: use a moving average of 10 samples in BMP085
Instead of depending on the frequency accumulate() is called, use
AverageIntegralFilter with 10 samples. The data obtained by BMP085 is
too noisy with any value of OVERSAMPLING so use twice the number of
samples as currently used. Besides that now we are sure there's always
10 samples used in the average.
2016-05-10 14:24:59 -03:00
Lucas De Marchi 18f1f8bea8 Filter: add AverageFilter variant to save current sum
When the the variable in which we are saving the current sum is of
integral type we can use a much more optimized apply() method: instead
of looping the entire number of samples adding them up, we always keep
the current sum in a member.  It also allows the caller to decide the
type it wants to use to get the average: this may be dictated by another
interface it uses or it may want to avoid the implicit truncate in the
return of apply().
2016-05-10 14:24:59 -03:00
Lucas De Marchi 8da5275b03 AP_Baro: BMP085: don't average temperature in BMP085
The temperature readings is not subject to white noise so there's no
point in averaging its reading. Moreover since for a normal 50Hz
accumulate() / 10Hz update() it would read temperature only once per
update(), it's pointless to keep averaging and introducing rounding
error.

The temperature doesn't need to be checked as frequent as pressure, too.
The datasheet even suggests on section 3.3, page 10 to enable standard
mode and read the temperature at 1Hz. Here we reduce it to 2Hz
(considering the accumulate() function being called at 50Hz).
2016-05-10 14:24:59 -03:00
Lucas De Marchi c5c52076ca AP_Baro: BMP085: rename private member 2016-05-10 14:24:58 -03:00
Lucas De Marchi e40b88aa70 AP_Baro: BMP085: use DigitalSource interface in BMP085
Use the DigitalSource interface rather than going through the "static"
interface hal.gpio provides
2016-05-10 14:24:58 -03:00
Lucas De Marchi 56fa1b6214 AP_Baro: BMP085: change oversampling in BMP085 without EOC
If we don't have EOC pin and assuming the accumulate() function is
called at 50Hz (or higher) we would take very few samples to accumulate
before the update is called. That's because since we have to wait 26ms
to get a sample and we calling accumulate() every 20ms, half of the
times it will return without getting anything.  So we will
be using 2 or 3 samples only to average.

If we don't have EOC, use OVERSAMPLING=2 which gives us more noise, but
that we can filter out by using measurements to average. When we have
EOC we don't need it because most of the time the conversion will take
less than 20ms: I'm getting 16ms on most of them while bench-testing.
2016-05-10 14:24:58 -03:00
Lucas De Marchi 37e2f6c52e AP_Baro: BMP085: allow to easily change oversampling in BMP085
This way it's possible to easily change it if a board requires.
2016-05-10 14:24:58 -03:00
Lucas De Marchi bd6e268122 AP_Math: fix coding style
- cleanup whitespace
  - function reorder
  - fix brace position
2016-05-10 11:41:26 -03:00
Lucas De Marchi 6f87195eb7 AP_L1_Control: remove tabs and trailing whitespaces 2016-05-10 11:41:26 -03:00
Lucas De Marchi 1dbffef7ea AP_Math: remove trailing whitespace on headers 2016-05-10 11:41:26 -03:00
Lucas De Marchi ab1fa4b435 AP_Math: reorganize headers
Sort and add pragma once where needed.
2016-05-10 11:41:26 -03:00
dgrat 6d3b491c02 AP_Math: Replace is_equal with a type safe template function
It makes sense to consider also other floating point types.
2016-05-10 11:41:26 -03:00
dgrat 503867b7dc AP_Math: Replace safe_sqrt() by template function 2016-05-10 11:41:26 -03:00
dgrat 5deb0e8e03 AP_Math: Replace safe_asin() by template function 2016-05-10 11:41:26 -03:00
Lucas De Marchi 846b4927ec AP_Math: use if/else chain instead of 2 ternary operators 2016-05-10 11:41:26 -03:00
dgrat 174f899a29 AP_Math: Replace the constrain_* functions by a single template
Besides being simpler this reduces ~4k in the binary size for PX4.
2016-05-10 11:41:26 -03:00
Lucas De Marchi 348b07609c AP_Math: remove macros from unit tests
Avoid warnings like:

[2130/2168] Compiling libraries/AP_Math/tests/test_math.cpp
../../libraries/AP_Math/tests/test_math.cpp: In member function ‘virtual void MathTest_IsZero_Test::TestBody()’:
../../libraries/AP_Math/tests/test_math.cpp:73:196: warning: converting ‘false’ to pointer type for argument 1 of ‘char
testing::internal::IsNullLiteralHelper(testing::internal::Secret*)’ [-Wconversion-null]
../../libraries/AP_Math/tests/test_math.cpp:74:199: warning: converting ‘false’ to pointer type for argument 1 of ‘char
testing::internal::IsNullLiteralHelper(testing::internal::Secret*)’ [-Wconversion-null]

Use EXPECT_TRUE() and EXPECT_FALSE() from gtest instead.
2016-05-10 11:41:26 -03: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
Lucas De Marchi 880f130670 AP_Math: fix loss of precision on float addition
When using wrap_180_cd() we are adding a small float (180 * 100) to a
possibly big number. This may lose float precision as illustrated by the
unit test failing:

    OUT: ../../libraries/AP_Math/tests/test_math.cpp:195: Failure
    OUT: Value of: wrap_180_cd(-3600000000.f)
    OUT:   Actual: -80
    OUT: Expected: 0.f
    OUT: Which is: 0
2016-05-10 11:41:26 -03:00
dgrat 76362caee0 AP_Math: Replace wrap_* functions with template versions 2016-05-10 11:41:26 -03:00
dgrat 49cfd6fd9b AP_Math: Add gtest support for some functions
These functions (or variants thereof) now have unit tests:

  - is_zero()
  - is_equal()
  - sq()
  - pythagorous()
  - constrain()
  - wrap_180()
  - wrap_360()

Some tests in wrap_180_cd are failing: -180 should be wrapped to 180,
not -180.
2016-05-10 11:41:26 -03:00
Lucas De Marchi ceea7540fd AP_Math: rename test file
This will be reused for more math tests.
2016-05-10 11:41:26 -03:00
skyscraper c0c8f1a5cc RC_Channel: RC_Channel refactor
Fix up RC_Channel examples.

Change direct access to data members
to access via member functions
2016-05-10 16:21:17 +10: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 12cf65baed AP_Tuning: 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:16 +10: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
skyscraper 8b9c96814b AP_Mount: 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
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
skyscraper ba9462d13d APM_OBC: 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
skyscraper d16659331f RC_Channel_aux: Rename static member functions
Further to refactor of RC_Channel class which included
adding get_xx set_xx methods, some methods names are now
in conflict with those in the derived RC_Channel_aux class.
To keep a uniform naming convention in RC_Channel where
functions are most used and most numerous, the offending
functions in RC_Channel__aux are renamed as follows

 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
skyscraper d9ab3baf84 RC_Channel: Refactor to make data members private
rename all public data members of RC_Channnels with
leading underscore and make all data members private.
Provide get_xx and set_xx methods for access

 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)

add function to save radio trim
(expression where c is an object of type RC_Channel)
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);
// other
c.min_max_configured() // return true if min and max are configured
c.save_radio_trim()    // save radio trim to eeprom
2016-05-10 16:21:15 +10:00
Gustavo Jose de Sousa b594b5a08b AP_Math: matrix_alg: disable FE_OVERFLOW in inverse4x4() for SITL
There are occasional overflows on the determinant calculation in inverse4x4()
when using calibration SITL model.
2016-05-10 16:16:37 +10:00
Gustavo Jose de Sousa a7543d369f AP_Math: matrix_alg: protect inverseixi() against overflow
Fail on inverse3x3() and inverse4x4() if there's float overflow during the
determinant calculation.
2016-05-10 16:16:37 +10:00
Gustavo Jose de Sousa 39f72610e2 AP_Math: quaternion: fix style
Remove trailing spaces and run astyle.
2016-05-10 16:16:37 +10:00