139 Commits

Author SHA1 Message Date
Beat Küng
30f80515ec fix logger: sscanf was used wrong for custom topics file
using scanf with %s reads until the first whitespace, which included the
comma (as per C standard and tested on linux). Behavior on NuttX differs.

This makes it work on both Linux and Nuttx.
2017-01-09 11:09:37 +01:00
Beat Küng
59ca22ee6d px4.h: remove this include, causes compile problems on GCC 6.1.0
It causes problems because it includes px4_nodehandle.h which in turn
includes <functional>, and this is not available on NuttX
2017-01-03 10:39:55 +01:00
Lorenz Meier
38d27e284f Logger: Header cleanup 2016-12-27 21:00:51 +01:00
Beat Küng
3d0f1e4a4f logger: use better variable names for chip name description 2016-12-21 11:35:10 +01:00
Beat Küng
5ad2595f43 logger: add more version info & uuid
in particular:
- SW release version (in addition to the git hash)
- OS version (tag + git hash if exists)
- mcu version & revision & UUID
- toolchain version

The uuid can be disabled via parameter, it's enabled by default.
2016-12-21 11:35:10 +01:00
Beat Küng
41dc34204c version cleanup: move all version information into version.c and use a common API
The provided versioning information is the same, except for some additions,
like OS version (which still need to be implemented on NuttX).
2016-12-21 11:35:10 +01:00
Beat Küng
c662113527 board_name.c: remove the file and HW_ARCH macro, use px4_board_name() instead
boards define BOARD_NAME, so board_name() is not necessary. HW_ARCH was
just a wrapper around board_name().

