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

AP_ExternalAHRS: Actualize handler and simulator of the Inertial Labs EAHRS #27850

Merged
merged 3 commits into from
Sep 14, 2024

Conversation

valbv
Copy link

@valbv valbv commented Aug 15, 2024

Fix bugs and add the new data handling

@valbv
Copy link
Author

valbv commented Aug 15, 2024

Hello guys, we also tested this changes in the real flight.
If you need some logs, we will try to provide it.

libraries/AP_ExternalAHRS/AP_ExternalAHRS_InertialLabs.cpp Outdated Show resolved Hide resolved
Comment on lines 259 to 260
CHECK_SIZE(u.gnss_time_ms);
nav_ins_data.ms_tow = u.gnss_time_ms;
Copy link
Contributor

Choose a reason for hiding this comment

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

I mean, yes, this is a correct change.

But it also occludes the history of the file content.

Do we really need this change?

I'll take note to try to stop this creeping in in the future....

Copy link
Author

Choose a reason for hiding this comment

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

Sorry, you mean this shift about switch-case or something else?
I returned it back to avoid this big diff

Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry, you mean this shift about switch-case or something else? I returned it back to avoid this big diff

Yes, minimising the diff is important. It makes review much faster, and if a PR needs reviewing multiple times it can be very frustrating.

In this case you appear to have changed 'gps' to 'gnss' - and while I understand that's a correct change, it's also unnecessary as the two are often used interchangably.

Copy link
Author

@valbv valbv Aug 21, 2024

Choose a reason for hiding this comment

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

Oh, now I understood, sorry. I renamed this because other structures related to GNSS were added to the processor and to the simulator.
And in order to keep all the names consistent with the documentation, I decided to use GNSS everywhere. To make it easier to find in documentation in the future.

Given this moment, will it better to rename all gnss (including new variables and structures) to gps?

Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the renames from gps to gnss. New stuff in this PR can use gnss, for now we treat them synonymously in ArduPilot.

This and the whitespace change significantly reduced my enthusiasm to review this PR!

If you want to come back and do a separate PR just to rename things in this new driver for consistency, I think I'd merge it. The code in here is very young, and such a change is provably correct by ensuring compiler output is identical before/after.

Don't bother reverting the simulator changes - I'm happy enough merging those.

Copy link
Author

Choose a reason for hiding this comment

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

Done, I removed all renaming changes

@peterbarker
Copy link
Contributor

This PR is actually looking pretty good. I'm really just arguing about the shape of the patches, not the additions and fixes you're making!

@valbv valbv force-pushed the ilabseahrs branch 2 times, most recently from bc69c5c to 47eb259 Compare August 21, 2024 23:13
@valbv valbv requested a review from peterbarker August 22, 2024 11:49
Copy link
Author

@valbv valbv left a comment

Choose a reason for hiding this comment

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

Commit with whitespace changes was removed

Should I resolve conversations after fixing or conversation starter will make it if it's done?

@valbv valbv force-pushed the ilabseahrs branch 2 times, most recently from 47ceea2 to 680b727 Compare August 30, 2024 09:49
@peterbarker
Copy link
Contributor

Commit with whitespace changes was removed

Thanks.

Should I resolve conversations after fixing or conversation starter will make it if it's done?

We don't have a solid attitude on this. I like to resolve the conversations that I've started, but I've seen plenty of people close them as they're done.

