Table of Contents
Overview#
ROS networking issues are common when setting up multi-machine systems. This guide addresses the “Unable to contact my own server” error and related problems.
The Error#
Unable to contact my own server at [http://192.168.0.4:42767/].
This usually means that the network is not configured properly.Root Cause#
The ROS environment variables are incorrectly configured. Each machine needs:
ROS_MASTER_URI: Points to the ROS MasterROS_HOSTNAME: This machine’s own IP address
Network Setup Example#
Topology#
Router (192.168.0.1)
├── PC (192.168.0.3) ← ROS Master
└── Raspberry Pi (192.168.0.4) ← RobotCorrect Configuration#
On PC (Master):
export ROS_MASTER_URI=http://192.168.0.3:11311
export ROS_HOSTNAME=192.168.0.3On Raspberry Pi:
export ROS_MASTER_URI=http://192.168.0.3:11311
export ROS_HOSTNAME=192.168.0.4Common Mistakes#
| Mistake | Problem |
|---|---|
| Same hostname on both | Nodes can’t distinguish machines |
| Wrong master URI | Can’t find roscore |
| Localhost on robot | Can’t reach across network |
| Wrong IP address | Network unreachable |
Verification Steps#
Step 1: Check IP Addresses#
On each machine:
hostname -IStep 2: Verify Connectivity#
From PC:
ping 192.168.0.4From Pi:
ping 192.168.0.3Step 3: Check Environment#
echo $ROS_MASTER_URI
echo $ROS_HOSTNAMEStep 4: Test roscore#
On master:
roscoreOn slave:
rostopic listDebugging Commands#
ROS Network Debug#
roswtfChecks for common issues.
Port Connectivity#
nc -zv 192.168.0.3 11311Should report success.
Firewall Check#
sudo ufw statusIf active, allow ROS:
sudo ufw allow 11311Error Messages Explained#
“Unable to contact my own server”#
ROS_HOSTNAME is wrong for this machine.
“Unable to connect to master”#
- roscore not running
- Wrong ROS_MASTER_URI
- Network/firewall issue
“ERROR: Unable to communicate with master”#
Same as above, check master status.
“Could not contact ROS master”#
Master unreachable from this machine.
Multi-Machine Checklist#
- Both machines on same network
- Can ping between machines
- ROS_MASTER_URI same on both (master’s IP)
- ROS_HOSTNAME different (each machine’s own IP)
- roscore running on master
- No firewall blocking port 11311
- Time synchronized (ntpdate)
Headless Operation#
For Raspberry Pi without GUI:
Verify WiFi Connection#
iwconfig wlan0Check DHCP#
cat /var/lib/dhcp/dhclient.leasesStatic IP (Optional)#
Edit netplan:
network:
version: 2
ethernets:
eth0:
addresses:
- 192.168.0.4/24
gateway4: 192.168.0.1Recovery Steps#
If everything breaks:
- Reset to localhost on both machines
- Test roscore locally
- Gradually add network configuration
- Test after each change
# Temporary reset
export ROS_MASTER_URI=http://localhost:11311
export ROS_HOSTNAME=localhost
roscore