-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Labels
Description
We want to summarize the differences between RealtimeBox and RealtimeBuffer, and compare it with the new Lock-Free Queue proposal.
In the end, we should have guidelines when to use which concept and if maybe any of them is obsolete.
Finally, we will apply the guidelines to ros2_controllers wherever necessary.
General
Within the ros2_control framework, we have only the following use-cases
- Keeping state information, like here or here
- Updating references from subscribers
- Updating dynamic parameters
RealtimeBox
[Sai]
- It is more a thread-safe way to accessing data than RT safe.
- Using pointers with this doesn't make a lot of sense as the data protected by the mutex or the wrapper can be modified and accessed without any restrictions. IMO, it shouldn't be the case with the RealtimeBox
RealtimeBuffer
[Sai] RealtimeBuffer is what we mostly want, but we have some cons in this:
- As we all agreed in last WG meetings, NON_POLLING should be the default one now and it should work as expected Realtime Publisher - Select one behavior (Polling or NonPolling) and remove the other one #212
- The member variables are using the pointer to the original data (We have to check what happens if the data goes out of scope and we try to access it)
- When accessing using the readFromRT etc, we get a raw pointer, may be this is not so nice.
- The other limitation I see is that the Buffer size is limited to size of 2.
[Denis] We also need “WriteFromRT”
- Lock-free Write to Buffer ros2_controllers#168
- new realtime_buffer-like class that works for reading and writing to … #73
Lock-Free Queue
Was suggested in #14 and implemented with #253
[Sai]
- We don't use mutexes for the implementation
- We can have the buffer size as we need
- Can work with multi producer and multi consumer and single producer and single consumer efficiently
- and when we pop, we directly get the data instead of the pointer to the object
Example usage: ros-controls/ros2_controllers#1480