在Ubuntu20.04下运行海龟跟随实验的问题解决方案

在Ubuntu20.04下运行海龟跟随实验的问题解决方案,第1张

在Ubuntu20.04下运行海龟跟随实验的问题解决方案

在学习古月居的小海龟跟随实验时,用20.04的ubuntu遇到了许多问题,然后挨个查找浪费了大量时间,在这里给大总结一下我所遇到的问题和收集到的解决方法。

1.在运行

sudo apt-get install ros-melodic-turtle-tf

遇到无法定位安装包

解决方法:

问题应该是20.04.应该用安装

sudo apt-get install ros-noetic-turtle-tf

2.无法更新源

解决方法:

(1)备份来的软件

sudo cp -v /etc/apt/sources.list /etc/apt/sources.list.backup

(2)执行chmod命令更改文件权限使软件源文件可编辑

sudo gedit /etc/apt/sources.list

若报错则用

vim /etc/apt/sources.list

进入后摁i进入编辑模式,代码全部删除并替换下面的源(阿里)

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

更新后退出并更新软件和列表

sudo apt update

sudo apt upgrade

在进行sudo apt update时若遇到问题,可以尝试将软件与更新中的Ubtuntu软件最下面的Cdrom with Ubuntu 20.04 ‘Focal Fossa’的勾选取消,然后再尝试。

3.在运行 rosrun tf view_frames时遇到错误代码:TypeError: cannot use a string pattern on a bytes-like object

解决方案:

sudo vim /opt/ros/noetic/lib/tf/view_frames 

找到print (vstr)下面一行的m = r.search(vstr)改为m = r.search(str(vstr)),说白了就是把他改为字符串文件。

4.无法生成第二之小海龟

解决方案:更新python版本,问题在于python的版本不兼容,打开终端复制下面的

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1

然后再次尝试启动。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5651785.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存