Skip to content

Commit

Permalink
Minor fixes to pub sub tutorial
Browse files Browse the repository at this point in the history
Also, add a link to the installation instruction from the main README.md
  • Loading branch information
Lucas Chiesa committed Dec 3, 2024
1 parent 6ac2ae1 commit 8bdd48a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ Introduction
This is a set of projects (the `rclrs` client library, code generator, examples and more) that
enables developers to write ROS 2 applications in Rust.

Installation
------------

Follow the [instructions in the documentation directory](docs/building.md).

Features and limitations
------------------------

Expand Down
7 changes: 3 additions & 4 deletions docs/writing_a_simple_publisher_and_subscriber.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ To construct a node, replace the code in your `main.rs` file with the following:
```rust
/// Creates a SimplePublisherNode, initializes a node and publisher, and provides
/// methods to publish a simple "Hello World" message on a loop in separate threads.

use rclrs::{create_node, Context, Node, Publisher, RclrsError, QOS_PROFILE_DEFAULT};
use std::{env, sync::Arc, thread, time::Duration};
use std_msgs::msg::String as StringMsg;
Expand All @@ -103,12 +102,12 @@ struct SimplePublisherNode {
publisher: Arc<Publisher<StringMsg>>,
}
impl SimplePublisherNode {
fn new(context: &context) -> result<self, RclrsError> {
fn new(context: &Context) -> Result<Self, RclrsError> {
let node = create_node(context, "simple_publisher").unwrap();
let publisher = node
.create_publisher("publish_hello", qos_profile_default)
.create_publisher("publish_hello", QOS_PROFILE_DEFAULT)
.unwrap();
ok(self { node, publisher })
Ok(Self { node, publisher })
}
fn publish_data(&self, increment: i32) -> Result<i32, RclrsError> {
let msg: StringMsg = StringMsg {
Expand Down

0 comments on commit 8bdd48a

Please sign in to comment.