Commit Graph

114 Commits

Author SHA1 Message Date
Andrew Tridgell 50dcca39bd Filter: added a notch filter
maths from Leonard
2017-08-29 13:52:29 +10:00
Pierre Kancir 892a999ba5 Filter: example fix travis warning
missing function declaration
implicit cast
some style fix
2017-04-13 19:56:16 +01:00
Andrew Tridgell b165e025d9 Filter: added new constructor for 1p filter
allow both sample rate and cutoff to be specified in constructor
2016-11-25 17:49:57 +11:00
Andrew Tridgell f94e4b4375 Filter: allow 1P LowPassFilter to work without alpha recalc per sample
this makes the 1P filter optionally syntax compatible with the 2P
filter and much more CPU efficient.
2016-11-10 11:43:29 +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
Lucas De Marchi ae53920e5b build: don't build examples with old build system
We currently check examples are buildable with waf which doesn't need
the libraries to be specified in a make.inc file.  Having the makefiles
there is misleading since people try to build and realize the build is
broken.
2016-10-11 13:03:08 +11: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
Ricardo de Almeida Gonzaga 5bd034a5a8 Global: start using cmath instead of math.h 2016-04-05 21:06:19 -07:00
dgrat 5148e41c1a AP_Math: Cleaned macro definitions
Moved Definitions into a separate header. Replaced PI with M_PI and
removed the M_PI_*_F macros.
2016-02-27 02:51:33 -03:00
Lucas De Marchi edd3e3c34a Filter: silence warning about unused function
../../libraries/Filter/examples/Derivative/Derivative.cpp:16:14: warning: ‘float noise()’ defined but not used [-Wunused-function]
 static float noise(void)
              ^
2016-02-19 11:51:49 -02:00
Lucas De Marchi 98904825cb Filter: replace header guard with pragma once 2016-02-18 14:52:35 -02:00
Gustavo Jose de Sousa c2e3f05dbf waf: ardupilotwaf: prefix build context methods with ap_
It helps to distinguish between things from waf and things from ardupilotwaf.
2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa 3d22490397 waf: examples: use methods from bld instead of ardupilotwaf 2016-01-22 20:10:29 -02:00
Gustavo Jose de Sousa d281067bcc waf: make example binaries be placed in 'examples' dir
This commit makes examples' wscripts use ardupilotwaf.example() instead of
ardupilot.program().
2016-01-15 16:46:41 -02:00
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