时隔两年再次使用ROS,环境都更新了,简单记录一下配置的过程
先换源,以阿里源为例,备份原有源
sudo cp /etc/apt/sources.list /etc/apt/sources_init.list
使用gedit编辑源文件,也可以用vim编辑
sudo gedit /etc/apt/sources.list
将文件内容全部删除,替换成下文
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
apt二连
sudo apt-get update
sudo apt-get upgrade
设置“软件和更新”
sudo update-manager -c -d
如果要升级就升级,升级完后点左下角的设置就可以进到这个界面了,前四个勾选上,第五个可选
添加官方ROS源,这个建议挂代理来更新,要不然会比较慢
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
设置秘钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
更新软件源并安装ROS
sudo apt-get update
sudo apt-get install ros-neotic-desktop-full
安装一些常用工具
sudo apt install python3-rosinstall python3-rosinstall-generator python3-wstool build-essential python3-rosdep ninja-build
初始化rosdep,第二行的命令官方建议不要加sudo
sudo rosdep init
rosdep update
设置环境变量(可选)
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
如果不设置则需要每次在包的路径下使用
source setup.bash
此时可以测试下例程了,打开三个终端分别运行三个命令,在最后一个终端中用方向键就可以控制小乌龟移动了
1 roscore 2 rosrun turtlesim turtlesim_node 3 rosrun turtlesim turtle_teleop_key
感谢
Ubuntu20.04系统ros-neotic版本的安装与安装过程中遇到的一些问题(纯小白教程)
https://blog.csdn.net/weixin_43433726/article/details/106899359