Skip to content

src: tlog: Record received messages and serve them at /v1/tlog (0.x-dev port of #147) - #148

Open
Mattbusel wants to merge 1 commit into
mavlink:0.x-devfrom
Mattbusel:tlog-recording-0.x
Open

Mattbusel wants to merge 1 commit into
mavlink:0.x-devfrom
Mattbusel:tlog-recording-0.x

Conversation

@Mattbusel

Copy link
Copy Markdown

Port of #147 to 0.x-dev, so it can go into a 0.11.x release. BlueOS pins 0.11.28 (core/tools/mavlink2rest/bootstrap.sh).

Same behavior as #147:

  • --tlog <FILE> records every message received from the vehicle to a .tlog file (8 byte big-endian microsecond timestamp before each frame, the format QGroundControl, Mission Planner and MAVProxy read), appending to an existing file
  • GET /v1/tlog flushes and downloads it while the service runs
  • without --tlog nothing changes and the endpoint returns 404

Differences from the master version, forced by mavlink 0.10.14 on this branch:

  • the dialect path is mavlink::ardupilotmega instead of mavlink::dialects::ardupilotmega
  • the test decodes the frame back with mavlink::read_versioned_msg (0.10 has no MavlinkReader), and wraps the common HEARTBEAT in the ardupilotmega message type

Tested on Linux (Ubuntu 24.04, rustc 1.99.1):

$ cargo test
test cli::tests::default_arguments ... ok
test tlog::tests::recorded_messages_read_back ... ok
test result: ok. 2 passed; 0 failed

And against a running service: mavlink2rest -c udpin:127.0.0.1:14551 --tlog /tmp/t.tlog, five MAVLink 2 HEARTBEAT frames sent over UDP, then GET /v1/tlog returned 200 application/octet-stream with the five timestamped frames, and /v1/mavlink/vehicles/1/components/1/messages/HEARTBEAT showed the same message. Without --tlog, GET /v1/tlog returned 404 with the hint text.

Asked for by @rafaellehmkuhl on #147.

Port of mavlink#147 to 0.x-dev. Adds --tlog <FILE>: every message received
from the vehicle is written to a .tlog file (8 byte big-endian
microsecond timestamp before each frame, the format QGroundControl and
MAVProxy read), appending to an existing file. GET /v1/tlog flushes and
downloads it while the service runs. Without --tlog nothing changes and
the endpoint returns 404.
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.

1 participant