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 module to extract message values for use in scripting #106

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

bhannawa
Copy link
Contributor

@bhannawa bhannawa commented Nov 2, 2024

This commit creates a module extract_message for extracting contents from a ULog message into a list to be used for scripting with ULog files. The module contains one function that takes in a ULog file, the desired message, and optionally a start and end time and returns a list of records from the ULog message as key-value pairs. I created this code by modifying the ulog2csv module.

Copy link
Member

@bkueng bkueng left a comment

Choose a reason for hiding this comment

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

Generally looks good.

Can you add some unit test under https://github.com/PX4/pyulog/tree/main/test?

And can you check the relevant CI failures? https://github.com/PX4/pyulog/actions/runs/11639019887/job/32414624361?pr=106

pyulog/extract_message.py:8:0: C0301: Line too long (112/100) (line-too-long)
pyulog/extract_message.py:21:11: C0123: Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
pyulog/extract_message.py:49:12: C0200: Consider using enumerate instead of iterating with range and len (consider-using-enumerate)

pyulog/extract_message.py Outdated Show resolved Hide resolved
pyulog/extract_message.py Outdated Show resolved Hide resolved
…t_dataset(message), resolve CI failures (shorter lines, better type check, enumerate vs iterate), add basic unit test
@bhannawa
Copy link
Contributor Author

bhannawa commented Nov 10, 2024

Okay thanks for your input. I was able to implement the changes you suggested (ulog.data_list -> ulog.get_dataset(message), removing the messages.split) and resolve all the CI failures (related to this extract_message module). I did create a very basic unit test by modifying the ulog2csv test, but it is my first unit test so let me know if it needs some more work.

Copy link
Member

@bkueng bkueng left a comment

Choose a reason for hiding this comment

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

Looks good, thanks

@bkueng bkueng merged commit 6a18061 into PX4:main Nov 19, 2024
0 of 4 checks passed
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