Ubuntu解决Unable to contact my own server at [http://312:41300/].问题

本人重装将近三十多次Ubuntu系统,每次都要安装ROS和Kinect2驱动,安装教程请看我的另一篇博客,亲测有效!

https://blog.csdn.net/qq_27130627/article/details/85223779

但是在最近,我再次安装时,却出现了以前没出现过的问题,问题如图:

当输入roscore时,报错如下:

上网查资料后,才发现是由于ROS环境变量ROS_MASTER_URI设置错误导致的,不是什么大问题。这里网上有很多资源,基本都是互相抄袭,我这也是,目的是为了做点记录,方便下次再出问题时,可以及时找到解决办法。

临时解决办法:

在终端输入

$ export ROS_HOSTNAME=localhost

$ export ROS_MASTER_URI=http://localhost:11311

之后在运行roscore,就没问题了。

但是这个方法治标不治本,当你重启一个终端时,就需要重新执行上述命令,才能正常运行

一劳永逸的方法:

以下分为两种情况:

1、网上多数是在文件setup.sh中进行修改

这里参考这篇博客

https://blog.csdn.net/m0_37972797/article/details/86482436

首先打开setup.sh文件

# sudo vim /opt/ros/kinetic/setup.sh

没有安装vim的可以用gedit命令

# sudo gedit /opt/ros/kinetic/setup.sh

在打开的setup.sh文件末尾输入上述两行代码,即:

之后再source一下即可

# source /opt/ros/kinetic/setup.sh

2、本人是Ubuntu14.04版本,当我用上述第一种方法时,系统告诉我不存在/opt/ros/kinetic/setup.sh这样的文件。后来在这篇博客找到解决办法:

http://www.bubuko.com/infodetail-2815589.html

是在.bashrc文件中进行修改

# sudo gedit ~/.bashrc

在文件末尾输入:

$ export ROS_HOSTNAME=localhost

$ export ROS_MASTER_URI=http://localhost:11311

如图所示:

最后,一样,source一下就可以了

# source ~/.bashrc

  • 11
    点赞
  • 25
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
root@6527d9173397:/# apt update Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease Ign:2 http://security.ubuntu.com/ubuntu jammy-security InRelease Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease Err:2 http://security.ubuntu.com/ubuntu jammy-security InRelease Temporary failure resolving 'security.ubuntu.com' Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease Ign:1 http://archive.ubuntu.com/ubuntu jammy InRelease Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease Err:1 http://archive.ubuntu.com/ubuntu jammy InRelease Temporary failure resolving 'archive.ubuntu.com' Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease Temporary failure resolving 'archive.ubuntu.com' Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease Temporary failure resolving 'archive.ubuntu.com' Reading package lists... Done Building dependency tree... Done Reading state information... Done All packages are up to date. W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease Temporary failure resolving 'archive.ubuntu.com' W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease Temporary failure resolving 'security.ubuntu.com' W: Some index files failed to download. They have been ignored, or old ones used instead.
06-12

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值