Commit Graph

160 Commits

Author SHA1 Message Date
Andrew Tridgell
ce5db7b813 AP_Scheduler: fixed use of sqrt() 2018-05-07 11:43:23 +10:00
Andrew Tridgell
99884c89c9 AP_Scheduler: fixed build warning 2018-05-07 11:43:23 +10:00
Peter Barker
c4ea83177f AP_Scheduler: remove unused ins error count logging 2018-04-04 14:21:20 +01:00
Peter Barker
d5c57d949b AP_Scheduler: eliminate goto update_spare_ticks 2018-03-22 10:01:45 +11:00
Peter Barker
badfde6f18 AP_Scheduler: use continue instead of nested-if (NFC) 2018-03-22 10:01:45 +11:00
Peter Barker
224ea50260 AP_Scheduler: continue in place of nested if (NFC) 2018-03-22 10:01:45 +11:00
Mark Whitehorn
919383a739 AP_Scheduler: add load_average() to PM log message 2018-02-21 23:53:08 +10:00
Andrew Tridgell
6cc007598e AP_Scheduler: initialise _last_loop_time_s in init() 2018-02-13 17:15:05 +11:00
Andrew Tridgell
8907cb3b23 AP_Scheduler: time in seconds should be a float 2018-02-13 17:15:05 +11:00
Peter Barker
8288198ac8 AP_Scheduler: force single-precision floating point calculations 2018-02-13 17:15:05 +11:00
Andrew Tridgell
491715bec7 AP_Scheduler: added get_last_loop_time_s()
this gives compatibility with previous G_Dt in copter
2018-02-13 17:15:05 +11:00
Andrew Tridgell
f436901517 AP_Scheduler: fixed perf info to match previous behaviour 2018-02-13 17:15:05 +11:00
Andrew Tridgell
e0c9d9b592 AP_Scheduler: fixed loop time available 2018-02-13 17:15:05 +11:00
Andrew Tridgell
24d6493453 AP_Scheduler: make loop times cover INS wait_for_sample
this matches past behaviour, and gives much more useful information to
a user wanting to know if their board it meeting its desired loop rate
2018-02-13 17:15:05 +11:00
Andrew Tridgell
434c3fffc7 AP_Scheduler: fixed filtered loop time 2018-02-13 17:15:05 +11:00
Andrew Tridgell
620d6ab4b8 AP_Scheduler: fixed merge issues 2018-02-13 17:15:05 +11:00
Peter Barker
73c0905b5e AP_Scheduler: pass log-performance-bit at init time rather than update time 2018-02-13 17:15:05 +11:00
Peter Barker
4672e9d4eb AP_Scheduler: resolve debug name conflict 2018-02-13 17:15:05 +11:00
Peter Barker
d3c1b720c6 AP_Scheduler: move logging of PM messages to AP_Scheduler 2018-02-13 17:15:05 +11:00
Peter Barker
d151b27e92 AP_Scheduler: move PERF: statustext sending into AP_Scheduler 2018-02-13 17:15:05 +11:00
Peter Barker
baa6e04854 AP_Scheduler: change loop time to remove sleeping in wait_for_sample 2018-02-13 17:15:05 +11:00
Peter Barker
4909000441 AP_Scheduler: implement loop() 2018-02-13 17:15:05 +11:00
Peter Barker
e713802c24 AP_Scheduler: add accessor for tick counter 2018-02-13 17:15:05 +11:00
Peter Barker
ae9d4d514d AP_Scheduler: PerfInfo: allow specification of loop rate 2018-02-13 17:15:05 +11:00
Peter Barker
d1781532d4 AP_Scheduler: PerfInfo: add pragma-once to header 2018-02-13 17:15:05 +11:00
Andrew Tridgell
b3ed8fd3f9 AP_Scheduler: scale perf_info with loop rate
this allows it to be used for a wide range of loop rates
2018-02-08 17:36:33 +11:00
Andrew Tridgell
8dcf89b2b7 AP_Scheduler: put scheduler debug on console 2018-02-08 17:36:33 +11:00
Andrew Tridgell
8b0e9bcff4 AP_Scheduler: use pre-computed loop constants
this prevents changing the loop rate without a reboot. Too many
subsystems rely on a consistent loop rate to allow it to be changed
2018-01-20 15:35:58 +11:00
Peter Barker
f2242e07db AP_Scheduler: remove memoisation in loop_period_s() 2018-01-20 15:35:58 +11:00
Peter Barker
a6ac37d0ba AP_Scheduler: eliminate MAIN_LOOP_SECONDS macro 2018-01-20 15:35:58 +11:00
Andrew Tridgell
44dd079cb9 AP_Scheduler: allow for loop rates above 400Hz
with ChibiOS we can run copter at 1KHz with no scheduling misses. This
small PR allows that to be configured.
2018-01-20 10:40:37 +11:00
Andrew Tridgell
580af4a69a AP_Scheduler: removed create() method for objects
See discussion here:

  https://github.com/ArduPilot/ardupilot/issues/7331

