mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
mavlink ATTITUDE_TARGET: send also if vehicle_attitude_setpoint is not updated
This is the case in MC acro
This commit is contained in:
parent
2a84afb6a2
commit
9fbbcc9c73
@ -58,12 +58,27 @@ private:
|
||||
|
||||
uORB::Subscription _att_sp_sub{ORB_ID(vehicle_attitude_setpoint)};
|
||||
uORB::Subscription _att_rates_sp_sub{ORB_ID(vehicle_rates_setpoint)};
|
||||
hrt_abstime _last_att_sp_update{0};
|
||||
|
||||
bool send() override
|
||||
{
|
||||
vehicle_attitude_setpoint_s att_sp;
|
||||
|
||||
bool updated = false;
|
||||
|
||||
if (_att_sp_sub.update(&att_sp)) {
|
||||
_last_att_sp_update = att_sp.timestamp;
|
||||
updated = true;
|
||||
|
||||
} else if (hrt_elapsed_time(&_last_att_sp_update) > 500_ms) {
|
||||
if (!_att_sp_sub.copy(&att_sp)) {
|
||||
att_sp = {};
|
||||
}
|
||||
|
||||
updated = _att_rates_sp_sub.updated();
|
||||
}
|
||||
|
||||
if (updated) {
|
||||
mavlink_attitude_target_t msg{};
|
||||
|
||||
msg.time_boot_ms = att_sp.timestamp / 1000;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user