mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-04 09:41:35 +08:00
mc_att: inject identification signal in att control output
This commit is contained in:
@@ -316,13 +316,26 @@ MulticopterAttitudeControl::Run()
|
||||
|
||||
Vector3f rates_sp = _attitude_control.update(q);
|
||||
|
||||
const hrt_abstime now = hrt_absolute_time();
|
||||
autotune_attitude_control_status_s pid_autotune;
|
||||
|
||||
if (_autotune_attitude_control_status_sub.copy(&pid_autotune)) {
|
||||
if ((pid_autotune.state == autotune_attitude_control_status_s::STATE_ROLL
|
||||
|| pid_autotune.state == autotune_attitude_control_status_s::STATE_PITCH
|
||||
|| pid_autotune.state == autotune_attitude_control_status_s::STATE_YAW
|
||||
|| pid_autotune.state == autotune_attitude_control_status_s::STATE_TEST)
|
||||
&& ((now - pid_autotune.timestamp) < 1_s)) {
|
||||
rates_sp += Vector3f(pid_autotune.rate_sp);
|
||||
}
|
||||
}
|
||||
|
||||
// publish rate setpoint
|
||||
vehicle_rates_setpoint_s v_rates_sp{};
|
||||
v_rates_sp.roll = rates_sp(0);
|
||||
v_rates_sp.pitch = rates_sp(1);
|
||||
v_rates_sp.yaw = rates_sp(2);
|
||||
_thrust_setpoint_body.copyTo(v_rates_sp.thrust_body);
|
||||
v_rates_sp.timestamp = hrt_absolute_time();
|
||||
v_rates_sp.timestamp = now;
|
||||
|
||||
_v_rates_sp_pub.publish(v_rates_sp);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user