Ubuntu 18 2022无人机大赛模拟器构建说明

Ubuntu 18 2022无人机大赛模拟器构建说明

问题描述

官网提供的构建流程,基于Ubuntu20,ROS noetic,不适用于Ubuntu18,另外Ubuntu22装不了ROS,只有ROS2,两者不兼容,使用Ubuntu22可以考虑使用docker安装。
Ubuntu18系统使用的gcc版本默认为7,在构建时可能存在问题(主要为部分头文件位置不同),另外,据组委会描述还存在ue4运行库缺失问题(我在安装stage2_rgb时未遇到),具体参考以下编译安装流程(修改自官方编译指南)。

编译安装流程

下载模拟器(按需下载)

赛项一+RGBD:
git clone https://github.com/RoboMaster/IntelligentUAVChampionshipSimulator.git -b stage1_RGBD


赛项二+RGBD:
git clone https://github.com/RoboMaster/IntelligentUAVChampionshipSimulator.git -b stage2_RGBD


赛项一+双目:
git clone https://github.com/RoboMaster/IntelligentUAVChampionshipSimulator.git -b stage1_stereo


赛项二+双目:
git clone https://github.com/RoboMaster/IntelligentUAVChampionshipSimulator.git -b stage2_stereo


赛项三:
git clone https://github.com/RoboMaster/IntelligentUAVChampionshipSimulator.git -b stage3

下载资源文件到特定位置

cd IntelligentUAVChampionshipSimulator


wget -P ./stage2_RGBD/complex/Content/Paks/ https://stg-robomasters-hz-q0o2.oss-cn-hangzhou.aliyuncs.com/simulator/stage2/complex-LinuxNoEditor.pak


wget -P ./stage2_RGBD/complex/Binaries/Linux/ https://stg-robomasters-hz-q0o2.oss-cn-hangzhou.aliyuncs.com/simulator/stage2/complex

安装 ROS melodic

注:官方给出的 noetic 为Ubuntu20版本的ros,使用Ubuntu18需要将下文所有出现的noetic替换为melodic

ROS melodic安装参考博客

安装 catkin 管理工具

sudo apt install python3-catkin-tools

进入模拟器文件stageX_XXX的根目录

cd /path/to/stageX_XXX

构建roswrapper

sudo cp -rf /usr/include/eigen3/Eigen /usr/include/Eigen -R (需要先安装Eigen3库,sudo apt install libeigen3-dev)


sudo apt install ros-melodic-mavros ros-melodic-mavros-extras


sudo apt install ros-melodic-tf2-sensor-msgs


source /opt/ros/melodic/setup.bash (使用的shell如果不是bash,按照个人情况修改,如是zsh需要再运行source /opt/ros/melodic/setup.zsh


cd $PWD/roswrapper/ros$PWD原来是指当前目录,这里应该指stageX_XXX的根目录)


catkin build对于Ubuntu18用户而言多数会出现make failed情况,参考下文常见错误解决

使用脚本启动模拟器

cd /path/to/stageX_XXX


./simulator.sh

当看到如下画面时说明模拟器启动成功

Q&A

启动模拟器和roswrapper后,roswrapper显示无法连接自己的服务器,需要安装docker服务来新建相关子网。

安装docker:

  • sudo apt-get install ca-certificates gnupg lsb-release
  • sudo mkdir -p /etc/apt/keyrings
  • curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
  • echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
  • sudo apt-get update
  • sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin

编译常见问题

fatal error: filesystem: No such file or directory
--> #include <filesystem>

原因分析参考stackoverflow,官方给的代码应该是Ubuntu20环境,gcc版本号较高,filesystem在低版本时是作为实验性功能在experimental下的,故将#include <filesystem>改为 #include <experimental/filesystem>,同时修改using namespace std::filesystemusing namespace std::experimental::filesystem

具体需要修改的文件为stageX_XXX/roswrapper/MavLinkCom/MavLinkTest下的Commands.cppmain.cpp

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值