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_AHRS: stop updating AOA and SSA in accessors #18088

Merged
merged 2 commits into from Jul 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion ArduPlane/Plane.h
Expand Up @@ -866,7 +866,6 @@ class Plane : public AP_Vehicle {
void Log_Write_Status();
void Log_Write_RC(void);
void Log_Write_Vehicle_Startup_Messages();
void Log_Write_AOA_SSA();
void Log_Write_AETR();
void Log_Write_MavCmdI(const mavlink_command_int_t &packet);
void log_init();
Expand Down
3 changes: 3 additions & 0 deletions libraries/AP_AHRS/AP_AHRS.cpp
Expand Up @@ -320,6 +320,9 @@ void AP_AHRS::update(bool skip_ins_update)
_view->update(skip_ins_update);
}

// update AOA and SSA
update_AOA_SSA();

#if HAL_NMEA_OUTPUT_ENABLED
// update NMEA output
if (_nmea_out != nullptr) {
Expand Down
12 changes: 12 additions & 0 deletions libraries/AP_AHRS/AP_AHRS.h
Expand Up @@ -324,6 +324,18 @@ class AP_AHRS : public AP_AHRS_DCM {
// create a view
AP_AHRS_View *create_view(enum Rotation rotation, float pitch_trim_deg=0);

// write AOA and SSA information to dataflash logs:
void Write_AOA_SSA(void) const;

// update AOA and SSA values
virtual void update_AOA_SSA(void);

// return AOA
float getAOA(void) const { return _AOA; }

// return SSA
float getSSA(void) const { return _SSA; }

protected:
// optional view class
AP_AHRS_View *_view;
Expand Down
16 changes: 1 addition & 15 deletions libraries/AP_AHRS/AP_AHRS_Backend.cpp
Expand Up @@ -248,7 +248,7 @@ AP_AHRS_View *AP_AHRS::create_view(enum Rotation rotation, float pitch_trim_deg)
* "ANGLE OF ATTACK AND SIDESLIP ESTIMATION USING AN INERTIAL REFERENCE PLATFORM" by
* JOSEPH E. ZEIS, JR., CAPTAIN, USAF
*/
void AP_AHRS_Backend::update_AOA_SSA(void)
void AP_AHRS::update_AOA_SSA(void)
{
#if APM_BUILD_TYPE(APM_BUILD_ArduPlane)
const uint32_t now = AP_HAL::millis();
Expand Down Expand Up @@ -294,20 +294,6 @@ void AP_AHRS_Backend::update_AOA_SSA(void)
#endif
}

// return current AOA
float AP_AHRS_Backend::getAOA(void)
{
update_AOA_SSA();
return _AOA;
}

// return calculated SSA
float AP_AHRS_Backend::getSSA(void)
{
update_AOA_SSA();
return _SSA;
}

// rotate a 2D vector from earth frame to body frame
Vector2f AP_AHRS_Backend::earth_to_body2D(const Vector2f &ef) const
{
Expand Down
9 changes: 0 additions & 9 deletions libraries/AP_AHRS/AP_AHRS_Backend.h
Expand Up @@ -514,12 +514,6 @@ class AP_AHRS_Backend
AP::ins().get_delta_velocity(ret, dt);
}

// return calculated AOA
float getAOA(void);

// return calculated SSA
float getSSA(void);

// rotate a 2D vector from earth frame to body frame
// in result, x is forward, y is right
Vector2f earth_to_body2D(const Vector2f &ef_vector) const;
Expand All @@ -537,8 +531,6 @@ class AP_AHRS_Backend
Vector3f earth_to_body(const Vector3f &v) const {
return get_rotation_body_to_ned().mul_transpose(v);
}

virtual void update_AOA_SSA(void);

// get_hgt_ctrl_limit - get maximum height to be observed by the
// control loops in meters and a validity flag. It will return
Expand Down Expand Up @@ -571,7 +563,6 @@ class AP_AHRS_Backend

// Logging to disk functions
void Write_AHRS2(void) const;
void Write_AOA_SSA(void); // should be const? but it calls update functions
void Write_Attitude(const Vector3f &targets) const;
void Write_Origin(uint8_t origin_type, const Location &loc) const;
void Write_POS(void) const;
Expand Down
3 changes: 0 additions & 3 deletions libraries/AP_AHRS/AP_AHRS_DCM.cpp
Expand Up @@ -112,9 +112,6 @@ AP_AHRS_DCM::update(bool skip_ins_update)
// update trig values including _cos_roll, cos_pitch
update_trig();

// update AOA and SSA
update_AOA_SSA();

peterbarker marked this conversation as resolved.
Show resolved Hide resolved
backup_attitude();

// update takeoff/touchdown flags
Expand Down
2 changes: 1 addition & 1 deletion libraries/AP_AHRS/AP_AHRS_Logging.cpp
Expand Up @@ -32,7 +32,7 @@ void AP_AHRS_Backend::Write_AHRS2() const
}

// Write AOA and SSA
void AP_AHRS_Backend::Write_AOA_SSA(void)
void AP_AHRS::Write_AOA_SSA(void) const
{
const struct log_AOA_SSA aoa_ssa{
LOG_PACKET_HEADER_INIT(LOG_AOA_SSA_MSG),
Expand Down