Skip to content

Add design document: Support repeating transient-local (“latched”) messages in Rosbag2 recorder#2327

Merged
MichaelOrlov merged 5 commits intorollingfrom
morlov/repeat-transient-local-msgs-design
Apr 3, 2026
Merged

Add design document: Support repeating transient-local (“latched”) messages in Rosbag2 recorder#2327
MichaelOrlov merged 5 commits intorollingfrom
morlov/repeat-transient-local-msgs-design

Conversation

@MichaelOrlov
Copy link
Copy Markdown
Contributor

@MichaelOrlov MichaelOrlov commented Feb 7, 2026

Description

Add design document: Support repeating transient-local (“latched”) messages in Rosbag2 recorder.

Is this user-facing behavior change?

No.

Did you use Generative AI?

Ye. GitHub Copilot, GPT-5.0 and ClaudeCode 4.5

Additional Information

N/A

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Comment thread docs/design/repeat_transient_local_messages_during_recording.md
Comment thread docs/design/repeat_transient_local_messages_during_recording.md Outdated
Copy link
Copy Markdown
Contributor

@tonynajjar tonynajjar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general looks good. My PR goes in that direction but of course doesn't completely align with all the points of this design documents - can be a good starting point.
@MichaelOrlov after this is merged do you plan on making the implementation?

@ajsampathk
Copy link
Copy Markdown

Hi, would it be possible to address this issue #2333 as well please? Related to latched topics and would be extremely useful.

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
@MichaelOrlov MichaelOrlov changed the title Add design document: Support transient-local (“latched”) messages in Rosbag2 recorder Add design document: Support repeating transient-local (“latched”) messages in Rosbag2 recorder Feb 13, 2026
- Mostly addressed style and some punctuations.

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
Copy link
Copy Markdown
Member

@christophebedard christophebedard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have some minor questions/comments. Generally seems OK, but I didn't have that much time to properly digest it, and I'd really like to get input from users who originally requested this.

Comment thread docs/design/repeat_transient_local_messages_during_recording.md Outdated
Comment thread docs/design/repeat_transient_local_messages_during_recording.md
Comment thread docs/design/repeat_transient_local_messages_during_recording.md
Comment on lines +114 to +120
**Example:**
```
Split at T=1000.5s, /tf_static originally at T=0.1s
After prepend: /tf_static written with T=1000.5s
Next message at T=1000.6s
Playback: continuous timeline without hours-long gap
```
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you replay everything? Will that original message get published at T=0.1s and T=1000.5s? This is fine for /tf_static, but not for all topics.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. By design, since a transient local message on a particular topic was explicitly chosen to be repeated during recording, the original message will appear in a playback stream on a T=0.1s and T=1000.5s.
That is a requested behavior. To be able to replay just one small split file independently.

I have mentioned above that this shouldn't be a default behavior, and the user shall explicitly select on what topics transient local messages will be repeated during recording.

Comment thread docs/design/repeat_transient_local_messages_during_recording.md Outdated
Comment on lines +60 to +63
3. **Timestamp adjustment:** When prepending transient-local messages during split or snapshot,
timestamps are overwritten to avoid playback gaps:
- **Split mode**: set to last message timestamp (T_last) from previous bag file.
- **Snapshot mode**: set to the earliest timestamp (T_earliest) from snapshot buffer range.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to get input on this behaviour from users who originally requested this feature.

@tonynajjar
Copy link
Copy Markdown
Contributor

tonynajjar commented Feb 15, 2026

@MichaelOrlov I gave implementing a shot according to this design document: #2342

According to the review feedback.

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
@MichaelOrlov
Copy link
Copy Markdown
Contributor Author

@christophebedard, @tonynajjar I've addressed review comments. Please reiterate on review.