we were getting some uninitialised variables. While it only showed up in
AP_SbusOut, it means we can't be sure it won't happen on other objects,
so safest to remove the approach

Thanks to assistance from Lucas, Peter and Francisco
2017-12-14 08:12:28 +11:00
Peter Barker
fd543fce6d AP_Scheduler: create AP::PerfInfo class 2017-11-16 15:31:53 +00:00
Peter Barker
5c2f68e8f5 Copter+AP_Scheduler: move perf_info.cpp into Scheduler 2017-11-16 15:31:53 +00:00
Lucas De Marchi
69b6d95cb2 global: use static method to construct AP_Board_Config{,_CAN} 2017-09-26 03:01:21 +01:00
Lucas De Marchi
de680dac5b global: use static method to construct AP_Scheduler 2017-09-26 03:01:21 +01:00
Lucas De Marchi
d3e12eb899 AP_Scheduler: add static create method 2017-09-26 03:01:21 +01:00
Lucas De Marchi
87b30b4552 global: use static method to construct AP_InertialSensor 2017-09-26 03:01:21 +01:00
Peter Barker
b445313bf1 AP_Scheduler: remove loop-period argument from load_average
This now comes from a parameter rather than being hard-set
in the vehicle code

Also adds a method returning the max loop period based on the
loop rate
2017-08-01 19:39:27 +01:00
Andrew Tridgell
56aa467d60 AP_Scheduler: adjust debug levels
this is more useful for performance analysis of scheduler, using perf
command
2017-05-01 15:02:34 +10:00
jaxxzer
ccb6434831 AP_Scheduler: Set main loop rate to 400hz for Sub 2017-02-21 11:26:14 +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
murata
bb1a787852 AP_Scheduler: To add a comment to _loop_rate_hz variable. 2016-10-16 00:02:40 -07: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
Andy Little
0d113b265c Examples: fix examples for px4
The change to use AP_BoardConfig messed up the examples. Here are some
updated but there are plenty more to do.
2016-10-04 12:50:47 -03:00
murata
7721290160 AP_Scheduler:time_available value type invalid uint16_t to valid uint32_t. 2016-07-25 20:18:16 -03:00
Andrew Tridgell
63d0c040e4 AP_Scheduler: expose loop rate on all builds
as discussed with Randy
2016-06-17 15:02:28 +10:00
Andrew Tridgell
fb4cdafef8 AP_Scheduler: allow SCHED_LOOP_RATE for copter in SITL
very useful for slow simulation environment
2016-06-17 15:01:18 +10:00
Andrew Tridgell
ced4cce358 AP_Scheduler: added optional perf counters at SCHED_DEBUG >= 4 2016-04-21 16:45:02 +10:00
Lucas De Marchi
f5437f30ac AP_Scheduler: 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
Andrew Tridgell
cc25575b3a AP_Scheduler: prevent a startup crash in autotest for Rover 2016-01-05 16:31:06 +11:00
Andrew Tridgell
c3829dfb64 AP_Scheduler: allow for arbitrary loop rates
it turns out 300Hz is pretty useful as it allows for triple EKF on
pixhawk
2016-01-04 08:37:31 +11:00
Jonathan Challinger
94543d55bb AP_Scheduler: fix example build 2015-12-29 10:46:35 -08: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
Lucas De Marchi
eb9fd96d5c AP_Scheduler: remove trailing whitespace 2015-12-27 15:58:12 -02:00
Lucas De Marchi
3375b6b01c AP_Scheduler: stop using Progmem.h 2015-12-27 15:58:12 -02:00
Andrew Tridgell
1b1be7e4a2 AP_Scheduler: switch to Hz based scheduler config 2015-12-27 14:57:06 +09:00
Lucas De Marchi
c59490677d AP_Scheduler: remove unused AP_ADC_AnalogSource 2015-12-03 13:32:44 +11:00
Caio Marcelo de Oliveira Filho
6e7b73610d waf: add waf support 2015-12-03 07:54:30 +11:00
Caio Marcelo de Oliveira Filho
81186e5416 AP_Scheduler: use millis/micros/panic functions 2015-11-20 12:34:17 +09:00
Lucas De Marchi
5244559010 Minimize AP_Progmem.h includes
Most of AP_Progmem is already gone so we can stop including it in most
of the places. The only places that need it are the ones using
pgm_read_*() APIs.

