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:
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:
-
Install ROS Jazzy according to the normal installation instructions.
-
Install Rust according to the normal installation instructions.
-
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 bindgenpip install git+https://github.com/colcon/colcon-cargo.git --break-system-packagespip install git+https://github.com/colcon/colcon-ros-cargo.git --break-system-packagesCreate a workspace with the necessary repos:
mkdir -p workspace/src && cd workspacegit clone https://github.com/open-rmf/ros2-impulse-examples src/ros2-impulse-examplesvcs import src < src/ros2-impulse-examples/example-messages.reposSource the ROS distro and build the workspace:
source /opt/ros/jazzy/setup.bashcolcon build- After
colcon buildhas finished, you should see a.cargo/config.tomlfile inside your workspace, with[patch.crates-io.___]sections pointing to the generated message bindings. Now you should source the workspace using
source install/setup.bashThen you can go into the ros2-impulse-examples directory and run the example with
cd src/ros2-impulse-examplescargo run --bin nav-exampleThe 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.bashcargo run --bin goal-requesterNow 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-generatorNow 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 -- --cancelAfter that you should see a printout of
Paths currently waiting to run:
[]
which indicates that the buffer has been successfully cleared out.
