Skip to content

Roadmap and guidelines for using Box/Buffer/Queue #279

@christophfroehlich

Description

@christophfroehlich

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

RealtimeBox

Got refurbed with #139 #146

[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 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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions