ROS2安装并与ROS1共存

1、安装

  1. 设置编码
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 -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
 
sudo sh -c 'echo "deb [arch=$(dpkg --print-architecture)] http://packages.ros.org/ros2/ubuntu $(lsb_release -cs) main" > /etc/apt/sources.list.d/ros2-latest.list'

3.安装ROS2

sudo apt update
sudo apt install ros-foxy-desktop

4.安装自动补全工具

sudo apt install python3-argcomplete

2、设置环境变量(ROS1与ROS2共存)

sudo gedit ./.bashrc 在最后加入

echo "ros noetic(1) or ros2 foxy(2)?"
read edition
if [ "$edition" -eq "1" ];then
  source /opt/ros/noetic/setup.bash
else
  source /opt/ros/foxy/setup.bash
fi

猜你喜欢

转载自blog.csdn.net/u011573853/article/details/131186042