109 Commits

Author SHA1 Message Date
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
Beat Küng
28ad6066aa replay: add replay module, build for sitl_default, but do not load on startup
This adds a new module that does:
- read an parse an ULog file, given via ENV variable 'replay'
- apply all parameters from the log file
- read and apply user-defined override parameters from a file
- publish all messages in 'real-time' from the log file and add a constant
  offset to the timestamp to match the system time.
- apply changed parameters in the log (which are not overridden)
2016-07-07 12:51:42 +02:00
Beat Küng
09ecc84cc7 gps file dump: re-implement with an uORB topic & write to the log file (#4987)
Drawbacks of the previous method: when writing to the SD card, there are
high delays in the write() call of several 100ms, every now and then. The
frequency and length of these events depend on:
- SD card
- used logger bandwidth
- bandwidth of gps data (RTCM)
Since the whole gps thread was blocked during this period, it lead to
gps timeouts and lost module.

What we do now is: publish an orb topic with queuing. This makes it async
and the logger takes care of buffering. This means it's best to:
- use high logger rate
- use large logger buffer
- reduce logger bandwith by disabling unused topics
2016-07-06 09:32:37 +02:00
Beat Küng
c4e77cf411 logger: fix '-r 0' parameter: should be unlimited rate instead of 1Hz 2016-07-05 14:08:25 +02:00
Beat Küng
c94fe845ec fix logger: remove space in format for changed parameters 2016-07-05 14:08:25 +02:00
Beat Küng
a455962e17 logger: only call write_add_logged_msg when sucessfully subscribed 2016-07-05 14:08:25 +02:00
Beat Küng
3bfedfff19 logger: printf cleanup, output statistics when stopping the logger 2016-06-10 08:51:54 +02:00
Mark Whitehorn
0ca63fa379 move default topics into logger.cpp; add on/off command
look for alternate topic list at
/fs/microsd/etc/logging/logger_topics.txt
on and off commands have the same effect as arm/disarm
2016-06-10 08:51:54 +02:00
Mark Whitehorn
2bd15f1698 fix string handling issues and simplify parser 2016-06-10 08:51:54 +02:00
Mark Whitehorn
f250911776 read topics to log from a text file 2016-06-10 08:51:54 +02:00
Beat Küng
c64b0d4573 logger: don't use system time for log file name if system time obviously wrong 2016-06-06 23:27:16 +02:00
Beat Küng
605f731ac4 logger: reduce maximum logged string length to 128 (use less memory) 2016-06-06 23:27:16 +02:00
Beat Küng
76d6ffd445 logger: use the defined interval for all multi-instances (& fix code style) 2016-06-06 23:27:16 +02:00
Beat Küng
0fb0f17ccb logger: reduce memory usage, by limiting the nr of added topics to 64 (was 128) 2016-06-06 23:27:16 +02:00
Beat Küng
78d357cb0c logger: free up ~200B stack size
we now use the already existing buffer for logging messages, which is
allocated on the heap.
In fact, stack usage was too high before this, now it's ok again.
2016-06-06 23:27:16 +02:00
Beat Küng
febe75bb12 logger: don't use uint8_t buffer[msg_size]; (it's C99 not C++)
Also, it's not clear where the allocation was. It looks like it was on
the heap, but the compiler could decide to put it on the stack. This is
very bad for us because we use fixed size stacks with tights bounds. So if
a user specifies a large topic to log, it could have crashed.

Now the allocation is on the heap and the user can specify any size of
topic to log (as long as there is enough memory).
2016-06-06 23:27:16 +02:00
Beat Küng
8ef493c82d logger: use local time if orb_copy(vehicle_gps_position) fails for -t option
orb_copy can fail if there is no advertiser yet
2016-06-06 23:27:16 +02:00
Beat Küng
b51ec04938 logger: fix alignment issue in data message header 2016-06-06 23:27:16 +02:00
Beat Küng
0e3d660ccd logger refactor: add ulog_ prefix to struct names and header length 2016-06-02 07:32:49 +02:00
Beat Küng
034772056a logger: prepare for replay: add replayed file to the log, use _replayed as file name suffix 2016-06-02 07:32:49 +02:00
Beat Küng
069dd01cb0 logger: subscribe to mavlink_log messages and write them to the log 2016-06-02 07:32:49 +02:00
Beat Küng
659ac8faf2 refactor logger: use static fields & move them to source file
avoids multiple declarations of...
2016-06-02 07:32:49 +02:00
Lorenz Meier
4d4f8d25c2 Logger: Be more efficient 2016-05-29 16:26:47 +02:00
Beat Küng
7f3a95508e logger: move SDLOG_UTC_OFFSET param definition into logger module
It's still used in sdlog2, but once we'll depricate/remove sdlog2, we will
not remove this parameter as well.
2016-05-22 13:31:35 +02:00
Beat Küng
cd7c955067 logger: -t param: fall back to px4_clock_gettime if there's no gps fix 2016-05-22 13:31:35 +02:00
Beat Küng
a9930c2173 logger: avoid logging the padding if it's at the end of a message format 2016-05-22 13:31:35 +02:00
Beat Küng
bd96afa00b logger: use int32_t for utc_offset instead of uint32_t 2016-05-22 13:31:35 +02:00
Beat Küng
623fe7ca2c logger + uorb msg template: rm msg name from o_fields to save space
Instead we use o_name to get the topic name. Now the topic names are not
upper case anymore in the log format. This makes it more consistent, eg.
if used as a nested topic
2016-05-22 13:31:35 +02:00
Beat Küng
4f8d16cc4d logger: log dropout events 2016-05-22 13:31:35 +02:00
Beat Küng
c13247e14f logger: log all known formats, add ADD_LOGGED_MSG message
this is needed for nested topics.
2016-05-22 13:31:35 +02:00
Beat Küng
2d037d1a1c logger: add an MSG_HEADER_LEN to clarify meaning 2016-05-22 13:31:35 +02:00