Ros command - Unifying the ROS command line tools

Overview

ros_command

Unifying the ROS command line tools

One impairment to ROS 2 adoption is that all of the commands that have worked their way into muscle memory for ROS 1 developers no longer work. Also, all of the commands in ROS 2 tend to be at least two characters longer. To get information about a topic in ROS 1, one could type rosto (5 characters before tab), but in ROS 2 the equivalent is ros2 to (7 characters before tab).

On top of the differences between the ROS 1 and ROS 2 command line tools, there is also a wide gulf between the different build tools that are available. For example, if you want to build a specific package (e.g. pr2_moveit_config) and all its dependencies, there are three possible commands, depending on the build tool.

build tool command
catkin_make catkin_make --only-pkg-with-deps pr2_moveit_config
catkin_tools catkin build pr2_moveit_config
colcon colcon build --packages-up-to pr2_moveit_config

The ros_command package provides a set of command line interfaces for common actions with syntax similar to ROS 1 and catkin_tools, since those are often simpler, shorter and more familiar to a majority of ROS developers [citation needed].

Setup

This tool uses Python 3.

git clone [email protected]:MetroRobots/ros_command.git
cd ros_command
sudo pip3 install -r requirements.txt

It also uses some BASH scripts. It is recommended that you add source /path/to/ros_command/setup.bash to your .bashrc. This will add the executable scripts to your PATH and add the library to your PYTHONPATH.

> ~/.bashrc">
echo "source $PWD/setup.bash" >> ~/.bashrc

Note that if you are using ROS 1, it is recommended that you source the setup AFTER you source ROS. Many of the commands in this library have the exact same syntax as their native ROS 1 counterparts, so sourcing after ROS gives these scripts priority.

Commands

roscd

This command was not implemented in ROS 2. There is the somewhat similar colcon_cd command, but it requires additional installation. Instead, this package has implemented a version of roscd that works with ROS 2. Because you cannot change the shell's working directory from within a Python script, roscd is implemented in bash.

rosbuild

rosbuild functions as a convenient wrapper for catkin_make, catkin_tools and colcon. (Apologies to all the people still using rosbuild in its original form, but its been deprecated since 2013.) Running rosbuild will automatically determine your current workspace root folder and which build tool it uses, and then running the equivalent native build command. For example running rosbuild pr2_moveit_config will run the three commands shown in the table in the introduction.

  • Like catkin build, it can be run from anywhere within the workspace directory structure.
  • Can play notification sounds when complete (see Configuration section below)
  • Displays the build status in a fancy blessed-based terminal-focused graphical user interface (although not for catkin_make).
rosbuild.mp4
  • Other arguments not specified in the table below are passed into the raw build command.
Category rosbuild colcon catkin_tools catkin_make
General -c, --continue_on_failure --continue-on-error --continue-on-failure
-j N --jobs N --parallel-workers N --jobs N --jobs N
-b, --cmake_build_type X --cmake_args -DCMAKE_BUILD_TYPE=X --cmake_args -DCMAKE_BUILD_TYPE=X -DCMAKE_BUILD_TYPE=X
Package Selection --this --packages-up-to pkg_name --this --pkg pkg_name
--this --no-deps --packages-select pkg_name --this --no-deps --only-pkg-with-deps
-s --skip_packages pkg_name --packages-skip pkg_name 🔲 -DCATKIN_BLACKLIST_PACKAGES="pkg_name"
pkg_name --packages-up-to pkg_name pkg_name --pkg pkg_name
  • There is no equivalent to --continue-on-failure with catkin_make (and it is probably not possible)
  • 🔲 There is no equivalent to --skip_packages in catkin_tools, although you could theoretically do it by parsing the dependency tree
  • If cmake_build_type is NOT specified, then it defaults to the value in the Configuration. The command line argument does overwrite the configured one.

rosdep_install

One useful arcane command that pops up in many places/aliases (in both ROS 1 and ROS 2) is

rosdep install --ignore-src -y -r --from-paths .

According to the manual , rosdep install will "download and install the dependencies of a given package or packages".

  • --from-paths . specifies that dependencies should be installed for all packages in the current directory
  • --ignore-src will ignore packages that you have the source code checked out
  • -y makes it non-interactive (so it defaults to installing everything without prompting)
  • -r continues when you get errors

Essentially, this is a command for installing all of the upstream dependencies for the packages in your workspace.

