mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-13 14:10:35 +08:00
mavlink: properly initialize vehicle_command queue
This makes sure that the vehicle_command topic is properly initialized from the beginning. orb_exists returns -1 or 0 and not a bool as one would expect.
This commit is contained in:
@@ -118,7 +118,7 @@ Mavlink::Mavlink() :
|
||||
}
|
||||
|
||||
// ensure topic exists, otherwise we might lose first queued commands
|
||||
if (!orb_exists(ORB_ID(vehicle_command), 0)) {
|
||||
if (orb_exists(ORB_ID(vehicle_command), 0) == PX4_ERROR) {
|
||||
orb_advertise_queue(ORB_ID(vehicle_command), nullptr, vehicle_command_s::ORB_QUEUE_LENGTH);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user