Signed-off-by: Michael Orlov <morlovmr@gmail.com>
@MichaelOrlov MichaelOrlov force-pushed the morlov/repeat-transient-local-msgs-design branch from 9ff87aa to 54e9da4 Compare March 28, 2026 07:42
tonynajjar added a commit to botsandus/rosbag2 that referenced this pull request Mar 28, 2026
Wire transient-local message support through the recorder and CLI layers:

- Recorder: expand topic names in repeat_transient_local_messages map,
  route to create_transient_local_topic() during subscription setup,
  set transient_local() QoS for matching topics
- config_options_from_node_params: parse record.repeat_transient_local
  ROS parameter (format: 'topic' or 'topic=depth')
- ros2 bag record CLI: add --repeat-transient-local argument with
  parse_repeat_transient_local_topics() validator
- pybind11: expose repeat_transient_local_messages on RecordOptions
- Tests: recorder integration test verifying create_transient_local_topic()
  is called with correct depth, CLI parser tests for valid/invalid input

Part 3 of 3 for ros2#1159, ros2#1886
Design document: ros2#2327
tonynajjar added a commit to botsandus/rosbag2 that referenced this pull request Mar 29, 2026
Wire transient-local message support through the recorder and CLI layers:

- Recorder: expand topic names in repeat_transient_local_messages map,
  route to create_transient_local_topic() during subscription setup,
  set transient_local() QoS for matching topics
- config_options_from_node_params: parse record.repeat_transient_local
  ROS parameter (format: 'topic' or 'topic=depth')
- ros2 bag record CLI: add --repeat-transient-local argument with
  parse_repeat_transient_local_topics() validator
- pybind11: expose repeat_transient_local_messages on RecordOptions
- Tests: recorder integration test verifying create_transient_local_topic()
  is called with correct depth, CLI parser tests for valid/invalid input

Part 3 of 3 for ros2#1159, ros2#1886
Design document: ros2#2327
tonynajjar added a commit to botsandus/rosbag2 that referenced this pull request Mar 29, 2026
Add the core data structures for repeating transient-local messages
on bag split and snapshot:

- TransientLocalMessagesCache: per-topic FIFO queues with configurable
  depth, thread-safe push/retrieval, timestamp-sorted output
- RecordOptions: new repeat_transient_local_messages map field with
  YAML serialization/deserialization support
- Unit tests for cache behavior (eviction, sorting, unregistered topics)
- YAML roundtrip test for RecordOptions

Part 1 of 3 for ros2#1159, ros2#1886
Design document: ros2#2327

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>
tonynajjar added a commit to botsandus/rosbag2 that referenced this pull request Mar 29, 2026
Extend the writer layer to support repeating transient-local messages
on bag split and snapshot:

- BaseWriterInterface: add create_transient_local_topic() virtual methods
  (with and without MessageDefinition)
- SequentialWriter: integrate TransientLocalMessagesCache
  - create_transient_local_topic(): register topic in cache + storage
  - write(): dual-write messages to cache for transient-local topics
  - prepend_transient_local_messages(): prepend cached messages on split
    with timestamp adjustment to last message edge
  - write_messages(): merge transient-local cache with snapshot buffer,
    adjust timestamps, deduplicate, stable-sort
- Writer: forwarding wrappers for new methods
- Mock sequential writer: tracking for create_transient_local_topic()
- Integration tests for split and snapshot modes

Part 2 of 3 for ros2#1159, ros2#1886
Design document: ros2#2327
tonynajjar added a commit to botsandus/rosbag2 that referenced this pull request Mar 29, 2026
Wire transient-local message support through the recorder and CLI layers:

- Recorder: expand topic names in repeat_transient_local_messages map,
  route to create_transient_local_topic() during subscription setup,
  set transient_local() QoS for matching topics
- config_options_from_node_params: parse record.repeat_transient_local
  ROS parameter (format: 'topic' or 'topic=depth')
- ros2 bag record CLI: add --repeat-transient-local argument with
  parse_repeat_transient_local_topics() validator
- pybind11: expose repeat_transient_local_messages on RecordOptions
- Tests: recorder integration test verifying create_transient_local_topic()
  is called with correct depth, CLI parser tests for valid/invalid input