Now there's the new simple command rosdep_install which will do the same thing. A version with a terminal GUI similar to rosbuild is in development.

rosmsg / rossrv / rosaction

In ROS 2, rosmsg and rossrv were replaced by ros2 interface, which can also handle actions. For most commands, calling the rosbuild version of rosmsg and rossrv will just call either the ROS 1 rosmsg/rossrv command or the equivalent ros2 interface command.

In ROS 1, if you call rosaction , it will run rosmsg on the constituent parts (i.e. Goal/Result/Feedback). The other rosaction variations will list only the appropriate content for packages with actions defined.

In ROS 2, if you call ros show , there is advanced functionality for matching partial names. The equivalent command to ROS 1's rosmsg show Point is ros2 interface show geometry_msgs/msg/Point. This is cumbersome for a number of reasons. First, ROS 1 is nearly half has short (17 chars vs 43 chars). It also requires you remember what package the message you are looking for is. The version implemented here will search for matching fully qualified names, and then print the fully qualified name and the contents of the interface definition.

source_ros

If you use a single ROS workspace, then you probably source the appropriate setup.bash from the .bashrc file. However, if you use multiple, you can source the appropriate setup.bash with one simple command: source_ros. This will find the appropriate setup.bash by determining the current ROS Workspace based on the folder the script is executed in. Typically, this will either source the devel/setup.bash or install/setup.bash depending on whether it is ROS 1 or 2. (You can also have a setup.bash in the workspace root if you need custom logic to source additional environment variables.)

(Under the hood, this runs the get_current_setup_bash script to print the appropriate filename)

rosrun and rosdebug

In ROS 1, rosrun works the same way as the standard ROS 1 version. In ROS 2, it runs ros2 run.

rosdebug does the same things, except it will insert --prefix 'gdb -ex run --args' into the appropriate place to run your node using gdb.

rosclean

The rosclean command works as a hybrid of rosclean and catkin clean.

  • With no arguments (rosclean) the script will ask whether you want to delete the workspace's devel/install/build/log directories as well as the global ~/.ros/log directory while also printing their sizes.
  • With the -y flag (rosclean -y) it will not prompt you and just delete things!
  • To just print the sizes without deleting anything, you can run rosclean check or rosclean -c.
  • You can also avoid the computation of folder sizes with the -n flag.
  • You can also provide a list of packages (rosclean std_msgs nav2_core) and it will attempt to delete just those portions of the workspace.

You can also throw the word purge at the beginning just to mirror the ROS 1 rosclean more closely.

Configuration

Users may change the default behavior of ros_command by putting settings in yaml files in two places.

  • ros_command.yaml in the workspace root (highest precedence)
  • ~/.ros/ros_command.yaml

The current settings you may change are summarized in this table.

key type default note
cmake_build_type string Release CMAKE_BUILD_TYPE
graphic_build boolean True By default, rosbuild shows a fancy graphical interface
success_sound string / absolute path None Sound file path to play after successful builds
fail_sound string / absolute path None Sound file path to play after unsuccessful builds

Power Usage

If you like really short, convenient commands, try adding these to your ~/.bashrc

alias sros='source_ros'                  # Easier tab completion than source_ros
alias asdf='rosbuild --this -c'          # Builds the package in the current directory (and its dependencies)
alias zxcv='rosbuild --this --no-deps'   # Builds just the package in the current directory

Acknowledgements

CLI tool to view your VIT timetable from terminal anytime!

VITime CLI tool to view your timetable from terminal anytime! Table of contents Preview Installation PyPI Source code Updates Setting up Add timetable

16 Oct 04, 2022
CLI client for RFC 4226's HOTP and RFC 6238's TOTP.

One Time Password (OTP, TOTP/HOTP) OTP serves as additional protection in case of password leaks. onetimepass allows you to manage OTP codes and gener

Apptension 4 Jan 05, 2022
dotfilery, configuration, environment settings, automation, etc.

┌┬┐┌─┐┌─┐┌─┐┬ ┬┌┬┐┬ ┬┬┌─┐ │││├┤ │ ┬├─┤│ │ │ ├─┤││ :: bits & bobs, dots & things. ┴ ┴└─┘└─┘┴ ┴┴─┘┴ ┴ ┴ ┴┴└─┘ @megalithic 🚀 Instal

Seth Messer 89 Dec 25, 2022
Zecwallet-Python is a simple wrapper around the Zecwallet Command Line LightClient written in Python

A wrapper around Zecwallet Command Line LightClient, written in Python Table of Contents About Installation Usage Examples About Zecw

Priveasy 2 Sep 06, 2022
A web shell client written in python.

Webshell client A webshell client written in python. Only works well for linux for the time being. Why? Because there are too many heavy webshells. So

tchar 1 Dec 07, 2021
🦎 A NeoVim plugin for highlighting visual selections like in a normal document editor!

🦎 HighStr.nvim A NeoVim plugin for highlighting visual selections like in a normal document editor! Demo TL;DR HighStr.nvim is a NeoVim plugin writte

Pocco81 222 Jan 03, 2023
Dynamically Generate GitHub Stats as like Terminal Interface

GitHub Stats Terminal Style Dynamically Generate GitHub Stats as like Terminal Interface Usage Create a New Repository using this Template or click he

YOGESHWARAN R 63 Jan 03, 2023
A curated list of awesome things related to Textual

Awesome Textual | A curated list of awesome things related to Textual. Textual is a TUI (Text User Interface) framework for Python inspired by modern

Marcelo Trylesinski 5 May 08, 2022
Python wrapper and CLI utility to render LaTeX markup and equations as SVG using dvisvgm and svgo.

latex2svg Python wrapper and CLI utility to render LaTeX markup and equations as SVG using dvisvgm and svgo. Based on the original work by Tino Wagner

Matthias C. Hormann 4 Feb 18, 2022
A super simple wallet application for the NANO cryptocurrency that runs in the terminal

Nano Terminal Wallet A super simple wallet application for the NANO cryptocurrency that runs in the terminal Written in 2021 by NinjaSnail1080 (Discor

9 Jul 22, 2022
Set of scripts & tools for converting between numbers and major system encoded words.

major-system-converter Set of scripts & tools for converting between numbers and major system encoded words. Uses phonetics instead of letters to conv

4 Aug 09, 2022
🔖 Lemnos: A simple, light-weight command-line to-do list manager.

🔖 Lemnos: CLI To-do List Manager This is a simple program that allows one to manage a to-do list via the command-line. Example $ python3 todo.py add

Rohan Sikand 1 Dec 07, 2022
Commandline Python app to Autodownload mediafire folders and files.

Commandline Python app to Autodownload mediafire folders and files.

Tharuk Renuja 3 May 12, 2022
Standalone script written in Python 3 for generating Reverse Shell one liner snippets and handles the communication between target and client using custom Netcat binaries

Standalone script written in Python 3 for generating Reverse Shell one liner snippets and handles the communication between target and client using custom Netcat binaries. It automates the boring stu

Yash Bhardwaj 3 Sep 27, 2022
Autosub - Command-line utility for auto-generating subtitles for any video file

Auto-generated subtitles for any video Autosub is a utility for automatic speech recognition and subtitle generation. It takes a video or an a

Anastasis Germanidis 3.9k Jan 05, 2023
A simple command line chat app to communicate via the terminal.

A simple command line chat app to communicate via the terminal. I'm new to networking so sorry if some of my terminology or code is messed up.

PotNoodle 1 Oct 26, 2021
Program Command Line Interface (CLI) Sederhana: Pemesanan Nasi Goreng Hekel

Program ini merupakan aplikasi yang berjalan di dalam command line (terminal). Program ini menggunakan built-in library python yaitu argparse yang dapat menerima parameter saat program ini dijalankan

Habib Abdurrasyid 5 Nov 19, 2021
A command line utility to export Google Keep notes to markdown.

Keep-Exporter A command line utility to export Google Keep notes to markdown files with metadata stored as a frontmatter header. Supports exporting: S

Nathan Beals 85 Dec 17, 2022
CLI based Crunchyroll Account Checker Proxyless written in python from scratch.

A tool for checking Combolist of Crunchyroll accounts without proxies, It is written in Python from Scratch ,i.e, no external module is used rather than inbuilt Python modules.

Abhijeet 8 Dec 13, 2022
A python-based terminal application that displays current cryptocurrency prices

CryptoAssetPrices A python-based terminal application that displays current cryptocurrency prices. Covered Cryptocurrencies Bitcoin (BTC) Ethereum (ET

3 Apr 21, 2022