Commit Graph

100 Commits

Author SHA1 Message Date
Lucas De Marchi a096703b06 Global: don't link with AP_Progmem
AP_Progmem is not used anymore.
2015-12-27 15:58:12 -02:00
Robert Lefebvre 77877ba5fc ModeFilter: Add get() method and support for Float type 2015-12-08 08:25:18 +11:00
Tom Pittenger 4ee2fb6c7a Filter: compiler warnings - unused template <double> 2015-12-07 15:50:00 +09:00
Caio Marcelo de Oliveira Filho 6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11:00
Andrew Tridgell 5b7f2a3de3 Filter: added reset method on vector filters 2015-11-22 17:30:29 +11:00
Caio Marcelo de Oliveira Filho 51a6455ac0 Filter: use millis/micros/panic functions 2015-11-20 12:35:25 +09:00
Andrew Tridgell 3549c717db Filter: removed reference to old 'Desktop' build 2015-11-16 08:06:05 +11:00
Andrew Tridgell 8f4ce7f20b build: removed all nocore.inoflag files
these were APM2 specific
2015-11-16 08:05:17 +11:00
Andrew Tridgell a9372ad5d7 Filter: fixed example builds 2015-11-16 07:58:55 +11:00
Lucas De Marchi 825d10c81a Filter: remove filter with double type
We are currently not using LowPassFilter2p<double> and it just generates
a lot of warnings on PX4 while instantiating it due to implicitly
promoting float to double:

libraries/Filter/LowPassFilter2p.cpp: In instantiation of
	'T DigitalBiquadFilter<T>::apply(const T&, const DigitalBiquadFilter<T>::biquad_params&) [with T = double]':
libraries/Filter/LowPassFilter2p.cpp:86:41:   required from 'T LowPassFilter2p<T>::apply(const T&) [with T = double]'
libraries/Filter/LowPassFilter2p.cpp:98:16:   required from here
libraries/Filter/LowPassFilter2p.cpp:20:82: warning: implicit conversion from 'float' to 'double' to match other
	operand of binary expression [-Wdouble-promotion]
     T delay_element_0 = sample - _delay_element_1 * params.a1 - _delay_element_2 * params.a2;
                                                                                  ^
2015-11-10 12:43:21 +09:00
Caio Marcelo de Oliveira Filho d32207008d Filter: remove unnecessary includes from examples 2015-10-21 09:16:10 +11:00
Caio Marcelo de Oliveira Filho ec52df991c build: compile only the HAL files needed by the board
Instead of requiring every program to specify the HAL related modules,
let the build system do it (in practice everything we compiled depended
on HAL anyway). This allow including only the necessary files in the
compilation.
2015-10-21 09:16:07 +11:00
Caio Marcelo de Oliveira Filho 2e464a53c2 AP_HAL: make code not depend on concrete HAL implementations
The switching between different AP_HAL was happening by giving different
definitions of AP_HAL_BOARD_DRIVER, and the programs would use it to
instantiate.

A program or library code would have to explicitly include (and depend)
on the concrete implementation of the HAL, even when using it only via
interface.

The proposed change move this dependency to be link time. There is a
AP_HAL::get_HAL() function that is used by the client code. Each
implementation of HAL provides its own definition of this function,
returning the appropriate concrete instance.

Since this replaces the job of AP_HAL_BOARD_DRIVER, the definition was
removed.

The static variables for PX4 and VRBRAIN were named differently to avoid
shadowing the extern symbol 'hal'.
2015-10-21 09:16:07 +11:00
Grant Morphett 1b67e49df4 exampleLowPassFilter2p: fixed simple typo error - now build success 2015-08-28 15:36:50 +09:00
dgrat 58e2ac4e56 Filter: Template implementation for <Filter>
There are implementations for float, Vector2f and Vector3f for the Low
Pass Filter and the *2p filter.  I tried to implement these filters
with one common template implementation.  This implementation saves
some lines of code and reduced the redundancy.  One could save even
more code if the currently overloaded isinf/isnan functions and checks
can be removed.

Signed-off-by: Daniel Frenzel <dgdanielf@gmail.com>
2015-08-23 11:17:02 +10:00
Gustavo Jose de Sousa a1af0c2051 Filter: standardize inclusion of libaries headers
This commit changes the way libraries headers are included in source files:

 - If the header is in the same directory the source belongs to, so the
 notation '#include ""' is used with the path relative to the directory
 containing the source.

 - If the header is outside the directory containing the source, then we use
 the notation '#include <>' with the path relative to libraries folder.

Some of the advantages of such approach:

 - Only one search path for libraries headers.

 - OSs like Windows may have a better lookup time.
