From 18bd941e262957c53306ac809b6e4a6d3bea4f74 Mon Sep 17 00:00:00 2001 From: Sam Privett Date: Sun, 4 Jan 2026 19:45:39 -0800 Subject: [PATCH 1/2] Updated the examples repo to build with the messages changes. --- rclrs/logging_demo/Cargo.toml | 1 - rclrs/message_demo/Cargo.toml | 3 +-- rclrs/minimal_client_service/Cargo.toml | 1 - rclrs/minimal_pub_sub/Cargo.toml | 1 - rclrs/parameter_demo/Cargo.toml | 1 - rclrs/rust_pubsub/Cargo.toml | 1 - rclrs/worker_demo/Cargo.toml | 1 - 7 files changed, 1 insertion(+), 8 deletions(-) diff --git a/rclrs/logging_demo/Cargo.toml b/rclrs/logging_demo/Cargo.toml index 79104f3..6e17523 100644 --- a/rclrs/logging_demo/Cargo.toml +++ b/rclrs/logging_demo/Cargo.toml @@ -5,4 +5,3 @@ edition = "2021" [dependencies] rclrs = "0.7" -example_interfaces = "*" diff --git a/rclrs/message_demo/Cargo.toml b/rclrs/message_demo/Cargo.toml index 11888a6..41300f5 100644 --- a/rclrs/message_demo/Cargo.toml +++ b/rclrs/message_demo/Cargo.toml @@ -10,9 +10,8 @@ path = "src/message_demo.rs" [dependencies] anyhow = {version = "1", features = ["backtrace"]} -rclrs = "0.7" +rclrs = { version = "0.7", features = ["serde"] } rosidl_runtime_rs = "0.6" -rclrs_example_msgs = { version = "0.5", features = ["serde"] } serde_json = "1.0" # This specific version is compatible with Rust 1.75 diff --git a/rclrs/minimal_client_service/Cargo.toml b/rclrs/minimal_client_service/Cargo.toml index c595dc2..3f03366 100644 --- a/rclrs/minimal_client_service/Cargo.toml +++ b/rclrs/minimal_client_service/Cargo.toml @@ -20,7 +20,6 @@ path = "src/minimal_service.rs" anyhow = {version = "1", features = ["backtrace"]} tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread", "time"] } rclrs = "0.7" -example_interfaces = "*" # This specific version is compatible with Rust 1.75 backtrace = "=0.3.74" diff --git a/rclrs/minimal_pub_sub/Cargo.toml b/rclrs/minimal_pub_sub/Cargo.toml index 71005fc..5444cae 100644 --- a/rclrs/minimal_pub_sub/Cargo.toml +++ b/rclrs/minimal_pub_sub/Cargo.toml @@ -28,7 +28,6 @@ path = "src/zero_copy_publisher.rs" [dependencies] anyhow = {version = "1", features = ["backtrace"]} rclrs = "0.7" -example_interfaces = "*" # This specific version is compatible with Rust 1.75 backtrace = "=0.3.74" diff --git a/rclrs/parameter_demo/Cargo.toml b/rclrs/parameter_demo/Cargo.toml index 9b89495..e7aa57f 100644 --- a/rclrs/parameter_demo/Cargo.toml +++ b/rclrs/parameter_demo/Cargo.toml @@ -5,4 +5,3 @@ edition = "2021" [dependencies] rclrs = "0.7" -example_interfaces = "*" diff --git a/rclrs/rust_pubsub/Cargo.toml b/rclrs/rust_pubsub/Cargo.toml index 9200923..29c5e6a 100644 --- a/rclrs/rust_pubsub/Cargo.toml +++ b/rclrs/rust_pubsub/Cargo.toml @@ -13,4 +13,3 @@ path="src/simple_subscriber.rs" [dependencies] rclrs = "*" -std_msgs = "*" diff --git a/rclrs/worker_demo/Cargo.toml b/rclrs/worker_demo/Cargo.toml index a1c5228..1811830 100644 --- a/rclrs/worker_demo/Cargo.toml +++ b/rclrs/worker_demo/Cargo.toml @@ -5,4 +5,3 @@ edition = "2021" [dependencies] rclrs = "0.7" -example_interfaces = "*" From 703ecaad8e2eb07ca3203cd4a9572eab1e95be80 Mon Sep 17 00:00:00 2001 From: Sam Privett Date: Sun, 15 Mar 2026 10:34:25 -0700 Subject: [PATCH 2/2] Move re-export logic from rclrs, to the new ros-env crate. --- rclrs/logging_demo/Cargo.toml | 1 + rclrs/logging_demo/src/main.rs | 1 + rclrs/message_demo/Cargo.toml | 5 ++--- rclrs/message_demo/src/message_demo.rs | 1 + rclrs/minimal_client_service/Cargo.toml | 4 +--- rclrs/minimal_client_service/src/minimal_client.rs | 2 +- .../src/minimal_client_async.rs | 2 +- rclrs/minimal_client_service/src/minimal_service.rs | 2 +- rclrs/minimal_pub_sub/Cargo.toml | 4 +--- rclrs/minimal_pub_sub/src/minimal_publisher.rs | 1 + rclrs/minimal_pub_sub/src/minimal_subscriber.rs | 1 + rclrs/minimal_pub_sub/src/minimal_two_nodes.rs | 1 + rclrs/minimal_pub_sub/src/zero_copy_publisher.rs | 1 + rclrs/minimal_pub_sub/src/zero_copy_subscriber.rs | 1 + rclrs/parameter_demo/Cargo.toml | 1 + rclrs/parameter_demo/src/main.rs | 1 + rclrs/rust_pubsub/Cargo.toml | 3 ++- rclrs/rust_pubsub/src/simple_publisher.rs | 2 +- rclrs/rust_pubsub/src/simple_subscriber.rs | 2 +- rclrs/worker_demo/Cargo.toml | 1 + rclrs/worker_demo/src/main.rs | 13 +++++-------- 21 files changed, 27 insertions(+), 23 deletions(-) diff --git a/rclrs/logging_demo/Cargo.toml b/rclrs/logging_demo/Cargo.toml index 6e17523..88413cd 100644 --- a/rclrs/logging_demo/Cargo.toml +++ b/rclrs/logging_demo/Cargo.toml @@ -5,3 +5,4 @@ edition = "2021" [dependencies] rclrs = "0.7" +ros-env = "0.1" diff --git a/rclrs/logging_demo/src/main.rs b/rclrs/logging_demo/src/main.rs index 789a93e..251e615 100644 --- a/rclrs/logging_demo/src/main.rs +++ b/rclrs/logging_demo/src/main.rs @@ -1,4 +1,5 @@ use rclrs::*; +use ros_env::*; use std::time::Duration; fn main() -> Result<(), RclrsError> { diff --git a/rclrs/message_demo/Cargo.toml b/rclrs/message_demo/Cargo.toml index 41300f5..388fcbf 100644 --- a/rclrs/message_demo/Cargo.toml +++ b/rclrs/message_demo/Cargo.toml @@ -11,8 +11,7 @@ path = "src/message_demo.rs" [dependencies] anyhow = {version = "1", features = ["backtrace"]} rclrs = { version = "0.7", features = ["serde"] } +# TODO (SP) This shouldn't need the serde feature once the next version of rclrs is released +ros-env = {path = "/home/sam/rust_ws/src/ros-env", features = ["serde"]} rosidl_runtime_rs = "0.6" serde_json = "1.0" - -# This specific version is compatible with Rust 1.75 -backtrace = "=0.3.74" diff --git a/rclrs/message_demo/src/message_demo.rs b/rclrs/message_demo/src/message_demo.rs index e66d6ef..a30dfaf 100644 --- a/rclrs/message_demo/src/message_demo.rs +++ b/rclrs/message_demo/src/message_demo.rs @@ -4,6 +4,7 @@ use anyhow::{Error, Result}; use rosidl_runtime_rs::{seq, BoundedSequence, Message, Sequence}; use rclrs::*; +use ros_env::*; fn check_default_values() { let msg = rclrs_example_msgs::msg::rmw::VariousTypes::default(); diff --git a/rclrs/minimal_client_service/Cargo.toml b/rclrs/minimal_client_service/Cargo.toml index 3f03366..0eb421f 100644 --- a/rclrs/minimal_client_service/Cargo.toml +++ b/rclrs/minimal_client_service/Cargo.toml @@ -20,6 +20,4 @@ path = "src/minimal_service.rs" anyhow = {version = "1", features = ["backtrace"]} tokio = { version = "1", features = ["macros", "rt", "rt-multi-thread", "time"] } rclrs = "0.7" - -# This specific version is compatible with Rust 1.75 -backtrace = "=0.3.74" +ros-env = "0.1" diff --git a/rclrs/minimal_client_service/src/minimal_client.rs b/rclrs/minimal_client_service/src/minimal_client.rs index da287a6..b618ee9 100644 --- a/rclrs/minimal_client_service/src/minimal_client.rs +++ b/rclrs/minimal_client_service/src/minimal_client.rs @@ -1,6 +1,6 @@ use anyhow::{Error, Result}; -use example_interfaces::srv::*; use rclrs::*; +use ros_env::example_interfaces::srv::*; fn main() -> Result<(), Error> { let mut executor = Context::default_from_env()?.create_basic_executor(); diff --git a/rclrs/minimal_client_service/src/minimal_client_async.rs b/rclrs/minimal_client_service/src/minimal_client_async.rs index 7feb462..2f3d25e 100644 --- a/rclrs/minimal_client_service/src/minimal_client_async.rs +++ b/rclrs/minimal_client_service/src/minimal_client_async.rs @@ -1,6 +1,6 @@ use anyhow::{Error, Result}; -use example_interfaces::srv::*; use rclrs::*; +use ros_env::example_interfaces::srv::*; #[tokio::main] async fn main() -> Result<(), Error> { diff --git a/rclrs/minimal_client_service/src/minimal_service.rs b/rclrs/minimal_client_service/src/minimal_service.rs index 8142012..f6530d4 100644 --- a/rclrs/minimal_client_service/src/minimal_service.rs +++ b/rclrs/minimal_client_service/src/minimal_service.rs @@ -1,6 +1,6 @@ use anyhow::{Error, Result}; -use example_interfaces::srv::*; use rclrs::*; +use ros_env::example_interfaces::srv::*; fn handle_service(request: AddTwoInts_Request, info: ServiceInfo) -> AddTwoInts_Response { let timestamp = info diff --git a/rclrs/minimal_pub_sub/Cargo.toml b/rclrs/minimal_pub_sub/Cargo.toml index 5444cae..17a35fa 100644 --- a/rclrs/minimal_pub_sub/Cargo.toml +++ b/rclrs/minimal_pub_sub/Cargo.toml @@ -28,9 +28,7 @@ path = "src/zero_copy_publisher.rs" [dependencies] anyhow = {version = "1", features = ["backtrace"]} rclrs = "0.7" - -# This specific version is compatible with Rust 1.75 -backtrace = "=0.3.74" +ros-env = "0.1" [package.metadata.ros] install_to_share = ["launch"] diff --git a/rclrs/minimal_pub_sub/src/minimal_publisher.rs b/rclrs/minimal_pub_sub/src/minimal_publisher.rs index 2eaf409..5a2bf93 100644 --- a/rclrs/minimal_pub_sub/src/minimal_publisher.rs +++ b/rclrs/minimal_pub_sub/src/minimal_publisher.rs @@ -1,5 +1,6 @@ use anyhow::{Error, Result}; use rclrs::*; +use ros_env::*; fn main() -> Result<(), Error> { let context = Context::default_from_env()?; diff --git a/rclrs/minimal_pub_sub/src/minimal_subscriber.rs b/rclrs/minimal_pub_sub/src/minimal_subscriber.rs index 7750c60..3aa99bc 100644 --- a/rclrs/minimal_pub_sub/src/minimal_subscriber.rs +++ b/rclrs/minimal_pub_sub/src/minimal_subscriber.rs @@ -1,5 +1,6 @@ use anyhow::{Error, Result}; use rclrs::*; +use ros_env::*; fn main() -> Result<(), Error> { let context = Context::default_from_env()?; diff --git a/rclrs/minimal_pub_sub/src/minimal_two_nodes.rs b/rclrs/minimal_pub_sub/src/minimal_two_nodes.rs index b349476..7ec2c45 100644 --- a/rclrs/minimal_pub_sub/src/minimal_two_nodes.rs +++ b/rclrs/minimal_pub_sub/src/minimal_two_nodes.rs @@ -1,4 +1,5 @@ use rclrs::*; +use ros_env::*; use std::sync::Arc; use anyhow::{Error, Result}; diff --git a/rclrs/minimal_pub_sub/src/zero_copy_publisher.rs b/rclrs/minimal_pub_sub/src/zero_copy_publisher.rs index 68d3700..f5f7106 100644 --- a/rclrs/minimal_pub_sub/src/zero_copy_publisher.rs +++ b/rclrs/minimal_pub_sub/src/zero_copy_publisher.rs @@ -1,5 +1,6 @@ use anyhow::{Error, Result}; use rclrs::*; +use ros_env::*; fn main() -> Result<(), Error> { let context = Context::default_from_env()?; diff --git a/rclrs/minimal_pub_sub/src/zero_copy_subscriber.rs b/rclrs/minimal_pub_sub/src/zero_copy_subscriber.rs index ce6c5a8..629573e 100644 --- a/rclrs/minimal_pub_sub/src/zero_copy_subscriber.rs +++ b/rclrs/minimal_pub_sub/src/zero_copy_subscriber.rs @@ -1,5 +1,6 @@ use anyhow::{Error, Result}; use rclrs::*; +use ros_env::*; fn main() -> Result<(), Error> { let mut executor = Context::default_from_env()?.create_basic_executor(); diff --git a/rclrs/parameter_demo/Cargo.toml b/rclrs/parameter_demo/Cargo.toml index e7aa57f..b69bd5b 100644 --- a/rclrs/parameter_demo/Cargo.toml +++ b/rclrs/parameter_demo/Cargo.toml @@ -5,3 +5,4 @@ edition = "2021" [dependencies] rclrs = "0.7" +ros-env = "0.1" diff --git a/rclrs/parameter_demo/src/main.rs b/rclrs/parameter_demo/src/main.rs index 7b9daa6..1c40edf 100644 --- a/rclrs/parameter_demo/src/main.rs +++ b/rclrs/parameter_demo/src/main.rs @@ -1,4 +1,5 @@ use rclrs::*; +use ros_env::*; use std::sync::Arc; fn main() -> Result<(), RclrsError> { diff --git a/rclrs/rust_pubsub/Cargo.toml b/rclrs/rust_pubsub/Cargo.toml index 29c5e6a..437e022 100644 --- a/rclrs/rust_pubsub/Cargo.toml +++ b/rclrs/rust_pubsub/Cargo.toml @@ -12,4 +12,5 @@ name="simple_subscriber" path="src/simple_subscriber.rs" [dependencies] -rclrs = "*" +rclrs = "0.7.0" +ros-env = "0.1" diff --git a/rclrs/rust_pubsub/src/simple_publisher.rs b/rclrs/rust_pubsub/src/simple_publisher.rs index ff211f0..068b501 100644 --- a/rclrs/rust_pubsub/src/simple_publisher.rs +++ b/rclrs/rust_pubsub/src/simple_publisher.rs @@ -1,6 +1,6 @@ use rclrs::*; +use ros_env::std_msgs::msg::String as StringMsg; use std::{thread, time::Duration}; -use std_msgs::msg::String as StringMsg; struct SimplePublisherNode { publisher: Publisher, diff --git a/rclrs/rust_pubsub/src/simple_subscriber.rs b/rclrs/rust_pubsub/src/simple_subscriber.rs index 3ebbb4d..0d23082 100644 --- a/rclrs/rust_pubsub/src/simple_subscriber.rs +++ b/rclrs/rust_pubsub/src/simple_subscriber.rs @@ -1,6 +1,6 @@ use rclrs::*; +use ros_env::std_msgs::msg::String as StringMsg; use std::{thread, time::Duration}; -use std_msgs::msg::String as StringMsg; pub struct SimpleSubscriptionNode { #[allow(unused)] diff --git a/rclrs/worker_demo/Cargo.toml b/rclrs/worker_demo/Cargo.toml index 1811830..d3516b0 100644 --- a/rclrs/worker_demo/Cargo.toml +++ b/rclrs/worker_demo/Cargo.toml @@ -5,3 +5,4 @@ edition = "2021" [dependencies] rclrs = "0.7" +ros-env = "0.1" diff --git a/rclrs/worker_demo/src/main.rs b/rclrs/worker_demo/src/main.rs index e931c14..40d85d6 100644 --- a/rclrs/worker_demo/src/main.rs +++ b/rclrs/worker_demo/src/main.rs @@ -1,4 +1,5 @@ use rclrs::*; +use ros_env::*; use std::time::Duration; fn main() -> Result<(), RclrsError> { @@ -17,16 +18,12 @@ fn main() -> Result<(), RclrsError> { // Use this timer-based implementation when timers are available instead // of using std::thread::spawn. - let _timer = worker.create_timer_repeating( - Duration::from_secs(1), - move |data: &mut String| { - let msg = example_interfaces::msg::String { - data: data.clone() - }; + let _timer = + worker.create_timer_repeating(Duration::from_secs(1), move |data: &mut String| { + let msg = example_interfaces::msg::String { data: data.clone() }; publisher.publish(msg).ok(); - } - )?; + })?; println!( "Beginning repeater... \n >> \