Is there a way to get newest mission / waypoints from FCU ?
Hi: I want to get the latest waypoints, but the update of the waypoints topic seems random to me, and it is possible to get the waypoints before the pull through mission/pull + waypoints callback function. Is there a way to actively get the waypoints that are guaranteed to be the latest?
case1:
call pull service here
// global variable waypoints here may be old;
case2:
called = False
call pull service here
// waypoints callback was called and set called to True in another thread
while not called:
pass
// global variable waypoints may still be old, becuase I run ros::spin and above code in two thread
Subscribe to waypoints, then call pull and wait till it done. wp_received must match the list.
Subscribe to waypoints, then call pull and wait till it done. wp_received must match the list.
Thanks for your reply. I saved the waypoints obtained in the waypoints callback function in a global variable. Now I am not sure whether the latest waypoints can be obtained when the next line of code accesses the variable after the pull is completed (my FCU may have a set of old waypoints before the update). According to the results of my test, there is a certain probability that the variable is the previous waypoints.
Synchronisation in your code is a bit out of scope. Just a suggestion to use cond vars / events to wait for waypoint subscriber callback to process the message. Once you start pull - you should get the current state.