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 AP_AirSensor library #29219

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Add AP_AirSensor library #29219

wants to merge 7 commits into from

Conversation

Ryanf55
Copy link
Collaborator

@Ryanf55 Ryanf55 commented Feb 3, 2025

Looking for initial feedback- see the README.

A bit of an alternative to #29107 that leaves AP_Airspeed as is

Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
* Scripting bindings don't seem to show up yet

Signed-off-by: Ryan Friedman <[email protected]>
Signed-off-by: Ryan Friedman <[email protected]>
enum class Type {
NONE,
#if AP_AIRSENSOR_SCRIPTING_ENABLED
SCRIPTING
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
SCRIPTING
SCRIPTING,

_backend_type = (AP_AirSensor::Type )_params.type.get();
}

bool AP_AirSensor_Backend::get_aoa(float& a) const {
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's be consistent about where that opening brace is!

ArduPilot convention is on a fresh line, but we differ across libraries

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'll run astyle on all this before it's actually put up for review. I'm more concerned with architecture than code style at this moment.

Comment on lines +26 to +34
virtual bool init() = 0;
virtual ~AP_AirSensor_Backend() {}
virtual void update() = 0;
// get measured wind vector [m/s]
virtual bool get_wind(Vector3f& wind_uvw) const { return false; }
// get measured angle of attack [rad]
virtual bool get_aoa(float& a) const;

#if AP_SCRIPTING_ENABLED
Copy link
Contributor

Choose a reason for hiding this comment

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

certical whitespace here somewhere, please!

#endif

#ifndef AP_AIRSENSOR_SCRIPTING_ENABLED
#define AP_AIRSENSOR_SCRIPTING_ENABLED (AP_AIRSENSOR_ENABLED && AP_SCRIPTING_ENABLED)
Copy link
Contributor

Choose a reason for hiding this comment

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

create an AP_AIRSENSOR_BACKEND_DEFAULT_ENABLED

@Ryanf55
Copy link
Collaborator Author

Ryanf55 commented Feb 4, 2025

  • For supporting replay, it's only for logging EKF data - we don't have way to "replay" outside of EKF
  • We could use this in EKF3 only if the P matrix is 3D - the state vector is 2F, but the EKF returns a 3D vector
  • In the EKF outputs, it returns a 3D, it hard codes AP_navekf3, we would go from 24 to 25 state EKF- we should ask Paul
  • We could augment the input side of the EKF with body frame wind
  • We seem like we would want move forward with this, we should disable it by default, and can at least gather some data on a real vehicle to see how well the 3D airspeed correlates

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.

3 participants