记录Ubuntu18安装ros系统
一、换阿里源
二、配置软件和更新设置
为了能顺利更新
这里我电脑连接手机开的网络热点
三、开始安装
参考wiki进行安装ros安装官网
注意这里安装过程全程用手机热点
-
Setup your sources.list
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
-
Set up your keys
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
-
Installation
sudo apt update
sudo apt install ros-melodic-desktop-full
开始安装ros
如果有提示下载失败,为网络问题,重新执行一次命令即可。 -
Initialize rosdep
sudo rosdep init
安装停在了这里
这里给出我的解决办法来代替sudo rosdep init
保证网络畅通打开这个提示网址:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
复制这段内容# os-specific listings first yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx # generic yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead ######## # os-specific listings first #yaml https://raw.github.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx # generic #yaml https://raw.github.com/ros/rosdistro/master/rosdep/base.yaml #yaml https://raw.github.com/ros/rosdistro/master/rosdep/python.yaml #yaml https://raw.github.com/ros/rosdistro/master/rosdep/ruby.yaml #gbpdistro https://raw.github.com/ros/rosdistro/master/releases/fuerte.yaml fuerte # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
终端执行命令手动创建文件
sudo mkdir -p /etc/ros/rosdep/sources.list.d cd /etc/ros/rosdep/sources.list.d sudo gedit 20-default.list
将内容粘贴保存,问题解决。
接下来执行命令rosdep update
如果出现网络错误请重新输入命令直到成功
-
Environment setup
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
-
Dependencies for building packages
sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential
到此ros机器人系统安装成功!
四、运行小乌龟
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key