Commit Graph

123 Commits

Author SHA1 Message Date
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 76d6ffd445 logger: use the defined interval for all multi-instances (& fix code style) 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
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
Beat Küng df803fc4b9 logger: remove redundant format_len from message_format_s 2016-05-22 13:31:35 +02:00
Beat Küng 971e97745f logger: reorder message header fields (for alignment) 2016-05-22 13:31:35 +02:00
Beat Küng 0ddd7a408c logger: write "sys_name" and "time_ref_utc" info to log file 2016-05-22 13:31:35 +02:00
Beat Küng 908f7eb47f logger: remove some comments, logging output 2016-05-22 13:31:35 +02:00
Beat Küng 1719d9a957 logger: add a file magic 2016-05-22 13:31:35 +02:00
Daniel Agar 97bcea292e logger.cpp fix style 2016-05-14 11:27:07 +02:00
Beat Küng 4b8152465d logger: unsubscribe from all topics when logger exits 2016-05-14 11:27:07 +02:00
Beat Küng 0f30bfa0ac logger: fix -e parameter (logger immediately stopped again after start) 2016-05-14 11:27:07 +02:00
Beat Küng fcf7e8b78c logger: -e option only logs until disarm, add -f option to log until shutdown 2016-05-14 11:27:07 +02:00
Beat Küng fc51f81bf5 logger: add free space check (need at least 50MB to start) 2016-05-14 11:27:07 +02:00
Beat Küng fe2b80ffb8 logger: add '-t' option to use GPS date/time for file and dir name 2016-05-14 11:27:07 +02:00
Beat Küng 9da2eac3d3 logger: remove unneeded start parameters (-x & -a) 2016-05-14 11:27:07 +02:00
Beat Küng ec6c53eb60 logger: correct cleanup in case 'logger start' fails 2016-05-14 11:27:07 +02:00
Beat Küng a0beef3204 logger: output error on failed to get log file name 2016-05-14 11:27:07 +02:00
Beat Küng d7f0808316 logger: create _vehicle_status_sub & _parameter_update_sub on stack
Since it's only used in run().
2016-05-14 11:27:07 +02:00
Beat Küng 4f0573d612 logger: reset _write_dropouts after status output 2016-05-14 11:27:07 +02:00
Beat Küng d5dcbf01d0 logger: add copyright to files 2016-05-14 11:27:07 +02:00
Beat Küng 04f301619f refactor LogWriter: remove friend class Logger and use the public interface 2016-05-14 11:27:07 +02:00
Beat Küng dde96dd4d7 logger: allocate _vehicle_status_sub & _parameter_update_sub on the logger thread
This makes sure the file descriptors are closed in the right thread.
Before on NuttX, when stopping the logger, orb unsubscribe failed due to
this.
2016-05-14 11:27:07 +02:00
Beat Küng 9a02dbdd66 logger: extend status ouput, disable DBGPRINT for now 2016-05-14 11:27:07 +02:00
Beat Küng 4ce658ab99 logger: move _writer.lock() call after write_changed_parameters()
write_changed_parameters() also takes the lock and thus would deadlock
otherwise.
2016-05-14 11:27:07 +02:00
Daniel Agar 3de7fbb0a9 logger and uORBTest_UnitTest astyle 2016-05-14 11:27:07 +02:00
Beat Küng 1edf03767a logger: KB/s -> kB/s 2016-05-14 11:27:07 +02:00
Beat Küng eabc43d78c orb structs: add padding bytes to align the structs where necessary
This is required for the logger, we just manually add the padding bytes
what would otherwise be done by the compiler. Additionally we reorder
the fields by type, so that padding is only necessary for nested types.
2016-05-14 11:27:07 +02:00
Daniel Agar 69c1ce1714 WIP logger serialization 2016-05-14 11:27:07 +02:00