Can I create an executor task in different callback group with rclpy?
Using Python and rclpy
I have some code that started its own Thread instance and interacted with ROS .
It works fine in most cases, but because of a few issues I've seen, I'd like to move away from this and just use a MultiThreadedExecutor to keep everything "ROS-like".
I understand the basics of ROS executors, spinning, and creating callback groups, and see how to use them when creating subscriptions, services, etc ...
In my concept design I would like to keep subscribers and the "main" thread in separate callback groups, and I'd like to process each "tic" as a task within a callback group.
I want to be able to process an incoming message in the subscriber callback group, and have it spawn a task in the "main tic " callback group so that I have a regular order and can guarantee one thread doesn't starve the other.
However, I cannot find an example of creating tasks assigned to specific callback groups. The executor.create_task does not mention callback groups.
Questions:
- Does
create_task
create tasks in 1) default callback group, 2) same callback group as creating function, or 3) something else? - Is it possible to create tasks in a different callback group's queue?
- if so, can you point me at an example of this?
Asked by dcconner on 2023-08-03 13:37:27 UTC
Comments