@scottzhou 已经解决,通过

6.2 解决WLS 网络通信问题,WSL 的IP地址与Windows 地址不一致 1. 新建 C:\Users\你的用户名\.wslconfig 2. 复制 [wsl2] networkingMode=mirrored dnsTunneling=true firewall=true autoMemoryReclaim=gradual 3. 关闭 wsl --shutdown 4.检查 hostname -I 5. ROS 环境变量(WSL 内) # 临时生效 export ROS_MASTER_URI=http://$(hostname -I | awk '{print $1}'):11311 export ROS_IP=$(hostname -I | awk '{print $1}') # 永久生效(写入 ~/.bashrc) echo "export ROS_MASTER_URI=http://$(hostname -I | awk '{print $1}'):11311" >> ~/.bashrc echo "export ROS_IP=$(hostname -I | awk '{print $1}')" >> ~/.bashrc

source ~/.bashrc