@@ -129,6 +129,7 @@ class AP_ExternalAHRS {
uint8_t instance;
float pressure_pa;
float temperature;
float altitude;
Copy link
Contributor

Choose a reason for hiding this comment

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

What frame is this in? Above geoid? AMSL?

Comment if nothing else

Copy link
Author

Choose a reason for hiding this comment

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

Done, I added a comment

Comment on lines 259 to 260
CHECK_SIZE(u.gnss_time_ms);
nav_ins_data.ms_tow = u.gnss_time_ms;
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove the renames from gps to gnss. New stuff in this PR can use gnss, for now we treat them synonymously in ArduPilot.

This and the whitespace change significantly reduced my enthusiasm to review this PR!

If you want to come back and do a separate PR just to rename things in this new driver for consistency, I think I'd merge it. The code in here is very young, and such a change is provably correct by ensuring compiler output is identical before/after.

Don't bother reverting the simulator changes - I'm happy enough merging those.

case MessageType::GNSS_ANGLES: {
CHECK_SIZE(u.gnss_angles);
gnss_data.heading = u.gnss_angles.heading*0.01; // deg
gnss_data.pitch = u.gnss_angles.pitch*0.01; // deg
Copy link
Contributor

Choose a reason for hiding this comment

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

pitch in gnss_data?!

I think there might be a reason it was generically called state2?

Copy link
Author

Choose a reason for hiding this comment

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

I try to use the same terms as in the device documentation
For consistency and simplifying code maintenance
image

*I can rename, if need it

@valbv
Copy link
Author

valbv commented Sep 2, 2024

Done, I removed all renaming changes

@valbv valbv force-pushed the ilabseahrs branch 2 times, most recently from 417d048 to 0f38a42 Compare September 3, 2024 06:29
@peterbarker
Copy link
Contributor

peterbarker commented Sep 10, 2024

Board                    AP_Periph  blimp  bootloader  copter  heli  iofirmware  plane  rover  sub
CubeOrange-periph-heavy  *
Durandal                            5688   *           5688    5704              5688   5680   5672
Hitec-Airspeed           *
KakuteH7-bdshot                     5336   *           5344    5344              5344   5328   5328
MatekF405                           *      *           *       *                 *      *      *
Pixhawk1-1M-bdshot                  *                  *       *                 *      *      *
f103-QiotekPeriph        *
f303-Universal           *
iomcu                                                                *
revo-mini                           *      *           *       *                 *      *      *
skyviper-v2450                                         *

That's a lot of extra bytes.

That's not necessarily a show-stopper, but for reference that's about 20% of the remaining flash space on our most popular board's bdshot build.

@valbv
Copy link
Author

valbv commented Sep 10, 2024

The comments appear to have been corrected.
What should I do to merge this PR?

@peterbarker
Copy link
Contributor

The comments appear to have been corrected. What should I do to merge this PR?

I've marked it for discussion at our DevCall meeting this-evening.

Copy link
Contributor

@tridge tridge left a comment

Choose a reason for hiding this comment

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

i think we should move this to custom build server only

@@ -129,6 +129,7 @@ class AP_ExternalAHRS {
uint8_t instance;
float pressure_pa;
float temperature;
float altitude; // m, above geoid
Copy link
Contributor

Choose a reason for hiding this comment

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

barometers don't measure altitude, they measure pressure

Copy link
Author

Choose a reason for hiding this comment

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

I removed this changes

baro_data.pressure_pa = u.baro_data.pressure_pa2*2;
baro_data.pressure_pa = u.baro_data.pressure_pa2*2; // Pa
state2.baro_alt = u.baro_data.baro_alt*0.01; // m
baro_data.altitude = state2.baro_alt; // m
Copy link
Contributor

Choose a reason for hiding this comment

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

should remove this

Copy link
Author

Choose a reason for hiding this comment

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

Done, I removed this changes

@peterbarker
Copy link
Contributor

We have an intent to make all ExternalAHRS drivers not built into ArduPilot by default in ArduPilot 4.7.

That would require users to use custom.ardupilot.org to include any ExternalAHRS driver.

@peterbarker
Copy link
Contributor

We can merge this once the API change to the EXternalAHRS library has been removed

@valbv valbv requested a review from tridge September 13, 2024 11:44
@peterbarker peterbarker merged commit 79bd823 into ArduPilot:master Sep 14, 2024
95 checks passed
@peterbarker
Copy link
Contributor

Merged, thanks!

@valbv
Copy link
Author

valbv commented Sep 14, 2024

Thanks for revirew!

@valbv valbv deleted the ilabseahrs branch September 16, 2024 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants