欢迎来到全网最详细的 XTDrone 仿真平台部署教程!本文将带你一步步在 Ubuntu 20.04 上完成 无人机仿真 环境的搭建,并总结常见的“坑”与解决办法,帮你节省大量时间。如果你是第一次接触 部署避坑 指南,这篇文章绝对值得收藏!
首先确保你的系统是 Ubuntu 20.04(其他版本可能不兼容)。打开终端,执行以下命令更新软件源: sudo apt update && sudo apt upgrade -y 这一步可以避免后续因依赖版本过低导致的编译失败。
XTDrone 基于ROS,这里我们安装ROS Noetic(Ubuntu 20.04对应版本)。按照官方步骤添加源并安装: sudo sh -c "echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list" sudo apt install curl curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add - sudo apt update sudo apt install ros-noetic-desktop-full 安装完成后,初始化rosdep: sudo rosdep init rosdep update ⚠️ 注意:如果rosdep update慢或失败,可以手动配置国内源或使用代理,否则后续依赖解析会报错。
Gazebo通常随ROS一起安装,但建议升级到最新版本以获得更好的仿真效果。执行: sudo apt install gazebo11 libgazebo11-dev 同时安装其他依赖: sudo apt install python3-wstool python3-catkin-tools protobuf-compiler libgoogle-glog-dev
创建工作空间并克隆 XTDrone 代码: mkdir -p ~/xtdrone_ws/src cd ~/xtdrone_ws/src git clone https://github.com/robin-shaun/XTDrone.git 使用catkin编译(注意必须用catkin_tools): cd ~/xtdrone_ws catkin init catkin config --cmake-args -DCMAKE_BUILD_TYPE=Release catkin build 如果编译过程中出现缺少依赖的错误,根据提示用 sudo apt install ros-noetic- 补全。
编译成功后,添加环境变量: echo "source ~/xtdrone_ws/devel/setup.bash" >> ~/.bashrc source ~/.bashrc 启动仿真: roslaunch xtdrone_sitl gazebo_launch.launch 如果看到Gazebo界面出现无人机模型,说明 XTDrone 部署成功!
rosdep install --from-paths src --ignore-src -r -y 自动安装。🎉 至此,你已经完成了 XTDrone 仿真平台的搭建!后续可以学习控制脚本、编队飞行等高级功能。如果你在部署过程中遇到其他问题,欢迎在评论区留言交流!
本文由主机测评网于2026-03-09发表在主机测评网_免费VPS_免费云服务器_免费独立服务器,如有疑问,请联系我们。
本文链接:http://www.vpshk.cn/20260329909.html