2015-08-11 16:38:24 +10:00
Randy Mackay 1289208244 LowPassFilter: add get method 2015-06-12 21:36:24 +09:00
Andrew Tridgell b7f0735c2b Filter: convert example from .pde to .cpp 2015-06-01 17:07:07 +10:00
Randy Mackay 151707cb0a Filter: replace 2*M_PI_F with M_2PI_F 2015-05-05 14:22:52 +09:00
Andrew Tridgell f9114f849b Filter: revert AP_Math class change 2015-05-05 13:27:07 +10:00
Tom Pittenger 6d1b517aae Filter: compiler warnings: apply is_zero(float) or is_equal(float) 2015-05-05 13:26:55 +10:00
Tom Pittenger 347fc1e59c Filter: fix compile warnings re float constants 2015-04-24 14:04:14 +09:00
Randy Mackay 06ea18f97e Filter: fix LPF example sketch 2015-04-17 22:54:06 +09:00
Randy Mackay 99a9a88529 Filter: dt check fix for LPF 2015-04-17 10:59:03 +09:00
Jonathan Challinger f20a91ec95 Filter: add dt<0 check to LPF 2015-04-17 10:47:06 +09:00
Randy Mackay 22e1156c31 Filter: add some comments to LowPassFilter 2015-04-17 10:47:04 +09:00
Jonathan Challinger 76da2868d0 Filter: rework LowPassFilter 2015-04-17 10:46:42 +09:00
Randy Mackay ca92821445 Filter: LowPassFilter gets another div-by-zero check 2015-04-01 10:34:28 -07:00
Jonathan Challinger 57f8a4d29d Filter: add get_cutoff_frequency 2015-04-01 10:15:07 -07:00
Andrew Tridgell f3706d63c7 Filter: prevent copying the filter parms on apply 2015-03-12 12:50:30 +11:00
Andrew Tridgell b36122dec0 Filter: removed stdio.h
breaks AVR build
2015-03-12 12:50:30 +11:00
Jonathan Challinger 0133f0bb57 LowPassFilter2p: split into LowPassFilter2pfloat and LowPassFilter2pVector3f 2015-03-12 12:50:27 +11:00
Randy Mackay 4b78b2ce80 Filter: add get method to LowPassFilter 2015-03-03 15:48:58 +09:00
Randy Mackay cf35bd3f42 LowPassFilter: add div by zero check 2014-09-21 17:33:59 +09:00
Andrew Tridgell b16d84023e Filter: fixed example build 2014-08-13 22:12:20 +10:00
Randy Mackay a0369b85d1 LowPassFilter: make methods non-virtual
No classes inherit from this class so no need for set_cutoff_frequency,
set_time_constant and reset(T) to be declared virtual.  Saves 6 bytes of
RAM.
2014-02-10 20:47:05 +09:00
Randy Mackay 38222d65e9 DerivativeFilter: update and slope non-virtual
No classes inherit from DerivativeFilter so no need to be virtual.
Saves 4bytes of RAM.
2014-02-10 20:47:02 +09:00
Randy Mackay 4040be9990 FilterWithBuffer: make get_sample non-virtual
virtual added to apply() and reset() declaration inline with base class.
This should have no impact on memory usage or functionality
2014-02-10 20:47:00 +09:00
Tobias f4000e66e6 Filter: add consts 2013-10-27 13:39:28 +09:00
Andrew Tridgell 99da118faa Filter: added in Leonards LowPassFilter2p filter
this is a backport from PX4
2013-09-26 22:38:32 +10:00
Andrew Tridgell 97b7130bb9 libraries: update license header to GPLv3
we switched to GPLv3 a long time ago, but neglected to update the
per-file license headers
2013-08-30 13:01:39 +10:00
Tobias 338c054da2 Filter: validity of array index was checked AFTER accessing the element.
(correction decreased Program size by 12 bytes)
2013-07-08 12:17:59 +10:00
James Bielman 4fa7bb1486 Add AVR compatibility header for missing math.h definitions.
- Define float versions of math functions to the double versions
  on AVR (eg. #define sinf sin).
- These macros appear to be missing in older versions of avr-libs.
- Include AP_Math.h rather than math.h to get these definitions.
2013-01-16 13:52:17 +11:00
James Bielman 5631f865b2 Update floating point calculations to use floats instead of doubles.
- Allows use of hardware floating point on the Cortex-M4.
- Added "f" suffix to floating point literals.
- Call floating point versions of stdlib math functions.
2013-01-16 13:52:01 +11:00
Andrew Tridgell d00b06d449 Filter: added a butter filter to example 2013-01-16 09:15:35 +11:00
Andrew Tridgell befc6b7b9b Filter: fixed butter filter build on px4 2013-01-16 09:15:22 +11:00
Pat Hickey 53ea7c564e Butter filter: needs header guards 2013-01-15 12:47:43 -08:00
Jonathan Challinger c66571b87d Filter: added 2nd-order butterworth filters. 2013-01-14 19:18:47 -08:00
Andrew Tridgell 30b50a858d Filter: fixed a warning on PX4 2013-01-11 21:17:34 +11:00
Andrew Tridgell 374af1cd14 build: change from Arduino.mk to apm.mk 2013-01-02 17:29:37 +11:00