mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-22 09:28:58 +00:00
commander: Keep vehicle_command_ack_s local
No need to keep this struct as global or alive while looping.
This commit is contained in:
committed by
Lorenz Meier
parent
7082cc13e0
commit
89a428fbfe
@@ -1996,17 +1996,15 @@ Mavlink::task_main(int argc, char *argv[])
|
||||
MavlinkOrbSubscription *status_sub = add_orb_subscription(ORB_ID(vehicle_status));
|
||||
uint64_t status_time = 0;
|
||||
MavlinkOrbSubscription *ack_sub = add_orb_subscription(ORB_ID(vehicle_command_ack));
|
||||
uint64_t ack_time = 0;
|
||||
/* We don't want to miss the first advertise of an ACK, so we subscribe from the
|
||||
* beginning and not just when the topic exists. */
|
||||
ack_sub->subscribe_from_beginning(true);
|
||||
|
||||
uint64_t ack_time = 0;
|
||||
MavlinkOrbSubscription *mavlink_log_sub = add_orb_subscription(ORB_ID(mavlink_log));
|
||||
|
||||
struct vehicle_status_s status;
|
||||
status_sub->update(&status_time, &status);
|
||||
struct vehicle_command_ack_s command_ack;
|
||||
ack_sub->update(&ack_time, &command_ack);
|
||||
|
||||
/* add default streams depending on mode */
|
||||
|
||||
@@ -2202,6 +2200,7 @@ Mavlink::task_main(int argc, char *argv[])
|
||||
|
||||
/* send command ACK */
|
||||
uint16_t current_command_ack = 0;
|
||||
struct vehicle_command_ack_s command_ack = {};
|
||||
|
||||
if (ack_sub->update(&ack_time, &command_ack)) {
|
||||
mavlink_command_ack_t msg;
|
||||
|
||||
Reference in New Issue
Block a user