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 blackbox device FILE for SITL build #10228

Merged
merged 3 commits into from
Jul 15, 2024

Conversation

bartslinger
Copy link
Contributor

To make logging for software-in-the-loop (SITL) easier, I added BLACKBOX_DEVICE_FILE as output option for Blackbox. This creates a file YYYY_MM_DD_HHMMSS.TXT when the controller is armed.

I tested this on 7.1.2, but on master I'm running into other issues which prevent me from arming the drone.

#endif
#if defined(SITL_BUILD)
case BLACKBOX_DEVICE_FILE:
fclose(blackboxFile.file_handler);
Copy link
Collaborator

Choose a reason for hiding this comment

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

set file_handler to NULL after closing

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point, thanks

@bartslinger
Copy link
Contributor Author

bartslinger commented Jul 12, 2024

Hmm still some problems with decoding the logfiles, please hold :)

@bartslinger
Copy link
Contributor Author

I'm not sure what's happening here. With 7.1.2, there seem to be +- 3 frames that fail to decode when using blackbox_decoder. It seems to be at the very beginning of the file because it also happens when I log for just one second.
I guess this is fine?

However when I run on master, everything fails to decode. I guess this is probably because the log messages have been updated and are not backwards compatible with the version of blackbox_decode? If that's the case, the problem is in the decoder and this pull request should be fine.

./blackbox_decode ~/git/inav/build_SITL/2024_07_12_233059.TXT
Decoding log '/Users/bart/git/inav/build_SITL/2024_07_12_233059.TXT' to '/Users/bart/git/inav/build_SITL/2024_07_12_233059.01.csv'...

Log 1 of 1Statistics
S frames      22   37.0 bytes avg      814 bytes total
Frames        0
Data rate: Unknown, no timing information available.

4129 frames failed to decode, rendering 4080 loop iterations unreadable. 1 iterations are missing in total (0ms, 100.00%)

Generated by INAV blackbox_decode 7.1.0 6eb2fe7

@stronnag
Copy link
Collaborator

stronnag commented Jul 12, 2024

The current BBL decoder works fine with 8.0.0 logs. The problem is most likely caused by the PR.
There is a inav8_rcmodes that supports the new INAV 8 RC modes, but I don't think that is your problem.

...

Checked: INAV 8.0.0 BBL generated by a FC are correctly read by either blackbox_decode master or inav8_rcmodes branches.

@stronnag
Copy link
Collaborator

I suspect that the SITL loop timing completely screws the log timing and framing. This was my conclusion when I attempted the same thing earlier (and paused the attempt as I didn't have time to look further).

@bartslinger
Copy link
Contributor Author

But that problem is somewhere else in the SITL code then, right? And it only surfaces now because this is the only viable way to get blackbox logs out of SITL.

I'm willing to go a little bit into that rabbit hole, but I could use some pointers on what has changed in SITL since 7.1.2.

@bartslinger
Copy link
Contributor Author

The problem is caused by the number of servo's being increased to 18 b6f2976

That is incompatible with max 16 servo's in the parser https://github.com/iNavFlight/blackbox-tools/blob/master/src/parser.h#L20

When I set it back to 16, the logfile produced by this pull request seems to be fine!

@stronnag
Copy link
Collaborator

Good catch. Keeping the tools up to date with the FC is a nightmare.
Can you please raise either an issue or PR in the blackbox tools repo?

@bartslinger
Copy link
Contributor Author

Good catch. Keeping the tools up to date with the FC is a nightmare. Can you please raise either an issue or PR in the blackbox tools repo?

iNavFlight/blackbox-tools#87

@mmosca
Copy link
Collaborator

mmosca commented Jul 13, 2024

Good catch. Keeping the tools up to date with the FC is a nightmare. Can you please raise either an issue or PR in the blackbox tools repo?

How can we handle this better?

@stronnag
Copy link
Collaborator

Good catch. Keeping the tools up to date with the FC is a nightmare. Can you please raise either an issue or PR in the blackbox tools repo?

How can we handle this better?

Don't know. I'm pretty well attuned to changes in things like rc_modes and remember to update those.
But it's easy for everyone (including the BBL tools maintainer) to miss other things. I saw your servo PR and (mea culpa) thought nothing more of it.

@mmosca mmosca merged commit 13bdac2 into iNavFlight:master Jul 15, 2024
23 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.

None yet

3 participants