series:
Gazebo学习(一)Ubuntu20.04安装ROS+gazebo11+模型库导入(汇总跳转连接+个人安装记录)_gazebo模型库-优快云博客
Gazebo学习(二)Ubuntu20.04配置RotorS+Gazebo11_rotors simulator ubuntu20.04-优快云博客
**救命终于配置出来环境了,中途还轻轻rm掉了好些东西找不回来了泪目**
*官方代码链接:GitHub - ethz-asl/rotors_simulator: RotorS is a UAV gazebo simulator*
*参考教程:https://www.guyuehome.com/16351*
一、准备工作
1.安装ROS与Gazebo11
*参考教程:
2.安装wstool
sudo apt install python3-wstool
二、源码下载编译
1.创建ROS工程
mkdir -p ~/UAV/src
cd ~/UAV/src
catkin_init_workspace
wstool init
2.下载源码
git clone https://github.com/ethz-asl/rotors_simulator.git
3.下载所需要配置文件
*注:这里满的话可能需要挂梯子或者换源,以及需要登陆自己的Github账号才有权限,直接运行指令不成功可以去Github对应仓库自行下载放在scr目录下*
git clone https://github.com/ethz-asl/mav_comm.git
git clone https://github.com/ethz-asl/glog_catkin.git
git clone https://github.com/ethz-asl/catkin_simple.git
4.编译环境
cd ..
catkin_make
**如果编译[100%],恭喜你丝滑编译成功!!!如果冒红没关系看后面的ERROR解决大法~**
三、测试运行
source devel/setup.bash
roslaunch rotors_gazebo mav_hovering_example.launch mav_name:=firefly world_name:=basic
四、编译可能遇到问题
1.缺少相关安装包
报错:
CMake Error at /opt/ros/noetic/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "octomap_ros" with
any of the following names:
octomap_rosConfig.cmake
octomap_ros-config.cmake
Add the installation prefix of "octomap_ros" to CMAKE_PREFIX_PATH or set
"octomap_ros_DIR" to a directory containing one of the above files. If
"octomap_ros" provides a separate development package or SDK, be sure it
has been installed.
Call Stack (most recent call first):
rotors_simulator/rotors_gazebo_plugins/CMakeLists.txt:106 (find_package)
解决:
sudo apt-get install ros-noetic-octomap-msgs
同理会有其他同样格式出现的未安装包出现,以同样方法运行下面代码,将“octomap-msgs”部分替换成报错中“xxConfig.cmake”中的xx:
sudo apt-get install ros-noetic-xx
2.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
3.无法定位软件包 ros-noetic-desktop-full
解决:
sudo apt update
sudo apt install ros-noetic-desktop-full
4.rotors_gazebo_plugins build fail
解决:
打开:~/UAV/src/rotors_simulator/rotors_gazebo_plugins/CMakeLists.txt
将“add_definitions(-std=c++11)”修改成:
add_definitions(-std=c++17)
5.其他
*参考教程:
**以上为我所遇到的各种问题,如果还有其他问题可以查询一下上面两个链接参考,也欢迎评论区交流**