Skip to content

Dynamic message publishers and subscribers #492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 35 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
2936a40
Add dynamic message functionality
nnmm Jul 19, 2022
9263652
Merge branch 'main' into dynamic_messages
luca-della-vedova Jun 17, 2025
aaadbe4
Initial stab, builds docs
luca-della-vedova Jun 17, 2025
d5ad50f
WIP work through compile errors
luca-della-vedova Jun 18, 2025
d140dbe
Clear warnings
luca-della-vedova Jun 18, 2025
f7aa5c0
Bring back tests
luca-della-vedova Jun 18, 2025
236b999
Minor cleanup
luca-della-vedova Jun 18, 2025
780c660
Remove spurious files
luca-della-vedova Jun 18, 2025
4fd4059
WIP working through subscriptions
luca-della-vedova Jun 18, 2025
e79f46f
First integration with async workers
luca-della-vedova Jun 20, 2025
73eec6b
Add a PartialEq implementation for tests
luca-della-vedova Jun 20, 2025
76e18d5
Fix test code
luca-della-vedova Jun 20, 2025
5b513ba
Format
luca-della-vedova Jun 20, 2025
8c216af
Minor cleanup
luca-della-vedova Jun 20, 2025
9ab136b
Use SubscriptionOptions
luca-della-vedova Jun 20, 2025
a6b5b48
Plumbing for dynamic publishers
luca-della-vedova Jun 20, 2025
8112a77
Add publisher API
luca-della-vedova Jun 20, 2025
73022f7
API symmetry with normal pub/sub
luca-della-vedova Jun 20, 2025
2ccec54
Worker subscriptions
luca-della-vedova Jun 20, 2025
60a542a
Add async subscription API
luca-della-vedova Jun 23, 2025
98381ac
Basic test for dynamic subscriptions graph
luca-della-vedova Jun 23, 2025
164639e
Tests for dynamic pub/sub
luca-della-vedova Jun 23, 2025
d1c264a
Worker subscription test
luca-della-vedova Jun 23, 2025
0c11ea0
Minor cleanups and refactors
luca-della-vedova Jun 23, 2025
9ab8dc5
Tests for message field getters / setters
luca-della-vedova Jun 23, 2025
1439045
Minor cleanups
luca-della-vedova Jun 23, 2025
0462d7f
Remove commented code
luca-della-vedova Jun 23, 2025
2b99397
Revert fini change
luca-della-vedova Jun 23, 2025
eb5aeeb
Add note on message builder API
luca-della-vedova Jun 24, 2025
c4e0bed
Add docs, cleanup tests
luca-della-vedova Jun 24, 2025
ccd3852
Fix take logic, cleanup
luca-della-vedova Jun 24, 2025
c9a53db
Format
luca-della-vedova Jun 24, 2025
83cf32c
Clear warnings
luca-della-vedova Jun 24, 2025
42cd70f
Cleanup
luca-della-vedova Jun 24, 2025
2f99054
Merge branch 'main' into dynamic_messages
luca-della-vedova Jun 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions examples/dynamic_pub_sub/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "dynamic_pub_sub"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
# TODO(luca) change this to a version once dynamic message support is released on crates.io
rclrs = { path = "../../rclrs", features = ["dyn_msg"] }
anyhow = {version = "1", features = ["backtrace"]}
23 changes: 23 additions & 0 deletions examples/dynamic_pub_sub/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
use anyhow::{Error, Result};
use rclrs::*;

fn main() -> Result<(), Error> {
let context = Context::default_from_env()?;
let mut executor = context.create_basic_executor();

let node = executor.create_node("dynamic_subscriber")?;

let worker = node.create_worker::<usize>(0);
let _subscription = worker.create_dynamic_subscription(
"rclrs_example_msgs/msg/VariousTypes".try_into()?,
"topic",
move |num_messages: &mut usize, msg, _msg_info| {
*num_messages += 1;
println!("#{} | I heard: '{:#?}'", *num_messages, msg.structure());
},
)?;

println!("Waiting for messages...");
executor.spin(SpinOptions::default()).first_error()?;
Ok(())
}
Loading
Loading