文章目录

  • 1. 安装依赖工具
  • 2. 源码下载编译
    • 2.1 创建ROS工程
    • 2.2 下载源码
    • 2.3 可能遇到的问题
      • 2.3.1 git失败
      • 2.3.2 缺少某些包
      • 2.3.3 CMake Error
      • 2.3.4 python no found
      • 2.3.5 VMware运行Gazebo出错
  • 3. 测试
  • 参考资料

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失败

  1   解决方法请参考我的另外一篇博客,点这里跳转

2.3.2 缺少某些包

  2   解决方法请参考我的另外一篇博客,点这里跳转

2.3.3 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.4 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.5 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
    运行结果如下图:   2  

参考资料

  1. rotors_simulator的github账户