Skip to content

Commit

Permalink
AC_AttitudeControl: rate_controller_run_dt() takes dt as last argument
Browse files Browse the repository at this point in the history
  • Loading branch information
andyp1per authored and peterbarker committed Sep 26, 2024
1 parent 15de449 commit eeda86c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion libraries/AC_AttitudeControl/AC_AttitudeControl.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ class AC_AttitudeControl {
virtual void rate_controller_target_reset() {}

// optional variant to allow running with different dt
virtual void rate_controller_run_dt(float dt, const Vector3f& gyro) { AP_BoardConfig::config_error("rate_controller_run_dt() must be defined"); };
virtual void rate_controller_run_dt(const Vector3f& gyro, float dt) { AP_BoardConfig::config_error("rate_controller_run_dt() must be defined"); };

// Convert a 321-intrinsic euler angle derivative to an angular velocity vector
void euler_rate_to_ang_vel(const Quaternion& att, const Vector3f& euler_rate_rads, Vector3f& ang_vel_rads);
Expand Down
4 changes: 2 additions & 2 deletions libraries/AC_AttitudeControl/AC_AttitudeControl_Multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ void AC_AttitudeControl_Multi::update_throttle_rpy_mix()
_throttle_rpy_mix = constrain_float(_throttle_rpy_mix, 0.1f, AC_ATTITUDE_CONTROL_MAX);
}

void AC_AttitudeControl_Multi::rate_controller_run_dt(float dt, const Vector3f& gyro)
void AC_AttitudeControl_Multi::rate_controller_run_dt(const Vector3f& gyro, float dt)
{
// take a copy of the target so that it can't be changed from under us.
Vector3f ang_vel_body = _ang_vel_body;
Expand Down Expand Up @@ -481,7 +481,7 @@ void AC_AttitudeControl_Multi::rate_controller_target_reset()
void AC_AttitudeControl_Multi::rate_controller_run()
{
Vector3f gyro_latest = _ahrs.get_gyro_latest();
rate_controller_run_dt(_dt, gyro_latest);
rate_controller_run_dt(gyro_latest, _dt);
}

// sanity check parameters. should be called once before takeoff
Expand Down
2 changes: 1 addition & 1 deletion libraries/AC_AttitudeControl/AC_AttitudeControl_Multi.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class AC_AttitudeControl_Multi : public AC_AttitudeControl {
bool is_throttle_mix_min() const override { return (_throttle_rpy_mix < 1.25f * _thr_mix_min); }

// run lowest level body-frame rate controller and send outputs to the motors
void rate_controller_run_dt(float dt, const Vector3f& gyro) override;
void rate_controller_run_dt(const Vector3f& gyro, float dt) override;
void rate_controller_target_reset() override;
void rate_controller_run() override;

Expand Down

0 comments on commit eeda86c

Please sign in to comment.