Using Timer with Subscriber while ensuring Subscriber callbacks are prioritized
So, I am trying to control a dynamixel motor, while controlling the motor. Let's call this Node X. For controlling the motor, there is a subscriber to execute the position control. This Dynamixel receives the control command from another node (let's say Y) which is service based and that publishes data sequentially with a time delay. I want that the data published by the service is executed at the same time in the Node X.
However, if I use timer in the Node X to regularly publish the current position of the motor, then the Subscriber callback is not prioritized and thus, the callbacks are executed at once without any time delay and thus, doesn't gimme the result I want.
I tried doing multi-threading but does complicates the problem as same port cannot be used in two threads.
Is there a way out of this by modifying QoS profile or something so that I can regularly publish my data as well as execute the position control at the same time as requested.
Asked by LeibTon on 2023-07-11 03:08:18 UTC
Comments