In some cases the header needed to be added in the .cpp since it was
removed from the .h to reduce scope. In those cases the headers were
also reordered.
2015-10-30 14:35:32 +09:00
Lucas De Marchi
20c6ffc5e3 Replace use of UARTDriver::printf_P() with UARTDriver::printf()
This also starts to show warnings on places that were already using
wrong printf format strings.
2015-10-30 14:35:25 +09:00
Lucas De Marchi
831d8acca5 Remove use of PROGMEM
Now variables don't have to be declared with PROGMEM anymore, so remove
them. This was automated with:

    git grep -l -z PROGMEM | xargs -0 sed -i 's/ PROGMEM / /g'
    git grep -l -z PROGMEM | xargs -0 sed -i 's/PROGMEM//g'

The 2 commands were done so we don't leave behind spurious spaces.

AVR-specific places were not changed.
2015-10-30 14:35:16 +09:00
Lucas De Marchi
2c38e31c93 Remove use of PSTR
The PSTR is already define as a NOP for all supported platforms. It's
only needed for AVR so here we remove all the uses throughout the
codebase.

This was automated with a simple python script so it also converts
places which spans to multiple lines, removing the matching parentheses.

AVR-specific places were not changed.
2015-10-30 14:35:04 +09:00
Caio Marcelo de Oliveira Filho
12850742f9 AP_Scheduler: remove unnecessary includes from example 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
Randy Mackay
87cada1d54 Scheduler: remove INS start style from example sketch 2015-09-21 17:06:25 +09:00
Gustavo Jose de Sousa
53b5b70960 AP_Scheduler: use also task name besides the id for logging
This makes it easier to identify for which task a log line is.
2015-09-01 20:22:19 +10:00
Gustavo Jose de Sousa
b59154103f AP_Scheduler: use function name for AP_Scheduler task name
That makes it easier to identify tasks when debug is enabled in AP_Scheduler.
2015-09-01 20:22:19 +10:00
Gustavo Jose de Sousa
8fe466ce27 AP_Scheduler: add initializer for task field "name"
We use define it as an empty macro if on AVR board.
2015-09-01 20:22:18 +10:00
Gustavo Jose de Sousa
8018748fe2 AP_Scheduler: add field "name" to task structure for logging purposes
That field will be useful for logging as it is easier to know what task a log
is related to by using the task's name rather than using the number.
2015-09-01 20:22:18 +10:00
Gustavo Jose de Sousa
2e6074c108 AP_Scheduler: use designated initializers for tasks structs
Makes code less prone to break build and semantics (e.g., when a new field is
added).
2015-09-01 20:22:18 +10:00
Gustavo Jose de Sousa
c04b984e6c AP_Scheduler: 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:23 +10:00
Daniel Frenzel
b9c0f34897 AP_Scheduler example
Fixed build problem with "make linux"

