Use this skill when the user encounters ROS errors, issues, or unexpected behavior. Covers common error messages, diagnostic approaches, and proven solutions for roscore issues, topic problems, build errors, network issues, and more. Trigger examples: - "Unable to communicate with master" - "Topic not found" - "Node crashed" - "Transform error" - "Build failed" - "roswtf shows warnings" - "Message type mismatch"
Quick reference for diagnosing and fixing common ROS issues.
# Source environment
# Run diagnostics
roswtf
# Check environment
env | grep ROS
# Check master
rostopic list
# Check nodes
rosnode list
rosnode ping /node_name
Message:
ERROR: Unable to communicate with master!
Causes & Fixes:
| Cause | Fix |
|---|---|
| roscore not running | Start roscore or use roslaunch |
| Wrong ROS_MASTER_URI | export ROS_MASTER_URI=http://localhost:11311 |
| Firewall blocking port | Open port 11311 |
| Network unreachable | Check connectivity to master host |
Diagnostic:
echo $ROS_MASTER_URI
ping $(echo $ROS_MASTER_URI | sed 's|http://||' | cut -d: -f1)
Message:
ERROR: Cannot find topic /topic_name
Causes & Fixes:
| Cause | Fix |
|---|---|
| Publisher not running | Start the publishing node |
| Wrong topic name | Check rostopic list for correct name |
| Namespace issue | Use full topic path /namespace/topic |
| Remapping problem | Check launch file remappings |
Diagnostic:
rostopic list | grep -i keyword
rosnode list
rosnode info /suspected_publisher
Message:
ERROR: Message type 'X' does not match type 'Y'
Causes & Fixes:
| Cause | Fix |
|---|---|
| Different message versions | Rebuild all packages |
| Wrong message type in code | Fix code to use correct type |
| Stale rosbag | Re-record with current messages |
Diagnostic:
rostopic type /topic_name
rosmsg show $(rostopic type /topic_name)
Messages:
Lookup would require extrapolation into the future
Could not find transform from X to Y
Causes & Fixes:
| Cause | Fix |
|---|---|
| TF publisher not running | Start TF broadcaster |
| Clock skew | Sync system clocks (NTP) |
| Missing static transform | Add static_transform_publisher |
| Too slow TF rate | Increase TF publish rate |
Diagnostic:
rosrun tf tf_monitor
rosrun tf tf_echo frame1 frame2
rostopic echo /tf
# Install ROS dependencies
rosdep install --from-paths src --ignore-src -r -y
# Source ROS environment
# Check if dependency is installed
dpkg -l | grep ros-noetic-dependency
# Install missing package
sudo apt install ros-noetic-package-name
# Check package.xml for missing dependencies
cat package.xml | grep depend
# Add missing dependency to CMakeLists.txt
# find_package(catkin REQUIRED COMPONENTS missing_pkg)
Debug with gdb:
<node pkg="pkg" type="node" name="node" launch-prefix="gdb -ex run --args"/>
# After crash, in gdb:
bt full # Full backtrace
Check for:
rosparam listrostopic listrostopic echo /rosout | grep -i error
# On ALL machines, set:
export ROS_MASTER_URI=http://MASTER_IP:11311
export ROS_IP=$(hostname -I | awk '{print $1}')
# Verify connectivity
rostopic list
rosnode ping /remote_node
Check:
# Test direct connection
rosnode info /remote_node # Shows URI
# Try connecting to that URI directly
Node is unresponsive. Kill and restart:
rosnode kill /node_name
rosnode cleanup
May be expected if no consumer running. Check if:
rospack find package_name
# Check message delay
rostopic delay /topic_name
# Check network bandwidth
rostopic bw /topic_name
Fixes:
# Check topic statistics
rostopic hz /topic_name
rostopic bw /topic_name
Fixes:
# Essential environment variables
echo $ROS_DISTRO # Should be: noetic
echo $ROS_MASTER_URI # Default: http://localhost:11311
echo $ROS_PACKAGE_PATH # Should include your workspace
echo $ROS_IP # Your IP (for multi-machine)
# Reset environment
# Check what's sourced
echo $CMAKE_PREFIX_PATH
Clean rebuild:
cd catkin_ws
catkin clean -y
catkin build
Kill everything:
killall -9 rosmaster roscore rosout
Check logs:
cat ~/.ros/log/latest/*.log | grep -i error
Start fresh:
rosclean purge
roscore &
Check for zombie nodes:
rosnode cleanup