ROS-Hacks
June 19, 2026 ยท View on GitHub
This is a repository for the ROS-Hacks package, a productivity toolkit that enhances the ROS2 development experience with workspace management tools, convenient aliases, keyboard shortcuts, and utility functions.
Supported platforms
| Ubuntu | ROS 2 |
|---|---|
| 20.04 (focal) | Foxy |
| 22.04 (jammy) | Humble |
| 24.04 (noble) | Jazzy |
ROS-Hacks detects the matching ROS 2 distribution from your Ubuntu release and falls back to any installed /opt/ros/<distro> if detection is inconclusive.
Adding this repository to your system
- Download and add the GPG key:
wget -qO /tmp/ros-hacks.key https://danlil240.github.io/ros-hacks-apt/ros-hacks.key
sudo mkdir -p /etc/apt/keyrings
cat /tmp/ros-hacks.key | sudo gpg --dearmor -o /etc/apt/keyrings/ros-hacks.gpg
- Add the repository to your sources:
echo "deb [signed-by=/etc/apt/keyrings/ros-hacks.gpg] https://danlil240.github.io/ros-hacks-apt stable main" | sudo tee /etc/apt/sources.list.d/ros-hacks.list
- Update and install:
sudo apt update
sudo apt install ros-hacks
- After installation, run the setup script:
ros-hacks-setup
Features and Usage
Powerlevel10k Integration
ROS-Hacks now includes integration with Powerlevel10k (p10k) to display your current ROS workspace and domain ID in your prompt:
- ๐ค Workspace: Shows current ROS workspace name
- ๐ Domain: Shows current ROS_DOMAIN_ID
- Auto-refresh: Prompt updates when switching workspaces or domains
Setup:
# Run the p10k setup script
ros-hacks-setup-p10k
# Or manually add to your ~/.p10k.zsh:
POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(
# ... your existing elements ...
ros_workspace
ros_domain
# ... more elements ...
)
See docs/P10K-INTEGRATION.md for detailed configuration options.
ROS2 Workspace Management
- Select workspace: Press
F3or runselect_ws - Create new workspace: Press
Shift+F3or runprompt_new_ws - Rebuild current workspace: Press
F9or runrebuild_curr_ws - Force CMake reconfigure: Press
Ctrl+F9or runrebuild_curr_ws --cmake-force-configure - Build specific package: Press
F8, then enter the package name
ROS2 Command Shortcuts
- List topics:
rtlorros2 topic listor pressAlt+Ctrl+t - Echo topic:
rte <topic>orros2 topic echo <topic> - List nodes:
rnlorros2 node listor pressAlt+Ctrl+n - List services:
rslorros2 service list - List parameters:
rplorros2 param list - List actions:
ralorros2 action list
Workspace Navigation
- Go to workspace root:
cw - Go to workspace src directory:
cs - Go to a package directory:
ros2cd <package_name>
Build Commands
- Build workspace:
coborcolcon build --symlink-install - Build in Debug mode:
cobd - Build in Release mode:
cobr - Build specific package:
cobp <package_name> - Build up to package:
cobput <package_name> - Clean workspace:
coc
ROS_DOMAIN_ID Management
- Set domain ID:
set_ros_domain_id <id> - Get current domain ID:
print_ros_domain_id - Change domain ID: Available in the
select_wsmenu
Utility Functions
- Show ROS environment variables:
pR - Source ROS2 setup:
sr - Clean ROS2 environment:
csr - Source current workspace:
sw - Show cached ROS-Hacks stdout:
rhoutorshow_ros_hacks_stdoutor pressF4 - Show colcon build errors:
seorshow_colcon_errors - Monitor topic:
ros2_topic_monitor <topic> - Check topic frequency:
ros2_topic_hz <topic> - Check topic bandwidth:
ros2_topic_bw <topic>
Keyboard Shortcuts (via inputrc)
F4: Show cached ROS-Hacks stdout for this terminal (show_ros_hacks_stdout/rhout)F5: Reload bash configurationShift+F9: Rebuild workspace and exit terminalCtrl+g: Add grep filter to commandAlt+Ctrl+i: Start apt install commandAlt+Ctrl+p: Start pip install commandShift+F2: Install ROS2 package
Workspace Alias Management
ROS-Hacks automatically discovers and sources alias files in your workspace:
- Automatic discovery: When sourcing a workspace, ROS-Hacks searches for files ending with "aliases"
- Smart caching: Alias files are cached for fast terminal startup - only searches when switching workspaces
- Manual refresh: Run
cache_ws_aliasesto manually refresh the alias cache for current workspace - Workspace-specific: Each workspace can have its own set of alias files anywhere in the directory tree
How it works:
- When you select a new workspace (
F3orselect_ws), ROS-Hacks searches for all files ending with "aliases" - Found alias files are cached and automatically sourced
- On subsequent terminal sessions, cached aliases are sourced instantly without searching
- Cache refreshes automatically when switching to a different workspace
Example alias file locations:
~/my_ws/src/my_package/scripts/.my_aliases~/my_ws/src/custom_aliases~/my_ws/src/tools/robot_aliases
Quick Commands
- Set a quick command:
set-quick-command "your command here" - Execute saved command:
exec-quick-command - View saved command:
print-quick-command
The prompt shows the current workspace name and ROS_DOMAIN_ID for easy reference.