ROS——无人机ROS仿真包 rotors_simulator 编译教程


1. 安装依赖工具

安装wstool

sudo apt install python3-wstool

2. 源码下载编译

2.1 创建ROS工程

$ mkdir -p ~/UAV/src
$ cd ~/UAV/src
$ catkin_init_workspace  # initialize your catkin workspace
$ wstool init

2.2 下载源码

git clone git@github.com:ethz-asl/rotors_simulator.git

2.3 可能遇到的问题

下载源码的过程中可能会出现如下的问题:

2.3.1 git失败

在这里插入图片描述
解决方法请参考我的另外一篇博客,点这里跳转

2.3.2 缺少mav_msgs

在这里插入图片描述这个问题出现在noetic版本的ROS中,原因是该版本已经将这个ros包移除,解决办法是去mav_msgs官方github下载源码,然后放入工程的src/目录下,本文中放在~/UAV/src目录下。

2.3.3 缺少某些包

在这里插入图片描述
解决方法请参考我的另外一篇博客,点这里跳转

2.3.4 CMake Error

出现如下提示:

CMake Error at rotors_simulator/rotors_gazebo_plugins/cmake/FindGlog.cmake:77 (MESSAGE):
  Failed to find glog - Could not find glog include directory, set
  GLOG_INCLUDE_DIR to directory containing glog/logging.h
Call Stack (most recent call first):
  rotors_simulator/rotors_gazebo_plugins/cmake/FindGlog.cmake:103 (GLOG_REPORT_NOT_FOUND)
  rotors_simulator/rotors_gazebo_plugins/CMakeLists.txt:147 (find_package)


-- Configuring incomplete, errors occurred!

解决方案

sudo apt-get install libgoogle-glog-dev  

解决问题后重新在工程目录下输入catkin_make即可

2.3.5 python no found

出现如下提示:

[ 12%] Generating /home/lanx/Project/ROS/UAV/src/rotors_simulator/rotors_gazebo/models/iris/iris.sdf
/bin/sh: 1: python: not found
make[2]: *** [rotors_simulator/rotors_gazebo/CMakeFiles/sdf.dir/build.make:64: /home/lanx/Project/ROS/UAV/src/rotors_simulator/rotors_gazebo/models/iris/iris.sdf] Error 127

解决方案:
  这种情况的出现通常都是使用了较新版本的ubuntu,例如我用的ubuntu 20.04,系统自带的python版本就说python3.8,所以出现了问题。因此需要添加从python3到python的映射:

sudo ln -s /usr/bin/python3 /usr/bin/python

2.3.6 VMware运行Gazebo出错

  这个问题主要出现在使用WMware虚拟机运行Gazebo的情况下,提示如下:

VMware: vmw_ioctl_command error Invalid argument.”

解决方案:

echo "export SVGA_VGPU10=0" >> ~/.bashrc

3. 测试

  记得每次出错后最好把工程目录下build文件夹内的文件都删除,然后重新catkin_make

  在工程目录下输入:

source devel/setup.bash
roslaunch rotors_gazebo mav_hovering_example.launch mav_name:=firefly world_name:=basic

运行结果如下图:
在这里插入图片描述

参考资料

  1. rotors_simulator的github账户
  • 7
    点赞
  • 59
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值