Skip to content

Commit 31e4563

Browse files
tulkuLucas Chiesa
and
Lucas Chiesa
authored
Minor fixes to pub sub tutorial (#437)
Also, add a link to the installation instruction from the main README.md Co-authored-by: Lucas Chiesa <[email protected]>
1 parent 7f53a4e commit 31e4563

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ Introduction
1111
This is a set of projects (the `rclrs` client library, code generator, examples and more) that
1212
enables developers to write ROS 2 applications in Rust.
1313

14+
Installation
15+
------------
16+
17+
Follow the [instructions in the documentation directory](docs/building.md).
18+
1419
Features and limitations
1520
------------------------
1621

docs/writing_a_simple_publisher_and_subscriber.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ To construct a node, replace the code in your `main.rs` file with the following:
9292
```rust
9393
/// Creates a SimplePublisherNode, initializes a node and publisher, and provides
9494
/// methods to publish a simple "Hello World" message on a loop in separate threads.
95-
9695
use rclrs::{create_node, Context, Node, Publisher, RclrsError, QOS_PROFILE_DEFAULT};
9796
use std::{env, sync::Arc, thread, time::Duration};
9897
use std_msgs::msg::String as StringMsg;
@@ -103,12 +102,12 @@ struct SimplePublisherNode {
103102
publisher: Arc<Publisher<StringMsg>>,
104103
}
105104
impl SimplePublisherNode {
106-
fn new(context: &context) -> result<self, RclrsError> {
105+
fn new(context: &Context) -> Result<Self, RclrsError> {
107106
let node = create_node(context, "simple_publisher").unwrap();
108107
let publisher = node
109-
.create_publisher("publish_hello", qos_profile_default)
108+
.create_publisher("publish_hello", QOS_PROFILE_DEFAULT)
110109
.unwrap();
111-
ok(self { node, publisher })
110+
Ok(Self { node, publisher })
112111
}
113112
fn publish_data(&self, increment: i32) -> Result<i32, RclrsError> {
114113
let msg: StringMsg = StringMsg {

0 commit comments

Comments
 (0)