mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-12-02 14:30:59 +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:
1 parent
00cc1323ea
commit
60235f8474
1 file changed
+1
-1
@@ -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