Commit Graph

22181 Commits

Author SHA1 Message Date
Gustavo Jose de Sousa c7eb46fae2 AP_Math: AP_GeodesicGrid: optimize _from_neighbor_umbrella()
This is the second optimization. With that we don't have to iterate over the
umbrella's components.

The table below summarizes the mean CPU time in ns from the brenchmark results
on an Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz processor:

       | Naive implementation | First Optimization | Second Optimization
------------------------------------------------------------------------
Min.   |                 26.0 |              28.00 |                26.0
1st Qu.|                 78.0 |              48.75 |                39.0
Median |                132.0 |              57.00 |                41.0
Mean   |                130.1 |              61.20 |                41.6
3rd Qu.|                182.2 |              76.00 |                47.0
Max.   |                234.0 |              98.00 |                54.0
2016-05-16 19:08:36 -03:00
Gustavo Jose de Sousa eb90ef23a1 AP_Math: AP_GeodesicGrid: fix algorithm for null vector
If v is the null vector, then alpha * v is still the null vector for any alpha
as a real number. That means that the null vector doesn't cross any section.
2016-05-16 19:08:36 -03:00
Gustavo Jose de Sousa c28c3265c8 AP_Math: AP_GeodesicGrid: optimize with neighbor umbrellas
This is a first optimization of the algorithm. The struct for the neighbor
umbrella has only one member, but new members will be added in the next
optimization.

The table below summarizes the mean CPU time in ns from the brenchmark results
on an Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz processor:

Cases  | Naive implementation | First Optimization
--------------------------------------------------
Min.   |                 26.0 |              28.00
1st Qu.|                 78.0 |              48.75
Median |                132.0 |              57.00
Mean   |                130.1 |              61.20
3rd Qu.|                182.2 |              76.00
Max.   |                234.0 |              98.00

This optimization reduces the mean time for the worst case (Max. line) by more
than 50%.
2016-05-16 19:08:36 -03:00
Gustavo Jose de Sousa 0ff05b7af3 AP_Math: test_geodesic_grid: test triangles indexes
That helps figuring out which intermediate step failed the high level call.
2016-05-16 19:08:36 -03:00
Gustavo Jose de Sousa 4398e1e49b AP_Math: AP_GeodesicGrid: change order of triangles
- Change the order of the icosahedron triangles so that there's a uniform way of
finding the opposite triangle. The order visually still makes sense.

 - Change test to accommodate the order change.
2016-05-16 19:08:36 -03:00
Gustavo Jose de Sousa ea412ad629 AP_Math: benchmark_geodesic_grid: add benchmark
That will help to benchmark improvements on the section search algorithm.
2016-05-16 19:08:36 -03:00
Gustavo Jose de Sousa 797a2da031 AP_Math: test_geodesic_grid: test when inclusive=true 2016-05-16 19:08:36 -03:00
Gustavo Jose de Sousa b299261ad4 AP_Math: AP_GeodesicGrid: add first implementation
The search for the geodesic section is still naive in this version.
Additionally, add unit tests.
2016-05-16 19:08:35 -03:00
Gustavo Jose de Sousa 3f2ad764ca AP_Math: Matrix3: add inverse() and invert() functions
Additionally, add unit tests.
2016-05-16 19:08:35 -03:00
Gustavo Jose de Sousa 06eea2838f AP_Math: Matrix3: add det() function
Function to calculate determinant. Additionally, add unit tests.
2016-05-16 19:08:35 -03:00
Gustavo Jose de Sousa fe4aaaac95 tests: add macro for printing test parameter
Google Test allows to instantiate tests for a list of different values, which
are called parameters. A common use of that feature in Ardupilot will be that a
parameter will be represented by an object that will have the value to be
tested and information about that value. That information will basically map
the expected behavior of tests on the value stored by the parameter.

The macro added in this patch allows to easily print the value of a failed
test's parameter.
2016-05-16 19:08:35 -03:00
Gustavo Jose de Sousa 26959f1448 AP_Math: define golden ratio constant 2016-05-16 19:08:35 -03:00
dgrat 48c243bed0 ArduPlane: Do not use is_zero() for non-float types 2016-05-16 19:08:35 -03:00
dgrat 3bc97ae356 ArduCopter: Do not use is_zero() for non-float types
This function makes only sense for floating point types. However this
function was also used for ints.
2016-05-16 19:08:35 -03:00
dgrat f8540f1a80 AP_Compass: Do not use is_zero() for non-float types 2016-05-16 19:08:35 -03:00
dgrat 7ff8004f8f AP_Math: Replace is_zero() with a template function
This function only makes sense for floating point types. However this
function was also used for ints.
2016-05-16 19:08:35 -03:00
Tom Pittenger ebd993dabb AP_Arming: updated z-axis accel threshold comment 2016-05-16 13:46:17 -07:00
Lucas De Marchi 368a72044c APMrover2: fix indentation leading to compiler warning
GCC 6 has a new warning about misleading indentation:

