Skip to content

open-rmf/ros2-impulse-examples

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Building workflows with ROS nodes

The examples in this directory showcase how to incorporate ROS primitives into a workflow. We model a small portion of a navigation workflow that involves receiving goals, fetching paths to connect those goals from a planning service, and then queuing up the paths for execution.

This diagram represents the workflow implemented by src/nav_example.rs:

nav-example-workflow

We use rclrs for this demo, and currently the build pipeline to use ROS messages for rclrs takes some extra steps since Rust is not (yet) a core language for ROS.

To run this demo, follow these steps:

  1. Install ROS Jazzy according to the normal installation instructions.

  2. Install Rust according to the normal installation instructions.

  3. Run these commands to set up the workspace with the message bindings:

sudo apt install -y git libclang-dev python3-pip python3-vcstool # libclang-dev is required by bindgen
pip install git+https://github.com/colcon/colcon-cargo.git --break-system-packages
pip install git+https://github.com/colcon/colcon-ros-cargo.git --break-system-packages

Create a workspace with the necessary repos:

mkdir -p workspace/src && cd workspace
git clone https://github.com/open-rmf/ros2-impulse-examples src/ros2-impulse-examples
vcs import src < src/ros2-impulse-examples/example-messages.repos

Source the ROS distro and build the workspace:

source /opt/ros/jazzy/setup.bash
colcon build
  1. After colcon build has finished, you should see a .cargo/config.toml file inside your workspace, with [patch.crates-io.___] sections pointing to the generated message bindings. Now you should source the workspace using
source install/setup.bash

Then you can go into the ros2-impulse-examples directory and run the example with

cd src/ros2-impulse-examples
cargo run --bin nav-example

The nav-example workflow will wait until it receives some goals to process. You can send it some randomized goals by opening a new terminal in the same directory and running

source ../../install/setup.bash
cargo run --bin goal-requester

Now the nav-example workflow will wait until a planner service is available for it to send GetPlan service requests to. Using the last terminal, run

cargo run --bin fake-plan-generator

Now the workflow will print out all the plans that it has received from the fake-plan-generator and stored in its buffer. If the workflow were connected to a real navigation system, it could pull these plans from the buffer one at a time and execute them.

Our workflow also allows the paths to be cleared out of the buffer, i.e. "cancelled". To cancel the current set of goals, run:

cargo run --bin goal-requester -- --cancel

After that you should see a printout of

Paths currently waiting to run:
[]

which indicates that the buffer has been successfully cleared out.

About

Examples of how to use ROS 2 with bevy_impulse

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages