长时间不运行ROS,再次运行roscore报错如下
Unable to contact my own server at [http://ly:46129/].
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 ly
For more tips, please see
http://www.ros.org/wiki/ROS/NetworkSetup
The traceback for the exception was written to the log file
解决方法如下:
方法1 连续输入两个命令
$ export ROS_HOSTNAME=localhost
$ export ROS_MASTER_URI=http://localhost:11311
再次在同一个终端里运行,即可成功。但是重新打开终端还需重新输入。
方法2
在文件setup.sh中修改,添加上述两项环境变量
sudo vim /opt/ros/kinetic/setup.sh
修改之后source命令使环境变量生效。
$ source /opt/ros/kinetic/setup.sh