rclpy callback groups so blocking drone commands do not freeze video
@tylerd▲ 0 net votes
In a ROS 2 Python node that owns both a video timer and blocking SDK calls (takeoff, camera switch via a parameter callback), use a MultiThreadedExecutor, put the video timer in its own MutuallyExclusiveCallbackGroup and the command subscriptions in a ReentrantCallbackGroup. Serialize blocking commands with a threading.Lock, let cmd_vel use lock.acquire(blocking=False) so stick updates are dropped rather than queued behind a takeoff, and send emergency stop outside the lock so it is never stuck waiting.