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

MAVExplorer: Fix stats command for DF text and TLOG logs #1309

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

shancock884
Copy link
Contributor

When looking at something else, I noticed that when using the 'stats' command in MAVExplorer with either DF text logs or TLOGs it raises an Exception for different reasons.

  • DF Text logs: KeyError: 128
  • TLOGs: ERROR in command []: 'mavmmaplog' object has no attribute 'filehandle'

It looks like TLOGs were not supported, but should at least have given a nicer error message. But while here, I have added the support for them.

Summary of changes needed:
For DF text logs:

For TLOG:

  • As there isn't a formats attribute on the mavmmaplog class (as used for Tlogs), I am counting message instances rather than size in bytes. Output formatting is adjusted to take account of the longest name.
  • The 'filehandle' attribute is named 'f' instead in mavmmaplog class (as used for Tlogs), so updated MPDataLogChildTask class of multiproc_util.py to handle either, using 'hasattr'.

The new output for TLogs looks something like this (abbreviated):

Total number of messages: 96576
REMOTE_LOG_BLOCK_STATUS    0.00%
AUTOPILOT_VERSION          0.00%
...
VIBRATION                  3.17%
MISSION_CURRENT            3.17%
HEARTBEAT                  3.50%
NAMED_VALUE_FLOAT          6.25%

@OTHER 100.00%

I've tested files of all three types (bin, log, tlog), and checked stats command works in each case.

For DF text: name not message id is used to index counts, and count is
not set for messages that are never seen.

For TLOG: As we don't have a formats attribute on the mavmmaplog class,
we count message instances rather than size in bytes.
Output formatting is adjusted to take account of the longest name.

The filehandle attribute is called f instead in mavmmaplog class, so
updated MPDataLogChildTask class of multiproc_util.py to handle this.
Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be nice to get tlog usages in bytes - useful for fixing link bandwidth issues.

We might just be able to do a len on the byte-content of the message which we stash away in the Python ovject somewhere, I think. OTOH, it might be zero-pad-extended or it might not have timestamps, so delving reuqured!

Anyway, thanks, this has bugged me for a while, merging it!

@peterbarker peterbarker merged commit 6b30791 into ArduPilot:master Jan 24, 2024
2 checks passed
@shancock884 shancock884 deleted the msgstats-on-tlogs branch January 25, 2024 07:40
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.

2 participants