配置源
更换国内源:
sudo sh -c 'echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $(l***_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
设置 Key
sudo apt-cache search -n dirmngr
sudo apt-get install dirmngr
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116
安装
sudo apt update
若出现如下报错,
则导入其公钥即可
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654 #此处F42ED6FBAB17C654需要是错误提示的k
再次
sudo apt update
后不再报错:
sudo apt install ros-lunar-desktop-full
初始化rosdep
将下面仓库的内容clone到本地
git clone https://hub.fastgit.org/ros/rosdistro.git
记录rosdistro存放地址,例如/home/linaro/rosdistro,linaro为用户名 修改如下文件,其中python2.7视系统默认python版本而定,可通过如下命令查阅,下同
python --version
sudo nano /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/linaro/rosdistro/releases/targets.yaml’
替换后的/home/linaro 即为第一步clone内容的存放地址
修改如下文件
sudo nano /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/linaro/rosdistro/index-v4.yaml’
替换后的/home/linaro 即为第一步clone内容的存放地址
到/etc/ros/rosdep/sources.list.d下创建20-default.list文件
cd /etc
创建ros文件夹
sudo mkdir ros && cd ros
创建rosdep文件夹
sudo mkdir rosdep && cd rosdep
创建sources.list.d文件夹
sudo mkdir sources.list.d && cd sources.list.d
创建20-default.list文档
sudo nano /etc/ros/rosdep/sources.list.d/20-default.list
其内容为
# os-specific listings first
yaml file:///home/linaro/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/linaro/rosdistro/rosdep/base.yaml
yaml file:///home/linaro/rosdistro/rosdep/python.yaml
yaml file:///home/linaro/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/linaro/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
注意的是yaml file://表示固定格式/home…表示文件目录,所以是yaml file:///
在终端中执行
rosdep update
环境配置
echo "source /opt/ros/lunar/setup.bash" >> ~/.bashrcsource ~/.bashrc
测试
参考ROS安装并运行小乌龟 在终端中运行以下命令:
roscore
新开一个终端,运行以下命令,打开小乌龟窗口:
rosrun turtlesim turtlesim_node
新开一个终端,运行以下命令,打开乌龟控制窗口,可使用方向键控制乌龟运动:
rosrun turtlesim turtle_teleop_key
选中控制窗口,按方向键,可看到小乌龟窗口中乌龟在运动 新开一个终端,运行以下命令,可以看到ROS的图形化界面,展示结点的关系:
rqt_gra
至此,测试完成,说明ROS安装没有问题。
安装rosinstall
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
卸载
sudo apt remove ros-*
配置源
更换国内源:
sudo sh -c 'echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $(l***_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
设置 Key
sudo apt-cache search -n dirmngr
sudo apt-get install dirmngr
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 421C365BD9FF1F717815A3895523BAEEB01FA116
安装
sudo apt update
若出现如下报错,
则导入其公钥即可
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654 #此处F42ED6FBAB17C654需要是错误提示的k
再次
sudo apt update
后不再报错:
sudo apt install ros-lunar-desktop-full
初始化rosdep
将下面仓库的内容clone到本地
git clone https://hub.fastgit.org/ros/rosdistro.git
记录rosdistro存放地址,例如/home/linaro/rosdistro,linaro为用户名 修改如下文件,其中python2.7视系统默认python版本而定,可通过如下命令查阅,下同
python --version
sudo nano /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/linaro/rosdistro/releases/targets.yaml’
替换后的/home/linaro 即为第一步clone内容的存放地址
修改如下文件
sudo nano /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/linaro/rosdistro/index-v4.yaml’
替换后的/home/linaro 即为第一步clone内容的存放地址
到/etc/ros/rosdep/sources.list.d下创建20-default.list文件
cd /etc
创建ros文件夹
sudo mkdir ros && cd ros
创建rosdep文件夹
sudo mkdir rosdep && cd rosdep
创建sources.list.d文件夹
sudo mkdir sources.list.d && cd sources.list.d
创建20-default.list文档
sudo nano /etc/ros/rosdep/sources.list.d/20-default.list
其内容为
# os-specific listings first
yaml file:///home/linaro/rosdistro/rosdep/osx-homebrew.yaml osx
# generic
yaml file:///home/linaro/rosdistro/rosdep/base.yaml
yaml file:///home/linaro/rosdistro/rosdep/python.yaml
yaml file:///home/linaro/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/linaro/rosdistro/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
注意的是yaml file://表示固定格式/home…表示文件目录,所以是yaml file:///
在终端中执行
rosdep update
环境配置
echo "source /opt/ros/lunar/setup.bash" >> ~/.bashrcsource ~/.bashrc
测试
参考ROS安装并运行小乌龟 在终端中运行以下命令:
roscore
新开一个终端,运行以下命令,打开小乌龟窗口:
rosrun turtlesim turtlesim_node
新开一个终端,运行以下命令,打开乌龟控制窗口,可使用方向键控制乌龟运动:
rosrun turtlesim turtle_teleop_key
选中控制窗口,按方向键,可看到小乌龟窗口中乌龟在运动 新开一个终端,运行以下命令,可以看到ROS的图形化界面,展示结点的关系:
rqt_gra
至此,测试完成,说明ROS安装没有问题。
安装rosinstall
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
卸载
sudo apt remove ros-*
举报