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

Use sample time in Attitude logging #28005

Closed
wants to merge 2 commits into from

Conversation

andyp1per
Copy link
Collaborator

@andyp1per andyp1per commented Sep 4, 2024

When interpreting rate and attitude control logs it is important to be able to correlate the log message with when the data was captured rather than when the log was written. This is especially important as we increase the frequency of the rate loop and make it asynchronous. This small change adds the ability to capture the sample time from the scheduler and then uses that in the attitude log message.

Split from #27029

@andyp1per andyp1per changed the title Pr att log Use sample time in Attitude logging Sep 4, 2024
@andyp1per andyp1per marked this pull request as ready for review September 4, 2024 11:58
@peterbarker
Copy link
Contributor

Pretty sure we used to do this, and it allowed time to go backwards in logs, and that was painful when you were trying to compare messages...

Maybe an extra field?

@andyp1per
Copy link
Collaborator Author

Pretty sure we used to do this, and it allowed time to go backwards in logs, and that was painful when you were trying to compare messages...

Maybe an extra field?

Do we guarantee that logs are monotonically increasing? I guess if we do then an extra field would be the way, but that will make log analysis of these messages harder

@lthall
Copy link
Contributor

lthall commented Sep 5, 2024

Pretty sure we used to do this, and it allowed time to go backwards in logs, and that was painful when you were trying to compare messages...

Maybe an extra field?

I don't recall this but we have line numbers and a time stamp. I don't see why we would have a time stamp associated with the time the log message was communicated to the logging thread rather than the time the data in the message was relevant.

@IamPete1
Copy link
Member

IamPete1 commented Sep 9, 2024

Will need a rework after #28026 has been merged.

@andyp1per andyp1per force-pushed the pr-att-log branch 2 times, most recently from 394b89a to f874287 Compare September 9, 2024 10:53
@@ -173,7 +173,7 @@ class AP_AHRS_View
}

// Logging Functions
void Write_AttitudeView(const Vector3f &targets) const;
Copy link
Contributor

Choose a reason for hiding this comment

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

random whitespace change

@@ -53,14 +54,15 @@ void AP_AHRS::Write_Attitude(const Vector3f &targets) const
{
const struct log_Attitude pkt{
LOG_PACKET_HEADER_INIT(LOG_ATTITUDE_MSG),
time_us : AP_HAL::micros64(),
time_us : AP::scheduler().get_loop_start_time_us(),
Copy link
Contributor

Choose a reason for hiding this comment

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

This introduces a coupling between AHRS and the scheduler.

We merged a change to use the sample time in the rate message - this uses a different pattern where we don't pass that timestamp in...

@peterbarker
Copy link
Contributor

Resolution at DevCall is that we'll create an ANG message!

Which I think means we want to close this!

@tridge
Copy link
Contributor

tridge commented Sep 10, 2024

we decided to create an ANG message in AC_AttitudeControl instead

@peterbarker
Copy link
Contributor

Closing this one as we're going with ANG. Reopen if we were wrong, please.

@andyp1per andyp1per deleted the pr-att-log branch September 10, 2024 12:41
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.

7 participants