问题描述
在终端运行roscore的时候,会运行不起来,出现如下错误:
jetbot@destop:~$ roscore
... logging to /home/jetbot/.ros/log/3379ba1e-0039-11ea-8c79-1831bf6e1a36/roslaunch-destop-5954.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://destop:33221/].
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 destop
For more tips, please see
http://www.ros.org/wiki/ROS/NetworkSetup
The traceback for the exception was written to the log file
解决办法:
1) 观察/etc/hosts
看下该文件是否曾经被修改过,你可能修改过它用于多机通信,将其再次修改为如下形式,第二行"desktop"要修改为你的电脑名字.
127.0.0.1 localhost
127.0.0.1 desktop
# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
2) 观察 ~/.bashrc
观察下.bashrc是否被修改了,如被修改了,要改为如下形式:
$ sudo gedit ~/.bashrc
export ROS_HOSTNAME=localhost
export ROS_MASTER_URI=http://localhost:11311
最后,使其生效.
source ~/.bashrc
3) 测试
再次启动一个新的终端.注意必须是新终端才生效的.
$ roscore
成功的话会看到熟悉的画面:
jetbot@destop:~$ roscore
... logging to /home/jetbot/.ros/log/84cb70f6-0039-11ea-8c79-1831bf6e1a36/roslaunch-destop-6263.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.
started roslaunch server http://localhost:35579/
ros_comm version 1.12.14
SUMMARY
========
PARAMETERS
* /rosdistro: kinetic
* /rosversion: 1.12.14
NODES
auto-starting new master
process[master]: started with pid [6273]