One time setup:
mkdir -p ~/ros2cli_ws/src
git clone https://github.com/vortexntnu/ros2cli.git ~/ros2cli_ws/src
cd ~/ros2cli_ws
colcon build --packages-select ros2cli ros2pkg --allow-overriding ros2cli ros2pkg
echo "source ~/ros2cli_ws/install/setup.bash" >> ~/.bashrc
source ~/.bashrc
Create a new ROS 2 C++ package with the Vortex template
ros2 pkg create --build-type vortex_cpp <your_pkg_name>
This repository contains the source code for ROS 2 command line interface tools included with a standard install of any ROS 2 distro.
Run ros2 --help
to see all available commands.
Run ros2 <command> --help
for more information on individual command usage.
Run ros2 <command> <verb> --help
for even more usage information on a specific command's verbs.
Read Introspection with command line tools on ROS Index for more information and an example.
This cheat sheet provides examples for commands and their verbs (some of which rely on the ROS 2 demos package).
You can use Python entry points to create new commands and verbs for the CLI.
And here's an example for how to add a command.
You can find a historical discussion on this subject on Discourse.