1、更新ubuntu
终端输入:sudo apt-get update
终端输入:sudo apt-get upgrade
2、设置源-系统设置-软件和更新-源代码打勾
找到http://mirrors.tuna.tsinghua.edu.cn/ubuntu清华的源
中科大的源也行
3、安装ROS
3.1 Configure your Ubuntu repositories
3.2 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'
3.3 Set up your keys
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
3.4 Installation
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
3.5 Environment setup
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
3.6 Dependencies for building packages
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
sudo apt install python-rosdep
sudo rosdep init
rosdep update
在运行sudo rosdep init会出现错误
链接https://blog.csdn.net/weixin_44692299/article/details/105869229
ros 中ERROR: cannot download default sources list
from: https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.
1 在桌面打开终端输入下面指令
sudo chmod 777 /etc
此指令为获取etc中的权限,操作成功后如下:每个图标右下角有一把锁
2 在etc中手动创建(一定要手动创建,别自作聪明指令创建,以防小白入坑)
目录入————》》》/etc/ros/rosdep/sources.list.d
多说一句,etc目录的进入方法
3 打开网址:https://site.ip138.com
输入raw.githubusercontent.com
随便挑选一个ip地址,我选的是美国的。
新建一个空白文档如下编辑:
4 在桌面打开终端输入如下指令:
sudo vi /etc/hosts
将刚刚创建的文档里的信息粘贴如下:
vi编辑器,将鼠标光标移动到需要编辑的地方,按字母i进入编辑模式,粘贴好后ctrl+c退出编辑状态,在输入冒号加wq在按回车(:wq)
4 创建项目
mkdir -p ~/catkin_ws/src
cd~/catkin_ws/src
catkin_init_workspace
cd..
catkin_make
source~/catkin_ws/devel/setup.bash
添加三句gedit ~/.bashrc
source /usr/share/gazebo-7/setup.sh
source /opt/ros/kinetic/setup.bash
source $HOME/catkin_ws/devel/setup.bash
下载UUV模型
sudo apt install ros-kinetic-uuv-simulator
下一步cd~/catkin_ws/src
克隆git clone https://github.com/uuvsimulator/lauv_gazebo.git
下载的uuv_simulator放到 src里
运行环境 roslaunch uuv_gazebo_worlds ocean_waves.launch
roslaunch lauv_description upload.launch mode:=default x:=0 y:=0 z:=0 namespace:=auv