Browse Source

AR_AttitudeControl: add get_desired_pitch accessor

master
Randy Mackay 7 years ago
parent
commit
9b60e0844b
  1. 11
      libraries/APM_Control/AR_AttitudeControl.cpp
  2. 3
      libraries/APM_Control/AR_AttitudeControl.h

11
libraries/APM_Control/AR_AttitudeControl.cpp

@ -522,6 +522,17 @@ float AR_AttitudeControl::get_throttle_out_from_pitch(float desired_pitch, bool @@ -522,6 +522,17 @@ float AR_AttitudeControl::get_throttle_out_from_pitch(float desired_pitch, bool
return constrain_float(_pitch_to_throttle_pid.get_pid(), -1.0f, +1.0f);
}
// get latest desired pitch in radians for reporting purposes
float AR_AttitudeControl::get_desired_pitch() const
{
// if not called recently, return 0
if ((_balance_last_ms == 0) || ((AP_HAL::millis() - _balance_last_ms) > AR_ATTCONTROL_TIMEOUT_MS)) {
return 0.0f;
}
return _pitch_to_throttle_pid.get_pid_info().desired;
}
// get forward speed in m/s (earth-frame horizontal velocity but only along vehicle x-axis). returns true on success
bool AR_AttitudeControl::get_forward_speed(float &speed) const
{

3
libraries/APM_Control/AR_AttitudeControl.h

@ -94,6 +94,9 @@ public: @@ -94,6 +94,9 @@ public:
// desired_pitch is in radians
float get_throttle_out_from_pitch(float desired_pitch, bool armed, float dt);
// get latest desired pitch in radians for reporting purposes
float get_desired_pitch() const;
// low level control accessors for reporting and logging
AC_P& get_steering_angle_p() { return _steer_angle_p; }
AC_PID& get_steering_rate_pid() { return _steer_rate_pid; }

Loading…
Cancel
Save