Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add high-speed data logging #3780

Merged
merged 7 commits into from
Feb 26, 2022
Merged

Conversation

PeterJohnson
Copy link
Member

@PeterJohnson PeterJohnson commented Dec 11, 2021

Features:

  • The data is buffered and written periodically to disk on a background thread
  • The file is opened immediately and may be renamed at any time
  • The data format is simple and designed to be append only; it performs no rewrites of previously written data and the periodic write approach limits flash wear
  • Data format supports named entries, arbitrary data types, and entry metadata
  • Data format is binary for maximum speed and every record is timestamped

TODO:

  • Writer API
    • C++
    • Java
  • Reader API and example
    • C++
    • Java
    • Python
  • Download tool
  • CSV/JSON conversion tools
  • ntcore interface to writer
  • cscore interface to writer
  • DataLogManager - automated robot side management of data files
    • cleanup of old files when disk space gets too full
    • set filename based on date/time/match number
    • log DS joystick data
    • log NT value changes
    • preferentially save to USB stick if one is mounted
    • change Java to use start() rather than just static construction
    • add option to start() to override directory?
    • add standard "messages" entry
  • Unit tests
  • Examples
  • AsciiDoc standalone documentation of file format
  • User-facing documentation

Fixes #2090.

@ajwharton
Copy link

Curious as to the rationale of this library as opposed to the myriad of standard logging facilities in Java currently. Is it meant to be smaller? Faster? Less overhead?

@PeterJohnson
Copy link
Member Author

Standard logging facilities are generally designed for string messages, not for binary data. So something custom like this is going to be faster with less overhead for the typical data (e.g. numbers) coming from a robot in real time (at least dozens, if not hundreds, of data points every ~20 ms). String formatting is significantly more expensive than just copying the binary number, and is more difficult to read back into analysis tools. Latency of the actual logging to the main program is also critical in our application. We also need a logging format and implementation that works in both C++ and Java.

@Starlight220
Copy link
Member

It looks very similar to the NTEntry API, and I assume that many teams will be using both logging and telemetry for the same value sources. Maybe merge the two, reusing symbols, or at least make it trivial to add logging to a telemetry setup and the other way around?

@PeterJohnson
Copy link
Member Author

My current plan is for the DataLogManager to write all NT value changes to the "main" data log.

@PeterJohnson PeterJohnson force-pushed the datalog-new branch 6 times, most recently from a6f0b14 to 74061ec Compare December 28, 2021 00:48
@PeterJohnson PeterJohnson force-pushed the datalog-new branch 10 times, most recently from 6a19027 to ce2ce44 Compare January 4, 2022 18:50
@PeterJohnson PeterJohnson force-pushed the datalog-new branch 2 times, most recently from 1be9844 to a42919d Compare January 31, 2022 08:15
@PeterJohnson
Copy link
Member Author

@virtuald for your awareness

@PeterJohnson PeterJohnson force-pushed the datalog-new branch 3 times, most recently from 52da984 to b5e7667 Compare February 26, 2022 06:30
@PeterJohnson PeterJohnson marked this pull request as ready for review February 26, 2022 06:32
@PeterJohnson PeterJohnson requested review from a team as code owners February 26, 2022 06:32
@PeterJohnson PeterJohnson force-pushed the datalog-new branch 4 times, most recently from 0f5b2cf to 427dfcc Compare February 26, 2022 08:57
ThadHouse
ThadHouse previously approved these changes Feb 26, 2022
This creates a default log file that captures NT changes and
automatically renames the log file based on time and match info.

DriverStation joystick logging will be implemented by the DriverStation
class instead.
This is a support tool for datalog file conversion (and eventually
download/remote datalog file management).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add proper logging
5 participants