【版本建议】
ubuntu18 --> ros2 dashing
ubuntu20 --> ros2 foxy
【安装方法】
方法一:
使用 FishROS 提供的脚本进行一键配置安装(推荐,因为确实省心好用)
wget http://fishros.com/install -O fishros && bash fishros
方法二:
使用官方脚本进行配置安装
1、设置UTF-8编码
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
2、更新软件源
sudo apt update && sudo apt install curl gnupg2 lsb-release
curl http://repo.ros2.org/repos.key | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64,arm64] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
3、安装ros2
sudo apt install ros-dashing-desktop
4、命令行自动补全工具
sudo apt install python3-argcomplete
5、编译工具集
sudo apt install ros-dev-tools
6、如果你已经有ROS1了,那么需要在 ~/.bashrc 文件中加入以下内容
echo "ROS melodic (1) or ROS2 dashing (2)?"
read edition
if [ "$edition" -eq "1" ];then
source /opt/ros/melodic/setup.bash
echo using ros melodic
else
source /opt/ros/dashing/setup.bash
echo using ros2 dashing
fi
【友情提示】
安装ros2之前,建议先把ros1装好,这样会少很多很多麻烦