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

Added inertial sensor consistency checking for LUA access #26162

Merged
merged 3 commits into from
Feb 9, 2024

Conversation

haydendonald
Copy link
Contributor

Added ins:gyros_consistent(threshold, consistency_seconds) and ins:accels_consistent(threshold, consistency_seconds) for access to LUA for our testing requirements.

With this i also moved ins_accels_consistent and ins_gyros_consistent from AP_Arming to AP_IntertialSensor as i feel that this makes more sense. If this was still in AP_Arming you would need to pass the ins to the function via scripting which i'm not entirely sure how to do.

I also added the threshold and consistency_seconds to be parameters as they were hard coded previously and we need to be sensitive via scripting.

libraries/AP_InertialSensor/AP_InertialSensor.cpp Outdated Show resolved Hide resolved
libraries/AP_InertialSensor/AP_InertialSensor.cpp Outdated Show resolved Hide resolved
libraries/AP_InertialSensor/AP_InertialSensor.cpp Outdated Show resolved Hide resolved
libraries/AP_InertialSensor/AP_InertialSensor.cpp Outdated Show resolved Hide resolved
@bugobliterator bugobliterator force-pushed the pr-add-consistency-scripting branch from 06d1beb to ff2dcf2 Compare February 7, 2024 08:34
Copy link
Member

@IamPete1 IamPete1 left a comment

Choose a reason for hiding this comment

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

Passing in the threshold is a a little odd because it updates the last_pass_ms. This means a script could block arming if it kept checking with a smaller threshold.

I think the IMU method should be a const pass/fail with threshold. The caller (arming or scripting) can then do the time consistency bit.

You could always get round the same problem by hard coding the threshold of course.

I think there are enough bindings that this check could be done 100% in the scripting?

@haydendonald haydendonald force-pushed the pr-add-consistency-scripting branch from fd52c1c to a32e2a8 Compare February 7, 2024 23:56
@bugobliterator bugobliterator force-pushed the pr-add-consistency-scripting branch from a32e2a8 to c880372 Compare February 8, 2024 00:46
Copy link
Member

@IamPete1 IamPete1 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, but needs a rebase.

Move the accel_consistent and gyro_consistent methods from AP_Arming to AP_IntertialSensor
Move the accel_consistent and gyro_consistent methods from AP_Arming to AP_IntertialSensor
Added the accels_consistent and gyros_consistent methods to the lua bindings
@bugobliterator bugobliterator force-pushed the pr-add-consistency-scripting branch from c880372 to 2b332ac Compare February 9, 2024 01:46
@bugobliterator
Copy link
Member

Looks good, but needs a rebase.

Rebased.

@tridge tridge merged commit 52409d6 into ArduPilot:master Feb 9, 2024
93 checks passed
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.

4 participants