1. 设置ubuntu源
设置为清华源(自己系统中设置了也要输入一次)
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
2 添加密钥
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
3.安装ros
sudo apt-get update
sudo apt-get install ros-melodic-desktop-full
4. 初始化ros
sudo rosdep init
输入
sudo apt install python-rosdep2
虽然再次输入 sudo rosdep init 还是会失败,但sudo apt install python-rosdep2后面还是要的
rosdep update
这是连接ros服务器(在国外),所以连不上,只能自己下载安装包进行安装
下载ros包
git clone https://github.com/ros/rosdistro.git
改变文件源地址
自己rosdistro的地址/home/jiahao/Desktop/git/ros/rosdistro
改的地址没有 master
文件1
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
REP3_TARGETS_URL =https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml’
改成
REP3_TARGETS_URL = 'file:///home/jiahao/Desktop/git/ros/rosdistro/releases/targets.yaml'
文件2
sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py
DEFAULT_INDEX_URL = ‘https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml’
改成
DEFAULT_INDEX_URL = 'file:///home/jiahao/Desktop/git/ros/rosdistro/index-v4.yaml'
文件3
sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list
最后
rosdep update
成功
问题
1 ubuntu20 是python3
2.roscore 出现安装roslaunch,依赖找不到
https://blog.csdn.net/ljh5930/article/details/124679148
?
文件2(不用管)
sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py
DEFAULT_INDEX_URL ='https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'
改成
DEFAULT_INDEX_URL = 'file:///home/jiahao/Desktop/git/ros/rosdistro/index-v4.yaml'