From b6735a6077fced3696ce6ede16c067574f132b3a Mon Sep 17 00:00:00 2001 From: Lucas Walter Date: Sat, 16 Nov 2024 10:01:48 -0800 Subject: [PATCH] make ros1_talker a better demonstration of #206 --- roslibrust/examples/ros1_talker.rs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/roslibrust/examples/ros1_talker.rs b/roslibrust/examples/ros1_talker.rs index b57613e..a84ef42 100644 --- a/roslibrust/examples/ros1_talker.rs +++ b/roslibrust/examples/ros1_talker.rs @@ -18,14 +18,17 @@ async fn main() -> Result<(), anyhow::Error> { .advertise::("/my_point", 1, false) .await?; - for count in 0..50 { + let mut count = 0; + loop { let mut msg = geometry_msgs::PointStamped::default(); - msg.point.x = count as f64; + msg.header.seq = count; + msg.point.x = ((count as f64) / 200.0).sin(); publisher.publish(&msg).await?; - tokio::time::sleep(tokio::time::Duration::from_secs(1)).await; + tokio::time::sleep(tokio::time::Duration::from_millis(5)).await; + count += 1; } - Ok(()) + // Ok(()) } #[cfg(not(feature = "ros1"))]