This patch simplifies to having only one common method px4_board_name().
2016-12-21 11:35:10 +01:00
David Sidrane
c9f10107c0 Nuttx Upgrade:Adds sem_setprotocol 2016-12-21 08:34:21 +01:00
Mark Whitehorn
257e236c92 add errno to error message 2016-12-10 12:56:39 +01:00
Andreas Antener
a74269ec60 Load monitor: adding stack logging to logger 2016-12-09 21:12:12 +01:00
Daniel Agar
0fa79eab5c add differential_pressure to airspeed logging 2016-11-19 15:15:36 +01:00
Paul Riseborough
81dc20ea86 logger: add preflight sensor check messages 2016-11-19 15:12:08 +01:00
Beat Küng
9301e9cc50 logger params: add SDLOG_MODE to select when to start & stop logging 2016-11-19 15:12:08 +01:00
James Goppert
3511f8abfb Add position ground truth. (#5819)
Have confirmed this works with gazebo sitl.
2016-11-09 19:38:38 -05:00
Beat Küng
00cd2902c7 fix logger: avoid leaking file descriptor in get_log_time()
orb_subscribe can succeed, but if there is no publisher, orb_copy will fail.
We still need to unsubscribe in that case.
2016-10-31 12:41:04 +01:00
Beat Küng
cbbee30e48 log_writer_file: add include px4_posix.h (needed for stack size macro)
Failed with GCC 6.0.1, don't know why it worked before...
2016-10-24 10:22:48 +02:00
Beat Küng
f7d8612bc9 logger: enable all backends by default
This requires ~270B more RAM
2016-10-23 15:25:20 +02:00
Beat Küng
09d8e4fd8c logger: reduce stack size, which got freed in 05a771152520
commit msg: 'logger: avoid uORB::Subscription, directly use orb_subscribe() instead'
2016-10-23 15:25:20 +02:00
Beat Küng
64df463a85 logger: avoid setting the interval for topics where not needed
Saves some RAM, although not much in that case. But all subscriptions
combined need ~1.5KB only for the interval data within uORB.
2016-10-23 15:25:20 +02:00
Beat Küng
7140914d38 logger: remove LoggerSubscription::time_tried_subscribe
Instead use a single timestamp for subscription checks. This frees up
~800B of RAM.

Also make sure the subscription checks are distributed over time. On each
update, at most 1 topic subscription is checked. Reduces the load of the
logger from 7.3% to 5.8% (Pixracer)
2016-10-23 15:25:20 +02:00
Beat Küng
f244a78368 logger: avoid uORB::Subscription, directly use orb_subscribe() instead
This frees up ~160B stack size
2016-10-23 15:25:20 +02:00
Beat Küng
4120cd93df logger: make sure structs are properly aligned
ulog_message_info_header_s *msg = reinterpret_cast<ulog_message_info_header_s *>(buffer);
members of msg could end up unaligned, because of the uint8_t buffer.
2016-10-23 15:25:20 +02:00
Beat Küng
9272aa592a logwriter: fix shadowing compiler warnings 2016-10-19 13:13:47 +02:00
Beat Küng
326800e5a8 logger: increase stack size
evaluated with: logger start -e -t -m all
and then make sure to get an error printf in the mavlink writer backend,
eg. for an ack timeout.
2016-10-19 13:13:47 +02:00
Beat Küng
8e0d548f51 logger: increase default queue size for mavlink logging to 14
tested on Pixracer: 14 still produces some dropouts once in a while, but I
think it's a fair tradefoff between RAM usage & dropouts. The queue needs
about 3.5KB of RAM.

When topic sizes/logging rates change, this will have to be reevaluated.
2016-10-19 13:13:47 +02:00
Beat Küng
f29a50df31 logger: add support for mavlink backend in Logger class, handle start/stop 2016-10-19 13:13:47 +02:00
Beat Küng
2dc59efbb6 logger: add mavlink write backend 2016-10-19 13:13:47 +02:00
Beat Küng
b233753e23 logger: don't exit if directory creation failed & mavlink mode enabled 2016-10-19 13:13:47 +02:00
Beat Küng
8ea38bc278 logger: better status output with configured backend mode 2016-10-19 13:13:47 +02:00
Beat Küng
7a60c1296e logger: re-use subscribed topic id's, only set them once on first use
Will be necessary when using multiple backends in parallel.
2016-10-19 13:13:47 +02:00
Beat Küng
12ded377d1 refactor logger: add need_reliable_transfer flag, remove write_wait 2016-10-19 13:13:47 +02:00
Beat Küng
de20f1778e logger: add -m <mode> and -q <queue_size> parameters, prepare for mavlink backend 2016-10-19 13:13:47 +02:00
Beat Küng
1ddddccb81 logger: move thread start/stop logic into LogWriterFile 2016-10-19 13:13:47 +02:00
Beat Küng
ccdaabc7fb refactor logger: prepare for multiple write backends 2016-10-19 13:13:47 +02:00
Beat Küng
4e1a4440ca logger: remove _enabled attribute and add LogWriter::is_started() instead 2016-10-19 13:13:47 +02:00
Beat Küng
c26e29d11c logger: move writer_thread variable into function (never accessed outside) 2016-10-19 13:13:47 +02:00
Beat Küng
ce0d31b7d9 mavlink log: ensure all critical & emergency msgs are also logged to console & ulog
Critical messages that the user sees should also go to the log file, so
that the exact error (with time) can later be analyzed from the log file.
2016-09-30 13:50:51 +02:00
Julian Oes
8ff237c69f Remove size optimization for individual modules
It makes more sense to set the optimization flags on a platform basis
instead of individually for each module. This allows for different
optimization options for SITL, NuttX, Snapdragon, etc.
2016-09-30 08:11:51 +02:00
Mark Whitehorn
ca9ac1c807 add default simulator groundtruth topic only for SITL builds 2016-09-19 13:05:14 +02:00
Mark Whitehorn
f24b199775 add HIL_STATE message handler and publish to uORB
add missing break

uorb topics generator: add multi-topics to the list of all topics

topic names with '# TOPICS <name>' were previously not in orb_get_topics().
This means the logger could not find them.

Affects for example actuator_controls_0.

px_generate_uorb_topic_files.py: add multitopics to generate_topics_list_file_from_files method

switch simulated attitude to new topic: vehicle_attitude_groundtruth

logger: add input_rc topic. needed for web plotting

input_rc.msg: remove timestamp_publication, use timestamp instead

mixer.cpp: warnx -> PX4_ERR

logger: initialize timer_call to 0 (hrt_call_every reads some fields)

position_setpoint_triplet topic: set the timestamp when publishing

px_generate_uorb_topic_files.py: add multitopics to generate_topics_list_file_from_files method

add vehicle_attitude_groundtruth to default topics

change to hil_state_quaternion
2016-09-19 13:05:14 +02:00
Beat Küng
4e1652fa6b logger: initialize timer_call to 0 (hrt_call_every reads some fields) 2016-09-19 13:03:40 +02:00
Beat Küng
3a94afb03c logger: add input_rc topic. needed for web plotting 2016-09-19 13:02:31 +02:00
Lorenz Meier
bb48787811 Logger: Adjust pthread stack size 2016-09-11 20:07:30 +02:00
Beat Küng
528ca931af logger: only add data message to the log if orb_copy succeeds, when adding a new instance 2016-08-24 21:24:35 +02:00
Beat Küng
df53fb0fde logging: publish a message for PX4_{WARN,ERR} & store them to the ulog file
- ulog file message rate limited to 50Hz
- queuing with size 2
- this replaces the mavlink log message in the ulog
  (but the mavlink warnings & errors still go to the ulog)
2016-08-24 21:24:35 +02:00
Beat Küng
eae1585e38 logger: store full file name in logger, remove it from log writer
- also add log file to the status output
2016-08-24 21:24:35 +02:00
Julian Oes
c4cb916afa Fix sdlog2/logger path/file name overflows. (#5138)
* logger: prevent logpath buffer overflows

The handling of the log path had the potential to cause buffer
overflows, especially on POSIX platforms where the paths are often much
longer than just 64 chars.

* sdlog2: prevent logpath buffer overflows

When the log folder path was created, this was done with the unsafe
sprintf function instead of snprintf. This caused buffer overflows in
SITL but the overflow was usually not detected until recent testing of
some work in progress.
2016-07-27 00:55:29 -07:00
Beat Küng
a1b710025b Improve new logger update rate (#5073)
* logger: disable some default topics, which are most likely not used

This is also to safe CPU and lower the amount of file descriptors used.

* logger: use the hrt timer for more accurate scheduling

Under NuttX with the default rate of 285Hz, the actual measured rate was
only 200Hz while on Linux it was ~280Hz. The reason is that NuttX only
uses a usleep() granularity of 1ms, so that the typical sleep time is
longer than what we set.

Now the logger waits on a semaphore, which gets activated periodically
with a hrt timer. With this the measured rate is exactly the expected one,
285Hz.
2016-07-15 16:55:32 -07:00
Beat Küng
c9652fd42a logger: update set of default topics to match functionality of sdlog2
logging rate with these topics: ~50KB/s

The rates may need to be adjusted
2016-07-11 10:04:44 +02:00
Beat Küng
84a1a10006 logger: check if we are in replay mode via ENV variable 'replay' 2016-07-07 12:51:42 +02:00