Part 3 of 3 for ros2#1159, ros2#1886
Design document: ros2#2327
MichaelOrlov pushed a commit that referenced this pull request Mar 29, 2026
)

* feat: add TransientLocalMessagesCache and RecordOptions field

Add the core data structures for repeating transient-local messages
on bag split and snapshot:

- TransientLocalMessagesCache: per-topic FIFO queues with configurable
  depth, thread-safe push/retrieval, timestamp-sorted output
- RecordOptions: new repeat_transient_local_messages map field with
  YAML serialization/deserialization support
- Unit tests for cache behavior (eviction, sorting, unregistered topics)
- YAML roundtrip test for RecordOptions

Part 1 of 3 for #1159, #1886
Design document: #2327

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>

* refactor: optimize message retrieval by reserving vector capacity

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>

* feat: add YAML conversion support for unordered_map<string, size_t>

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>

---------

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>
tonynajjar added a commit to botsandus/rosbag2 that referenced this pull request Mar 30, 2026
Add the core data structures for repeating transient-local messages
on bag split and snapshot:

- TransientLocalMessagesCache: per-topic FIFO queues with configurable
  depth, thread-safe push/retrieval, timestamp-sorted output
- RecordOptions: new repeat_transient_local_messages map field with
  YAML serialization/deserialization support
- Unit tests for cache behavior (eviction, sorting, unregistered topics)
- YAML roundtrip test for RecordOptions

Part 1 of 3 for ros2#1159, ros2#1886
Design document: ros2#2327

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>
tonynajjar added a commit to botsandus/rosbag2 that referenced this pull request Mar 30, 2026
Extend the writer layer to support repeating transient-local messages
on bag split and snapshot:

- BaseWriterInterface: add create_transient_local_topic() virtual methods
  (with and without MessageDefinition)
- SequentialWriter: integrate TransientLocalMessagesCache
  - create_transient_local_topic(): register topic in cache + storage
  - write(): dual-write messages to cache for transient-local topics
  - prepend_transient_local_messages(): prepend cached messages on split
    with timestamp adjustment to last message edge
  - write_messages(): merge transient-local cache with snapshot buffer,
    adjust timestamps, deduplicate, stable-sort
- Writer: forwarding wrappers for new methods
- Mock sequential writer: tracking for create_transient_local_topic()
- Integration tests for split and snapshot modes

Part 2 of 3 for ros2#1159, ros2#1886
Design document: ros2#2327

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>
tonynajjar added a commit to botsandus/rosbag2 that referenced this pull request Mar 30, 2026
…s2#2385)

* feat: add TransientLocalMessagesCache and RecordOptions field

Add the core data structures for repeating transient-local messages
on bag split and snapshot:

- TransientLocalMessagesCache: per-topic FIFO queues with configurable
  depth, thread-safe push/retrieval, timestamp-sorted output
- RecordOptions: new repeat_transient_local_messages map field with
  YAML serialization/deserialization support
- Unit tests for cache behavior (eviction, sorting, unregistered topics)
- YAML roundtrip test for RecordOptions

Part 1 of 3 for ros2#1159, ros2#1886
Design document: ros2#2327

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>

* refactor: optimize message retrieval by reserving vector capacity

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>

* feat: add YAML conversion support for unordered_map<string, size_t>

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>

---------

Signed-off-by: Tony Najjar <tony.najjar@dexory.com>
@MichaelOrlov
Copy link
Copy Markdown
Contributor Author

@christophebedard @fujitatomoya, a friendly ping here to wrap-up review of this PR with design.
We have already almost done with the feature, but the design document is still in the review stage.

@MichaelOrlov MichaelOrlov merged commit 6ee13f1 into rolling Apr 3, 2026
12 of 13 checks passed
@MichaelOrlov MichaelOrlov deleted the morlov/repeat-transient-local-msgs-design branch April 3, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants