From c23e2eb1f68a0cc900d9d3181c99b9dca9b6ef0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20=C5=A0koudlil?= Date: Fri, 22 Mar 2024 18:36:19 +0100 Subject: [PATCH] Add panic to sim time examples --- r2r/examples/sim_time_publisher.rs | 1 + r2r/examples/timer_sim_time.rs | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/r2r/examples/sim_time_publisher.rs b/r2r/examples/sim_time_publisher.rs index 3e6ec5d..880c92a 100644 --- a/r2r/examples/sim_time_publisher.rs +++ b/r2r/examples/sim_time_publisher.rs @@ -32,4 +32,5 @@ fn main() -> Result<(), Box> { #[cfg(not(r2r__rosgraph_msgs__msg__Clock))] fn main() { + panic!("Sim_time_publisher example is not compiled with 'rosgraph_msgs'."); } diff --git a/r2r/examples/timer_sim_time.rs b/r2r/examples/timer_sim_time.rs index 735d294..5dde07c 100644 --- a/r2r/examples/timer_sim_time.rs +++ b/r2r/examples/timer_sim_time.rs @@ -33,6 +33,7 @@ async fn timer_task( /// Publication of time can be done either using the example `sim_time_publisher` /// or with `ros2 bag play --clock ` +#[cfg(r2r__rosgraph_msgs__msg__Clock)] fn main() -> Result<(), Box> { let ctx = r2r::Context::create()?; let mut node = r2r::Node::create(ctx, "testnode", "")?; @@ -80,3 +81,8 @@ fn main() -> Result<(), Box> { Ok(()) } + +#[cfg(not(r2r__rosgraph_msgs__msg__Clock))] +fn main() { + panic!("Timer_sim_time example is not compiled with 'rosgraph_msgs'."); +}