../../APMrover2/system.cpp: In member function ‘void Rover::set_mode(mode)’:
../../APMrover2/system.cpp:272:5: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
     if (control_mode == AUTO)
     ^~
../../APMrover2/system.cpp:275:2: note: ...this statement, but the^Bn latter is misleadingly indented as if it is guarded by the ‘if’
  control_mode = mode;
  ^~~~~~~~~~~~

The issue here is that we are mixing tabs and spaces. Remove tabs and re-indent
the code.
2016-05-16 17:35:58 -03:00
Tom Pittenger 7af888633d Plane: 3of3 add loiter_xtrack option flag for post-loiter navigation
0 to crosstrack from center of waypoint, 1 to crosstrack from tangent exit location
2016-05-16 11:50:54 -07:00
Tom Pittenger 9073ac91ff AP_Mission: 2of3 add loiter_xtrack option flag for post-loiter navigation via param4
0 to crosstrack from center of waypoint, 1 to crosstrack from tangent exit location
2016-05-16 11:50:54 -07:00
Tom Pittenger 02eeb2d4f0 AP_Common: 1of3 add loiter_xtrack option flag for post-loiter navigation
0 to crosstrack from center of waypoint, 1 to crosstrack from tangent exit location
2016-05-16 11:50:53 -07:00
Gustavo Jose de Sousa 2246343ec7 AP_HAL_SITL: pass signed value to abs()
Passing an unsigned value to abs() causes compilation error in gcc 6.1.1
(and doing that doesn't make sense too).

As a bonus, this patch fixes the code, since, for two unsigned integers
a and b, such that a > b, (a - b) without the casting to a signed
integer would produce garbage in the context of this patch. The type
int32_t is enough for the cases covered by this patch.
2016-05-16 15:04:22 -03:00
Lucas De Marchi 421b9ef54a AP_Mount do not use flexible array in union
We actually don't want a flexible array in this union, but rather a way
to access it byte by byte. This fixes the build for gcc >= 6

In file included from ../../libraries/AP_GPS/AP_GPS_UBLOX.cpp:23:0:
../../libraries/AP_GPS/AP_GPS_UBLOX.h:387:23: error: flexible array member in union
         uint8_t bytes[];
                       ^
compilation terminated due to -Wfatal-errors.

In file included from ../../libraries/AP_Mount/AP_Mount.cpp:9:0:
../../libraries/AP_Mount/AP_Mount_Alexmos.h:291:23: error: flexible array member in union
         uint8_t bytes[];
                       ^
compilation terminated due to -Wfatal-errors.
2016-05-16 13:50:56 -03:00
Lucas De Marchi 39bd196481 AP_GPS: do not use flexible array in union
We actually don't want a flexible array in this union, but rather a way
to access it byte by byte. This fixes the build for gcc >= 6

In file included from ../../libraries/AP_GPS/AP_GPS.cpp:24:0:
../../libraries/AP_GPS/AP_GPS_ERB.h:93:23: error: flexible array member in union
         uint8_t bytes[];
                       ^
compilation terminated due to -Wfatal-errors.

In file included from ../../libraries/AP_GPS/AP_GPS_ERB.cpp:22:0:
../../libraries/AP_GPS/AP_GPS_ERB.h:93:23: error: flexible array member in union
         uint8_t bytes[];
                       ^
compilation terminated due to -Wfatal-errors.

In file included from ../../libraries/AP_GPS/AP_GPS_MTK.cpp:25:0:
../../libraries/AP_GPS/AP_GPS_MTK.h:75:23: error: flexible array member in union
         uint8_t bytes[];
                       ^
compilation terminated due to -Wfatal-errors.

In file included from ../../libraries/AP_GPS/AP_GPS_MTK19.cpp:26:0:
../../libraries/AP_GPS/AP_GPS_MTK.h:75:23: error: flexible array member in union
         uint8_t bytes[];
                       ^
compilation terminated due to -Wfatal-errors.

In file included from ../../libraries/AP_GPS/AP_GPS_SIRF.cpp:22:0:
../../libraries/AP_GPS/AP_GPS_SIRF.h:101:23: error: flexible array member in union
         uint8_t bytes[];
                       ^
compilation terminated due to -Wfatal-errors.

In file included from ../../libraries/AP_GPS/AP_GPS_UBLOX.cpp:23:0:
../../libraries/AP_GPS/AP_GPS_UBLOX.h:387:23: error: flexible array member in union
         uint8_t bytes[];
                       ^
compilation terminated due to -Wfatal-errors.
2016-05-16 13:50:39 -03:00
Gustavo Jose de Sousa d615628367 AP_HAL_Linux: I2CDevice: add missing stdio.h include
This was probably being included by another header, but it's not on
gcc >= 6.1 and glibc 2.23.
2016-05-16 13:12:53 -03:00
Peter Barker 8d5ceda534 AP_HAL_SITL: ensure specified SITL model is found
Without this check we get a null pointer exception the first time we attempt
to use the model object
2016-05-16 13:04:15 -03:00
Peter Barker 27e7c870ed Tools: remove absolute paths in run_in_terminal_window
Also add quotes to avoid ambiguous redirect issue
2016-05-16 19:39:37 +10:00
Andrew Tridgell 4116f80901 Replay: added --no-params option 2016-05-16 17:22:11 +10:00
Andrew Tridgell 8ec0e687db mk: don't make mavlink generation depend on CHECK_MODULES
this was causing a full rebuild every time, which is very annoying
when developing
2016-05-16 17:22:11 +10:00
Peter Barker 18e0131680 sim_vehicle.py: avoid requesting process name on zombie process
This method does on OSX - in a non-catchable way prior to Py3
2016-05-16 17:18:32 +10:00
Andrew Tridgell c6620b03b4 HAL_SITL: added --rtscts option to SITL
useful for radio testing
2016-05-16 16:51:26 +10:00
Peter Barker 38010cf3f3 sim_vehicle.py: wrap jsbsim version fetch in a try 2016-05-16 11:58:53 +10:00
Rustom Jehangir 39fc17f384 DataFlash: Fix parameter description for param_parse.py 2016-05-16 11:09:31 +10:00
Andrew Tridgell 848420648e PX4Firmware: submodule update
pwm_input resolution control
2016-05-14 18:05:46 +10:00
Andrew Tridgell 8571202199 AP_RPM: allow for low RPM measurements on PX4
this automatically adjusts the timer resolution to allow for low RPM
measurements on PX4
2016-05-14 18:05:13 +10:00
Tom Pittenger 78d6291e2c Plane: corrected land abort gcs msg 2016-05-13 17:22:13 -07:00
Tom Pittenger 38b7d7e1c6 DataFlash: log baro drift offset 2016-05-13 17:22:12 -07:00
Tom Pittenger f1f58e2026 AP_Baro: created baro drift offset accessor 2016-05-13 17:22:11 -07:00
Tom Pittenger 6c0579a895 Plane: for better helical landings allow for instant approach stage if previous nav cmd was LOITER_TO_ALT 2016-05-13 17:22:07 -07:00
Tom Pittenger f1186b8b5c AP_Mission: store previous nav cmd id 2016-05-13 17:22:03 -07:00
Tom Pittenger d900988a23 DataFlash: Log airspeed.Use 2016-05-13 17:22:02 -07:00
Tom Pittenger ba5b4e694c Plane: log NTUN:ArspdErr airspeed error (in meters) 2016-05-13 17:22:01 -07:00
Tom Pittenger 1551b9d881 Plane: remove redundant logging in NTUN 2016-05-13 17:22:00 -07:00
Tom Pittenger 8a58f5a5eb Plane: convert airspeed_error_cmd to airspeed_error (in meters) 2016-05-13 17:21:59 -07:00
Jonathan Challinger 0281b948df AP_Arming: loosen accelerometer consistency check on Z axis
Original author @jschall via 88f5d9f858
2016-05-13 17:16:12 -07:00
Tom Pittenger d55050e5e3 AP_Baro: slow down the LPF for slewing to a new GND_ALT_OFFSET
Instead of a couple seconds, make it about 15sec. This makes TECS happy by not glitching the height demand as much. When applied too fast the TECS height demand causes a large single oscillation as it chases the filter lag.
2016-05-13 17:15:53 -07:00
Tom Pittenger 37ee3b44d2 AP_Baro: add accessor for baro drift 2016-05-13 17:15:41 -07:00
Tom Pittenger 2e1eef7cf0 AP_Airspeed: airspeed healthy should also check if enabled 2016-05-13 17:14:55 -07:00
Tom Pittenger 25dfb583d5 Plane: adjust target_airspeed with and without airspeed sensor (pitot) 2016-05-13 17:14:47 -07:00
Andrew Tridgell 2a0476483b Plane: make takeoff less noisy with zero timeout 2016-05-14 08:26:10 +10:00