Commit Graph

98 Commits

Author SHA1 Message Date
Daniel Agar
9585055e9e uORB: add bitset for faster orb_exists check and remove uORB::Subscription lazy subscribe hack/optimization
- add PX4 bitset and atomic_bitset with testing
 - add uORB::Subscription constructor to take ORB_ID enum
 - move orb test messages into msg/
2020-03-11 09:06:33 -04:00
Julian Oes
3be8b3d177 logger: style fix 2020-02-26 14:52:39 +01:00
Paul Riseborough
d9ae242760 logger: fix unused variable build error 2020-02-26 18:44:20 +11:00
Daniel Agar
931a3f2684 logger: publish initial logger_status orb message 2020-01-29 17:29:30 -05:00
tzai
b9d85c7176 logger: Refactor new boot_bat logic into separate function
Implements suggested fixes.

Signed-off-by: Tal Zaitsev <tal@corvus-robotics.com>
2020-01-11 22:27:00 +05:30
tzai
1c2f95697c logger: Add support for logging only on bat power
Will not start logging from boot if battery is not connected

Signed-off-by: Tal Zaitsev <tal@corvus-robotics.com>
2020-01-11 22:27:00 +05:30
Beat Küng
e10a4c5002 refactor logger: move subscription initialization into separate class 2019-12-17 21:22:30 -08:00
Beat Küng
738ceab0ee Logger: dynamic number of subscriptions
Keep a fixed-size array of 250 requested topics on the stack, then allocate
an array with LoggerSubscription with the exact required size.
2019-12-17 21:22:30 -08:00
Beat Küng
2757647897 refactor logger: reduce required size of WrittenFormats
by keeping only recursive topics in there. The rest is checked by looking
at previous _subscriptions.

Reduces stack size requirements when increasing MAX_TOPICS_NUM.
2019-12-17 21:22:30 -08:00
Beat Küng
3198610f85 src/platforms: move all headers to platforms/common/include/px4_platform_common
and remove the px4_ prefix, except for px4_config.h.

command to update includes:
for k in app.h atomic.h cli.h console_buffer.h defines.h getopt.h i2c.h init.h log.h micro_hal.h module.h module_params.h param.h param_macros.h posix.h sem.h sem.hpp shmem.h shutdown.h tasks.h time.h workqueue.h; do for i in $(grep -rl 'include <px4_'$k src platforms boards); do sed -i 's/#include <px4_'$k'/#include <px4_platform_common\/'$k/ $i; done; done
for in $(grep -rl 'include <px4_config.h' src platforms boards); do sed -i 's/#include <px4_config.h/#include <px4_platform_common\/px4_config.h'/ $i; done

