Skip to content

Commit

Permalink
make ros1_talker a better demonstration of RosLibRust#206
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasw committed Nov 16, 2024
1 parent eff8214 commit b6735a6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions roslibrust/examples/ros1_talker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,17 @@ async fn main() -> Result<(), anyhow::Error> {
.advertise::<geometry_msgs::PointStamped>("/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"))]
Expand Down

0 comments on commit b6735a6

Please sign in to comment.