mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-01 21:24:08 +08:00
mc_rate_control: RateControl inline simple getters/setters
- these are typically called on every iteration
This commit is contained in:
parent
42845d6c6e
commit
263d2d6e2b
@ -47,13 +47,6 @@ void RateControl::setGains(const Vector3f &P, const Vector3f &I, const Vector3f
|
||||
_gain_d = D;
|
||||
}
|
||||
|
||||
void RateControl::setSaturationStatus(const Vector<bool, 3> &saturation_positive,
|
||||
const Vector<bool, 3> &saturation_negative)
|
||||
{
|
||||
_control_allocator_saturation_positive = saturation_positive;
|
||||
_control_allocator_saturation_negative = saturation_negative;
|
||||
}
|
||||
|
||||
Vector3f RateControl::update(const Vector3f &rate, const Vector3f &rate_sp, const Vector3f &angular_accel,
|
||||
const float dt, const bool landed)
|
||||
{
|
||||
@ -102,10 +95,3 @@ void RateControl::updateIntegral(Vector3f &rate_error, const float dt)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RateControl::getRateControlStatus(rate_ctrl_status_s &rate_ctrl_status)
|
||||
{
|
||||
rate_ctrl_status.rollspeed_integ = _rate_int(0);
|
||||
rate_ctrl_status.pitchspeed_integ = _rate_int(1);
|
||||
rate_ctrl_status.yawspeed_integ = _rate_int(2);
|
||||
}
|
||||
|
||||
@ -76,7 +76,11 @@ public:
|
||||
* @param control saturation vector from control allocator
|
||||
*/
|
||||
void setSaturationStatus(const matrix::Vector<bool, 3> &saturation_positive,
|
||||
const matrix::Vector<bool, 3> &saturation_negative);
|
||||
const matrix::Vector<bool, 3> &saturation_negative)
|
||||
{
|
||||
_control_allocator_saturation_positive = saturation_positive;
|
||||
_control_allocator_saturation_negative = saturation_negative;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run one control loop cycle calculation
|
||||
@ -98,7 +102,12 @@ public:
|
||||
* Get status message of controller for logging/debugging
|
||||
* @param rate_ctrl_status status message to fill with internal states
|
||||
*/
|
||||
void getRateControlStatus(rate_ctrl_status_s &rate_ctrl_status);
|
||||
void getRateControlStatus(rate_ctrl_status_s &rate_ctrl_status) const
|
||||
{
|
||||
rate_ctrl_status.rollspeed_integ = _rate_int(0);
|
||||
rate_ctrl_status.pitchspeed_integ = _rate_int(1);
|
||||
rate_ctrl_status.yawspeed_integ = _rate_int(2);
|
||||
}
|
||||
|
||||
private:
|
||||
void updateIntegral(matrix::Vector3f &rate_error, const float dt);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user