Signed-off-by: Daniel Frenzel <dgdanielf@gmail.com>
2015-08-10 19:49:38 +10:00
rentt
ad32a98e29 Scheduler: fix compiler warning in example sketch
printf except a unsigned long value, but the hal.scheduler->millis() return a uint32_t
2015-07-28 12:06:46 +09:00
Lucas De Marchi
d8b70dc0c5 AP_Scheduler: use ARRAY_SIZE macro 2015-07-21 14:25:13 +09:00
Lucas De Marchi
98a1a05933 AP_Scheduler: stop using alias FUNCTOR_BIND_VOID 2015-06-04 13:37:40 +09:00
Andrew Tridgell
b2a5de8a63 AP_Scheduler: fixed example sketch 2015-06-01 17:42:32 +10:00
Andrew Tridgell
ae4cfe3f2f AP_Scheduler: convert example from .pde to .cpp 2015-06-01 17:07:06 +10:00
Andrew Tridgell
dd691ae75c AP_Scheduler: all vehicles now use functors 2015-06-01 15:18:31 +10:00
Andrew Tridgell
96b921d4cc AP_Scheduler: fixed example build 2015-05-26 14:37:14 +10:00
Andrew Tridgell
7db9da6545 AP_Scheduler: removed delegate ptr handling
no longer needed
2015-05-26 14:33:30 +10:00
Lucas De Marchi
78b00784fb AP_Scheduler: allow to use functor 2015-05-26 13:46:50 +10:00
Lucas De Marchi
5dfb3ed70c AP_Scheduler: replace tabs with spaces 2015-05-26 13:46:49 +10:00
Andrew Tridgell
0847bd2608 AP_Scheduler: use APM_BUILD_DELEGATES 2015-05-21 07:48:51 +10:00
Andrew Tridgell
1237772479 AP_Scheduler: support member functions for rover 2015-05-21 07:48:46 +10:00
Andrew Tridgell
8ba5272b0e AP_Scheduler: fixed PSTR() usage 2015-05-05 13:54:27 +10:00
Tom Pittenger
d823541eb1 AP_Scheduler: compile warnings: format not a string literal, argument types not checked
PSTR() goofs things up when using hal.console->printf_P()
2015-05-05 13:27:01 +10:00
Andrew Tridgell
a4e8d960d2 AP_Scheduler: fix for HAL_SITL rename 2015-05-05 09:45:56 +10:00
Randy Mackay
75e2498da2 Scheduler: fix example sketch 2015-05-02 11:55:50 +09:00
Randy Mackay
857c3ef0e9 Scheduler: fix example sketch 2015-01-28 17:15:51 +09:00
Andrew Tridgell
48abfcede7 AP_Scheduler: added example sketch 2014-11-28 12:59:47 +11:00
Andrew Tridgell
67f5ba0b94 AP_Scheduler: added current_task static
will be used to debug stuck tasks on PX4
2014-07-03 09:09:11 +10:00
Andrew Tridgell
c4d62f6b92 AP_Scheduler: fixed SCHED_DEBUG docs 2013-10-13 21:41:01 +11:00
Andrew Tridgell
0f4da25e68 AP_Scheduler: make sure we run remaining tasks on overrun
when a task overruns its time, we can still run the rest of the tasks
in the task list
2013-10-13 21:41:01 +11:00
Andrew Tridgell
cfa1b5353f AP_Scheduler: show slips only for SCHED_DEBUG>1
this allows us to see PERF reports in copter without console writes
slowing things down
2013-10-10 15:41:34 +11:00