-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
MAVExplorer: Add logmessage download and help commands, using meta-data from autotest web site #1337
Conversation
On Wed, 13 Mar 2024, Simon Hancock wrote:
In that case should probably use a subfolder for param XMLs too (separate PR).
Indeed.
|
a3c44be
to
1b07864
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very cool.
MAVProxy/tools/MAVExplorer.py
Outdated
'''show log message information''' | ||
mlog = mestate.mlog | ||
usage = "Usage: logmessage <help|download>" | ||
if len(args) > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if len(args) > 0: | |
if len(args) <= 0: | |
print(usage) | |
return | |
... save indenting / context complication
.... logmessage list
to show fields which are understood, perhaps? Or are in the intersection of what help can provide and what's in the log? ("future enhancement" :-) )
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
logmessage list is probably a quick enough thing for me to add now.
The tab completion gives only the messages that exist in the log file, but you can actually ask for help on any message in the XML for the current vehicle type.
MAVProxy/tools/MAVExplorer.py
Outdated
mlog.metadata.print_help(args[1]) | ||
return | ||
if args[0] == 'download': | ||
# download XML files for log messages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Length-wise, this is on the border of making a new separate cmd_logmessage_download
a good idea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that download is now implemented on pymavlink side, this code is shorter, so I maybe length is now OK to keep here?
Use DFMetaData.download to download XML files to .pymavlink/LogMessages Use DFMetaData.print_help to print logmessage help Apply suggestions, and perform flake8 check on new code Co-authored-by: Peter Barker <pb-gh@barker.dropbear.id.au>
8b150e6
to
e2003e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Tested it.
Merging, thanks!
# Skip XML files in the LogMessages subfolder | ||
if os.path.basename(dirname) == "LogMessages": | ||
continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need this bit any more.
The aim of this PR is to start making use of the LogMessage xml files in MAVExplorer.
This PR adds the commands "logmessage download" and "logmessage help " to MAVExplorer.
The download command will download all LogMessage XMLs to the user's .mavproxy folder.
The help command calls mlog.metadata.print_help(msg) method on the new DFMetaData class (links to PR ArduPilot/pymavlink#929).
The DFMetaData class is implemented in DFReader.py file, within pymavlink, so that other tools, such as mavlogdump can access the meta data on a loaded DF file without a dependency on MAVProxy. For example, to provide the enum strings and bitmask information when doing "mavlogdump --verbose".
Any call to mlog.metadata is protected with hasattr(mlog,'metadata') in case mlog is a TLOG or if the the pymavlink in use is older, and does not yet have the attribute.
I also updated load_graphs function to avoid XML warnings when it tries to load *.xml from .mavproxy folder.
An example of the output is as follows: