/rosbash

Aliases and functions to improve ease of development in ROS.

Primary LanguageShellOtherNOASSERTION

ROSBash

ROSBash provides a set of aliases and bash functions to make it more user friendly when used from the command-line.

Installation

Simply source the rosbash.bash script in your ~/.bashrc:

# If installing from GitHub
git clone ROSBASH_REPO_URL
cd rosbash
# Add an empty line, add the source command
echo >> ~/.bashrc && echo source `pwd`/rosbash.bash >> ~/.bashrc
source ~/.bashrc
install-rosbash

Restart your shell for the changes to take effect.

Usage

Loading ROS environments

Specific ROS environments can be loaded directly in a subshell with a dedicated prompt. This is handy when you need to often switch your environment:

groovy
indigo
hydro
kinetic
lunar
melodic

The following commands start a new shell with a workspace environment (either devel or install) for instance:

cd ~/ros_ws
devel

or

cd ~/ros_ws
install

Any of these shells can be exited with the command exit or by pressing Ctrl-D.

Manipulating ROS environment variables

The following commands gives you the list of all ROS relevant environment variables, or just those related to the network:

ros
rosnetwork

The next commands allow you to manipulate the environment variables:

rosmaster my_robot.local     # Set ROS_MASTER_URI to http://my_robot.local:11311
roshostname titan.local     # Set ROS_HOSTNAME to titan.local and remove ROS_IP
rosip 192.168.0.1     # Set ROS_IP to 192.168.0.1 and remove ROS_HOSTNAME
rosmaster           # Reset to localhost, remove ROS_IP/ROS_HOSTNAME and ROS_MASTER to http://localhost:11311

Generating Debian Packages

Based on these instructions.

## run this one time to install dependencies. Requires sudo
install-rosbash
## once your workspace is sources in a terminal
todeb ROS_PACKAGE_NAME
## this will generate a Debian package in a folder called deb at the root of your workspace.

## to generate Debian packages for all packages in your workspace
all-todeb

## to install all publicly available dependencies for the packages in your workspace
install_deps

Rosdep keys for private ROS package dependencies are generated automatically when using todeb or all-todeb, however the packages must be in the workspace for their keys to be generated.

Keys for other private ROS package dependencies must user-defined, in the file src/rosdep_keys.yaml inside the ROS workspace. See the key example below:

yaml_cpp_0_6:
  ubuntu:
    xenial: [ros-kinetic-yaml-cpp-0-6]

Other useful commands

cm # Finds the root folder of your workspace, run catkin_make and comes back to current folder
rosrefresh    # Rebuilds the index of packages in your workspace (useful if your packages are not seen)
urdf_display my_robot.urdf # Display the URDF model in the GUI
xacro_display my_robot.xacro # Generates the URDF from XACRO and display it in GUI
toggle-hostname # displays/hides local hostname in the prompt 
rn # rosnode list
rni # rosnode info
rte # rostopic echo
rtl # rostopic list
rti # rostopic info