Priority queue implementation for ROS callback queues

asked 2015-01-29 16:00:51 -0500

Pranav gravatar image

updated 2015-01-29 19:02:30 -0500

Hey all,

We're working on a ROS package that extends ROS by providing a component-based model-driven design, implementation, code generation, deployment and analysis framework. One of the aspects of this design includes extensions to the existing callback queue implementation to facilitate priority-based enqueue and other such scheduling schemes like "earliest deadline first".

My question is: What is the easiest/safest design & implementation to extend ROS callback_queue.cpp to implement priority-based enqueue of callbacks. Ideally, I'd like the callbacks specified in timer options, subscriber options etc. in user space to be associated with a integer priority - say as a global std::map of <pointer_to_callback, priority="">. The addCallback function definition would identify the priority of the input callback (say using the user-space global map) and insert into the callback queue based on this priority instead of doing a simple queue.push_back. What is the easiest way to propagate a (new) userspace property for a callback (such as priority) to the addCallback function without changing its signature? That way, I can create a class that inherits from callback_queue and have the priorities for all user-defined callbacks inside addCallback without making any change to the function signature.

We've taken a look at the classes that inherit from CallbackInterface such as TimerQueueCallback and SubscriptionQueue. Each of these classes have member fields through which the actual callback (coming from timeroptions, subscribeoptions) can be reached but they are all private and do not have any generic interface for access. Is there anyway to easily associate such callbacks with properties like priority without changes roscpp? (say through a separate package like ours with derived classes)

Thanks!

edit retag flag offensive close merge delete

Comments

Did you get an answer and implemented it?

cascais gravatar image cascais  ( 2020-07-27 14:23:17 -0500 )edit