当前位置: 代码迷 >> 综合 >> 「 Linux调试错误 」roscore:Unable to contact my own server at [http://172.20.10.3:40601/]
  详细解决方案

「 Linux调试错误 」roscore:Unable to contact my own server at [http://172.20.10.3:40601/]

热度:13   发布时间:2023-12-15 10:20:59.0

一、问题描述

        小白在另一个实验室连上新的网络后,出现了roscore运行不成功的问题,错误如下:

... logging to /home/anan/.ros/log/78ed62aa-497b-11e9-aa4d-9cf387dafe8c/roslaunch-ubuntu-4691.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.Unable to contact my own server at [http://172.20.10.3:40601/].
This usually means that the network is not configured properly.A common cause is that the machine cannot ping itself.  Please check
for errors by running:ping 172.20.10.3For more tips, please seehttp://www.ros.org/wiki/ROS/NetworkSetupThe traceback for the exception was written to the log file

二、错误原因

        连上新的网络后,Linux系统的IP地址自动更换了,只需要查看一下现在的IP地址,在ROS的服务器中更改过来就OK。

三、解决办法

        首先,运行下面指令查看,当前系统IP地址:

$ifconfig

        然后,在下列信息中找到你的IP地址:

lo        Link encap:Local Loopback  inet addr:127.0.0.1  Mask:255.0.0.0inet6 addr: ::1/128 Scope:HostUP LOOPBACK RUNNING  MTU:65536  Metric:1RX packets:2729 errors:0 dropped:0 overruns:0 frame:0TX packets:2729 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:228457 (228.4 KB)  TX bytes:228457 (228.4 KB)wlp3s0    Link encap:Ethernet  HWaddr 9c:f3:87:da:fe:8c  inet addr:172.20.10.2  Bcast:172.20.10.15  Mask:255.255.255.240inet6 addr: fe80::b524:5c64:91a0:e76b/64 Scope:LinkUP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1RX packets:12068 errors:0 dropped:0 overruns:0 frame:38539TX packets:9954 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000 RX bytes:11061935 (11.0 MB)  TX bytes:1200013 (1.2 MB)Interrupt:18 

        最后在文档的最后,找到“ export ROS_HOSTNAME= ”,更改IP地址:

        运行下述指令,打开系统配置文件:

$gedit .bashrc
# sources /etc/bash.bashrc).
if ! shopt -oq posix; thenif [ -f /usr/share/bash-completion/bash_completion ]; then. /usr/share/bash-completion/bash_completionelif [ -f /etc/bash_completion ]; then. /etc/bash_completionfi
fialias eb='gedit ~/.bashrc'
alias sb='source ~/.bashrc'
alias agi='sudo apt-get install'
alias gs='git status'
alias gp='git pull'
alias cw='cd ~/catkin_ws'
alias cs='cd ~/catkin_ws/src'
alias cm='cd ~/catkin_ws && catkin_make'
source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash
export ROS_MASTER_URI=http://localhost:11311
export ROS_HOSTNAME=localhost#Set ROS Kinetic
source /opt/ros/kinetic/setup.bash
source ~/catkin_ws/devel/setup.bash#Set ROS Network
export ROS_HOSTNAME=172.20.10.2       //在这里更改
export ROS_MASTER_URI=http://${ROS_HOSTNAME}:11311#Set ROS alias command
alias cw='cd ~/catkin_ws'
alias cs='cd ~/catkin_ws/src'
alias cm='cd ~/catkin_ws && catkin_make'

        打开新的终端,再次运行 roscore即可

*亲测有效

  相关解决方案