当先锋百科网

首页 1 2 3 4 5 6 7

×××若为其他版本的ubuntu可以安装对应的ros,只需要将kinetic替换为如下单词:
ubuntu18.04——kinetic替换为melodic
ubuntu20.04——kinetic替换为noetic

一、RotorS介绍

RotorS是ETHZ ASL实验室研发的一个基于Gazebo的无人机仿真环境。

二、参考网址

https://github.com/ethz-asl/rotors_simulator
https://blog.csdn.net/qq_37680545/article/details/123213054

三、安装步骤

1.安装ROS-kinetic(已安装可跳过这一步)

(此处用国内源安装的方法)参考网址:https://www.ncnynl.com/archives/201801/2273.html

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full
sudo rosdep init
rosdep update
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

2.安装所需插件

sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get update
sudo apt-get install ros-kinetic-joy ros-kinetic-octomap-ros ros-kinetic-mavlink python-wstool python-catkin-tools protobuf-compiler libgoogle-glog-dev ros-kinetic-control-toolbox ros-kinetic-mavros

可以用以下语句检验插件是否安装成功:

3.登录gihub

参考网址:ubuntu下安装及配置git的方法(最全超详细教程github)

4.建立工作空间并克隆所需文件

找个平时放project的文件夹

mkdir -p ~/catkin_ws/src	#catkin_ws可以换成你喜欢的名字
cd ~/catkin_ws/src
catkin_init_workspace  # initialize your catkin workspace
git clone [email protected]:ethz-asl/rotors_simulator.git
git clone [email protected]:ethz-asl/mav_comm.git
git clone [email protected]:ethz-asl/glog_catkin.git
git clone [email protected]:catkin/catkin_simple.git

5.编译

cd ~/catkin_ws/
catkin build

6.source

echo "source ~/catkin_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

该步骤的目的是把source语句放到~/.bashrc文件中,这样每次打开终端就能source该项目,不需要手动source

四、测试

1.打开roscore

roscore

如果这一步出问题则说明ros没有安装成功

2.运行RotorS例程

新建一个终端

roslaunch rotors_gazebo mav_hovering_example.launch mav_name:=firefly world_name:=basic

如果出现以下画面则安装成功
运行例程后出现的画面