Transitional headers for submodules are added (px4_{defines,log,time}.h)
2019-10-30 11:48:47 +01:00
Julian Oes
ec95378821 logger: fix uninitialized coverity warnings 2019-10-17 08:44:53 -04:00
Daniel Agar
83e532d339 logger move to uORB::SubscriptionInterval (#12123) 2019-08-07 11:02:16 -04:00
Daniel Agar
6f2d1d55f6 logger use uORB::PublicationQueued for ulog_stream
- queue depth is now set by the msg
2019-08-06 11:07:59 -04:00
Daniel Agar
5b511eaa1a logger move non-logged subscriptions to uORB::Subscription 2019-08-06 11:07:59 -04:00
Daniel Agar
e69398c09f introduce uORB::PublicationQueued and transition most orb_advertise_queue usage 2019-08-04 10:08:09 -04:00
Bharat Tak
1ebf5d04d9 logger: add Ulog sync bytes at 1Hz and tagged log message definition (#12144) 2019-06-11 11:00:54 +02:00
Julian Oes
e7d0cabb52 logger: fix uninitialized member variable
This was reported by Coverity Scan.
2019-06-05 14:46:03 +02:00
Beat Küng
0d71eeccbf console buffer: write to log as 'boot_console_output' message 2019-06-04 11:57:54 +02:00
Beat Küng
ed9d25a75a logger: add arming/disarming via AUX1 RC channel logging mode 2019-05-29 11:41:22 +02:00
Daniel Agar
edeb59a8c3 move logger array.h -> containers/Array.hpp 2019-01-20 12:03:53 +01:00
Beat Küng
dc49e259b3 logger: add separate profile for vision/avoidance
Keeps things more modular.
2018-12-07 11:51:59 +01:00
Beat Küng
3a462c2ba7 refactor logger: move debug buffer printf into separate method (DBGPRINT) 2018-10-26 08:02:42 +02:00
Beat Küng
234ec7f2a2 logger: add mission log to frontend, configurable via SDLOG_MISSION
- mission logs are stored in a separate directory mission_log
- It's disabled by default
- Does not increase RAM usage if disabled (if enabled, only 300 bytes)
- Log rotate does not apply to the mission logs
2018-10-26 08:02:42 +02:00
Beat Küng
28ac7679e0 logger: change message id from uint16_t to uint8_t
256 subscriptions are enough for now.
Reduces RAM usage by 300 bytes.
2018-10-26 08:02:42 +02:00
Beat Küng
b86c7d2e8f Logger: only write subscribed topic format definitions
Previously the formats of all known uorb messages were written.

- reduces header size by about 13KB
- reduce ulog_message_format_s size to reduce required stack size.
  Largest message format is about 1000 bytes.
2018-10-26 08:02:42 +02:00
Beat Küng
0745ba9052 refactor logger: move some code inside run() into separate methods 2018-10-26 08:02:42 +02:00
Beat Küng
5eafa1b34b refactor logger: move some independent methods into separate util file 2018-10-26 08:02:42 +02:00
Beat Küng
c0cac0594e file paths: add PX4_STORAGEDIR & use it where appropriate 2018-08-08 21:09:39 +02:00
Julian Oes
0c5c741b1a add posix shell
squashed & rebased version, not including:
- listener changes
- src/firmware renaming

Commits:

tag_to_version.py: fix Python3 error

subprocess.communicate returns bytes instead of a str which is not the
same for Python3. Therefore, we need to decode the bytes.

cmake: remove folder src/firmware

The folder src/firmware was not intuitive. Why would the binaries for
SITL be inside a src and why even inside a src/firmware folder. Also,
the rootfs was put there which made it even more confusing.

The CMakeLists.txt files are moved into cmake/ and get now called from
the main CMakeLists.txt.

qshell: support for return value

Instead of just sending commands, qshell will now also wait until
the command has finished on QURT and sent back a return value. This will
allow all modules on the DSP side to be spawned from the Linux side
meaning that we only need one config/startup file instead of two.

adb_upload: create folders before pushing

Previously the script failed if the folder on the destination was not
already existing. This therefore makes pushing easier.

posix: spawn PX4 modules in bash

This adds the possibility to spawn PX4 modules out of bash. Basically,
the main executable can now be started as a server/daemon or as a
client.
The server replaces the existing functionality of the main exe with
the pxh shell, however, it also opens a pipe that clients can talk to.

Clients can run or spawn PX4 modules or commands by connecting to the
server over the pipe. They clients will get the stdout and return value
of their commands via a client specific pipe back.

This work will allow to start all modules using a bash script similar to
the way it is done in NuttX where the NuttShell scripts the startup
scripts and starts the modules.

SITL: use new client shell in SITL

This is a first step to use the new shell capabilities for SITL.
The new startup bash script rcS merges (and therefore replaces) the two
existing scripts rcS_gazebo_iris and rcS_jmavsim_iris.

More cleanup will be necessary for the rest of the SITL startup scripts.

Snapdragon: use new shell to start all modules

Instead of different mainapp.config and px4.config files, we can now use
a unified rcS bash script which starts all the modules based on
parameters, mainly the SYS_AUTOSTART param.

Snapdragon: fix the airframe description

pxh: argv needs to end with a nullptr

The comment was wrong that argv needs an additional 0 termination.
Instead it needs a nullptr at the end.

px4_posix_tasks: variable cleanup

The px4_task_spawn_cmd function got a cleanup while debugging, however,
no functional changes.

Snapdragon: move some drivers to 4100 config

These drivers are supported by the community, so they go into the 4100
config.

Snapdragon: update 210qc platform

px4_daemon: use doxygen comments

apps.h_in: fix string printf: use .c_str()

px4_daemon: \b -> \n in printf

px4_daemon: handle error in generate_uuid (close the file on error)

posix main: some clarifications in comment (it's the symlinks not the script aliases)

cmake: remove new install command again

This one was probably wrong and untested. Installing needs revisiting.

POSIX: remove argument USES_TERMINAL

POSIX: copy init and mixer files for SITL

Instead of using non-working install commands, the mixer and startup
files are now copied as part of the build in cmake.

adb_upload.sh: remove leftover commented printf

POSIX main: just the pointer instead of memmove

POSIX main: remove chroot

chroot is removed because it hasn't been used anywhere and seems
untested.

px4_daemon: remove client pipe when cleaning up

px4_daemon: fail if the client pipe already exists

The client pipe is supposed to be specific (by UUID), so the path
shouldn't exist already.

history: limit the number of history entries

This is a protection to avoid filling the memory if we are entering a
lot of commands (e.g. auto-generated).

px4_daemon: add a threadsafe map and use it

px4_daemon: whitespace

px4_daemon: fix client parsing

Sometimes the client ends up reading more than one packet in one read.
The parsing is not made for this and would require a (ring)buffer for
it.

The solution of this commit just reads as much as needed from the pipe
which avoids having to do buffering and parsing.

posix: changes sitl_run.sh and main.cpp cleanup

This changes the paths in sitl_run.sh quite a bit to allow the px4
binary to run in the rootfs directory which should make it convenient
and very close to the NuttX variant.

Also main.cpp got a big cleanup after the big rebase with some
conflicts. Quite some functionality was removed but it has yet to be
seen if it needs to be re-added.

px4_log: cleanup log levels, now they make sense

Before DEBUG and INFO log levels where inverted which didn't make much
sense in my eyes.

dataman: fix path for bash shell

logger: fix paths for bash shell

mavlink: fix paths for bash shell

param: fix path for bash shell

inav: fix paths for bash shell

sdlog2: fix paths for bash shell

ROMFS: add forgotten mixer to list

SITL init: more models, more options

- Support for different models using the unified startup
script rcS.
- Support to choose the estimator by setting the environment variable
  PX4_ESTIMATOR.
- Support to choose the logger by setting the environment variable
  PX4_LOGGER.

rcS: fix string comparison

listener: use template file

Instead of having all of the C++ code inside the Python file it is
nicer to have a separate template file with the C++ headers, etc.

px4_log: add PX4_INFO_RAW for raw printfs

This allows to do custom formatting but is still transported over
sockets to clients.

topic_listener: use PX4_INFO_RAW instead of printf

commander: use PX4_INFO_RAW for status

listener: rewrite to classes and factory

posix: fix some argument warnings

generate_listener.py: by accident changed shebang

listener: big refactor of the generator

Hopefully this makes it easier to read and change in the future.

rcS: manually take over rebase changes

listener: remove leftover try

listener: properly clean up topic instance

rcS: take over some vehicle specific changes

posix-configs: vehicle specifics to separate files

posix-configs: remove leftover lines

uORBDevices: new PX4_INFO_RAW instead of printf

px4_log: just use printf on NuttX

listener: use less binary space, strip on NuttX

generate_listener.py: remove commented code

cmake: fix syntax error from merge

px4_daemon: fixes after rebase of apps.h/cpp fix

px4_daemon: namespace missing

posix: only create stub for fsync on QURT

unitests: reduce dependencies of param test

This makes the unit test compile and link again after the bash changes.

QURT: some compile fixes after a rebase

SITL: arg change for sitl_run.sh to use rcS_test

This allows to use a custom startup file for testing.

SITL: add the folder test_data

SITL: implement shutdown command as systemcmd

The shutdown command needs to be a proper systemcmd, otherwise the alias
and symlink generation doesn't work and we end up calling shutdown of
the host computer which is to be avoided.

px4fmu_test: same IO_pass mixer as px4fmu_default

px4fmu_test: use normal quad x mixer

There is no good reason to use a specific test mixer, except more cmake
code around it. Therefore just use the same mixer as default, and at
some point px4fmu_test and px4fmu_default can get merged

POSIX: cleanup, dir and symlink fixes

This cleans up the logic behind the symlinking and creating directories.

POSIX: correct arg order in usage info

tests: fix paths for SITL tests

POSIX: printf fix

sitl_run.sh: try to make this run on Mac as well

cmake: try to make jenkins happier

Path cleanup, the bin is no longer in src/firmware

POSIX: fix symlink logic

SITL: prefix all exported env variables

cmake: fix path for ROS tests

integrationtests: fix log path

launch: try to make tets with ROS working again

px4_defines: fix after wrong merge deconflicting

px4_defines: get paths for POSIX correct

cmake: fix cmake arguments

This was fine with cmake 3.6 but did not work with cmake 3.2.2

cmake: use cp instead of cmake -E copy

cmake -E copy does not support copying multiple files with versions <
3.5. Therefore, just use cp for now.

ROMFS: fix build error after rebase

cmake: fix paths in configs

launch: use `spawn_model` again

cmake: various fixes after big rebase

param: path fixes after rebase

posix platform: fixes after rebase

test_mixer: fix screwed up rebase
2018-08-08 21:09:39 +02:00
Beat Küng
9b72080ec1 refactor logger: add an enum for the reason of printing the cpu load 2018-05-18 22:23:32 +02:00
Daniel Agar
ea3acb7121 cmake remove circular linking and reorganize
- px4_add_module now requires MAIN
 - px4_add_library doesn't automatically link
2018-04-29 21:48:54 -04:00
Paul Riseborough
c9f44531c2 logger: Add logging profile to support comparison of multiple sensors (#8134) 2017-10-20 09:30:55 -04:00
Beat Küng
3be252289a logger: use orb_exists to check if we need to subscribe to the first instance
To keep track of the configured interval, we store it as negative file
descriptor, until we do the subscription.

This frees up a considerable amount of file descriptors in most use-cases.
2017-10-18 08:40:32 +02:00
Beat Küng
98e6ba858d logger: change SDLOG_PROFILE into a bitset
This is more flexible, allowing a combination of sets.

The default enables the same set & rates as before
2017-10-14 14:21:11 +02:00
Beat Küng
be6079bc52 logger: add high rate & debug profiles 2017-10-14 14:21:11 +02:00
Daniel Agar
086ddf5078 logger coverity fix 143427 2017-09-16 21:28:24 +01:00
José Roberto de Souza
4462869432 Add support to new fields in command_ack 2017-08-19 09:04:52 +02:00
Beat Küng
59bde454b5 ModuleBase: instanciate -> instantiate 2017-07-14 11:57:11 +02:00
Beat Küng
7361244359 logger: convert to use ModuleBase 2017-07-14 11:57:11 +02:00
Beat Küng
c775b07b43 logger: use INFO_MULTIPLE for top & perf output 2017-07-07 17:06:48 +02:00
James Goppert
66a890d428 Remove mode enum since not used and declare enum type. 2017-07-06 09:02:13 +02:00
James Goppert
9f20730d7e Remove unused sdlog mode handle. 2017-07-06 09:02:13 +02:00
James Goppert
57e0051c42 Fix enum. 2017-07-06 09:02:13 +02:00
James Goppert
16f46c15d3 Switch to class enum and cleanup log profiles. 2017-07-06 09:02:13 +02:00
James Goppert
15ae3a9eb7 Add estimator replay topics to default. 2017-07-06 09:02:13 +02:00
James Goppert
d10a491243 Add logging profiles to logger module. 2017-07-06 09:02:13 +02:00
Beat Küng
1d1eedb086 logger: register shutdown hook for graceful shutdown
This will avoid file system corruptions in cases where px4_shutdown_request
is used. However it will not help obviously when the battery is pulled
directly.
2017-04-20 10:01:51 +02:00
Beat Küng
24380ae88c logger: add SDLOG_DIRS_MAX param to limit the max number of log directories
Disabled by default, so that logs are not deleted unexpectedly.
2017-04-10 23:37:09 +02:00
Beat Küng
7f0db95f87 logger: reduce CPU load by ~1.5%
Reduces CPU load from ~6.9% to 5.3% (tested on Pixracer & Pixhawk). The
method is only used once, so it does not increase flash usage.
2017-04-10 23:37:09 +02:00
Beat Küng
75bd4f1121 logger: implement a logrotate
Remove old log directories on startup if free space falls below a threshold.
The threshold is 300MB or 10% of the disk capacity if that's smaller.
2017-04-10 23:37:09 +02:00