Skip to content

Commit

Permalink
Merge pull request dora-rs#431 from dora-rs/cxx-ros2-readme
Browse files Browse the repository at this point in the history
Create README.md for cxx-ros2-example
  • Loading branch information
phil-opp authored Feb 29, 2024
2 parents 14bb4fb + d968ffc commit ac5ced6
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions examples/c++-ros2-dataflow/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# `cxx-ros2-dataflow` Example

This c++ example shows how to publish/subscribe to both ROS2 and Dora. The dataflow consists of a single node that sends random movement commands to the [ROS2 `turtlesim_node`](https://docs.ros.org/en/iron/Tutorials/Beginner-CLI-Tools/Introducing-Turtlesim/Introducing-Turtlesim.html).

## Setup

This examples requires a sourced ROS2 installation.

- To set up ROS2, follow the [ROS2 installation](https://docs.ros.org/en/iron/Installation.html) guide.
- Don't forget to [source the ROS2 setup files](https://docs.ros.org/en/iron/Tutorials/Beginner-CLI-Tools/Configuring-ROS2-Environment.html#source-the-setup-files)
- Follow tasks 1 and 2 of the [ROS2 turtlesim tutorial](https://docs.ros.org/en/iron/Tutorials/Beginner-CLI-Tools/Introducing-Turtlesim/Introducing-Turtlesim.html#id3)
- Install the turtlesim package
- Start the turtlesim node through `ros2 run turtlesim turtlesim_node`

## Running turtlesim example


From terminal 1 , sourcing the ROS2 installation and start ROS2 turtlesim window
```
source /opt/ros/galactic/setup.bash
ros2 run turtlesim turtlesim_node
```

From terminal 2 from dora folder. Note the source command here is necessary as this allow ROS2 message types to be found and compile dynamically.
```
source /opt/ros/galactic/setup.bash
cargo run --example cxx-ros2-dataflow --features ros2-examples
```
And you will see the turtle move a few steps.

0 comments on commit ac5ced6

Please sign in to comment.