• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

Ubuntu18下安装ROS1&2

人工智能 谦墨 1641次浏览 0个评论

记录下在Ubuntu18中同时安装ROS1&2的主要步骤以及一些小问题,之后遇到新的问题会更新

ROS Melodic

安装源

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ `lsb_release -cs` main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

安装ros-melodic-desktop-full

sudo apt update
sudo apt install ros-melodic-desktop-full

(可能会遇到没有rosdep的情况,安装即可)

sudo apt install python-rosdep

修改host文件以提高update的成功率

sudo nano /etc/hosts
199.232.28.133 raw.githubusercontent.com

初始化

sudo rosdep init
rosdep update

环境变量

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

其他依赖

sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

ROS Dashing

语言环境

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

安装源

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 http://mirror.tuna.tsinghua.edu.cn/ros2/ubuntu/ bionic main" > /etc/apt/sources.list.d/ros2-latest.list'

安装ros-dashing-desktop

sudo apt update
sudo apt install ros-dashing-desktop

(添加ros2软件源后,update出现类似“N: Skipping acquire of configured file ‘main/binary-i386/Packages’ as repository ‘http://packages.ros.org/ros2/ubuntu bionic InRelease’ doesn’t support architecture ‘i386’”报错的解决办法)

sudo nano /etc/apt/sources.list.d/ros2-latest.list
deb http://packages.ros.org/ros2/ubuntu bionic main  
#改为  
deb [arch=amd64] http://packages.ros.org/ros2/ubuntu bionic main
sudo apt update

环境变量

echo "source /opt/ros/dashing/setup.bash" >> ~/.bashrc
source ~/.bashrc

其他依赖

sudo apt install python3-argcomplete ros-dashing-rmw-opensplice-cpp ros-dashing-rmw-connext-cpp ros-dashing-ros1-bridge python3-colcon-common-extensions

环境变量

使用张瑞雷老师的bash脚本,开启bash时手动选择ROS版本 修改~/.bashrc如下

#source /opt/ros/melodic/setup.bash
#source /opt/ros/dashing/setup.bash
# ROS 1.0 melodic or ROS 2.0 Dashing
echo ROS 1.0 or ROS 2.0? 1=Melodic 2=Dashing 
read ROS
if (($ROS==1));then
source /opt/ros/melodic/setup.bash
echo "Melodic"
elif (($ROS==2));then
source /opt/ros/dashing/setup.bash
echo "Dashing"
else
echo "Non-ROS"
fi

参考链接: https://blog.csdn.net/feimeng116/article/details/106602562 https://blog.csdn.net/ZhangRelay/article/details/103868465


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明Ubuntu18下安装ROS1&2
喜欢 (0)

您必须 登录 才能发表评论!

加载中……