本笔记基于ubuntu18.04版本,配置基于Prometheus无人机开源项目仿真环境。
需要事先在电脑上安装了ROS,Mavros功能包,其余可参考Amov教程, https://github.com/amov-lab/Prometheus/wiki/%E5%AE%89%E8%A3%85%E5%8F%8A%E7%BC%96%E8%AF%91https://github.com/amov-lab/Prometheus/wiki/%E5%AE%89%E8%A3%85%E5%8F%8A%E7%BC%96%E8%AF%91
在进行PX4固件代码下载时,使用的是阿木实验室的Prometheus项目专用的PX4仓库,
安装方法
git clone https://gitee.com/amovlab/prometheus_px4.git
cd prometheus_px4
git submodule update --init --recursive
pip3 install --user toml empy jinja2 packaging
make amovlab_sitl_default gazebo
在进行最后一步时
make amovlab_sitl_default gazebo
始终报错,在进行如下操作
cd prometheus_px4/Tools/setup
source ./ubuntu.sh
然后
make px4_sitl gazebo
在进行
make amovlab_sitl_default gazebo
此时还没成功
打开新终端
sudo gedit ~/.bashrc
在记事本里添加路径
source ~/Prometheus/devel/setup.bash
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:~/Prometheus/devel/lib
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/Prometheus/Simulator/gazebo_simulator/models
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/Prometheus/Simulator/gazebo_simulator/amov_models
source ~/prometheus_px4/Tools/setup_gazebo.bash ~/prometheus_px4 ~/prometheus_px4/build/amovlab_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/prometheus_px4
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/prometheus_px4/Tools/sitl_gazebo
成功后每次开启新终端会出现
GAZEBO_PLUGIN_PATH :/home/hang/Prometheus/devel/lib:/home/hang/prometheus_px4/build/amovlab_sitl_default/build_gazebo
GAZEBO_MODEL_PATH :/home/hang/Prometheus/Simulator/gazebo_simulator/models:/home/hang/Prometheus/Simulator/gazebo_simulator/amov_models:/home/hang/prometheus_px4/Tools/sitl_gazebo/models
LD_LIBRARY_PATH /home/hang/Prometheus/devel/lib:/home/hang/catkin_ws/devel/lib:/opt/ros/melodic/lib:/home/hang/prometheus_px4/build/amovlab_sitl_default/build_gazebo
hang@hang-Lenovo-XiaoXin-15IIL-2020:~$
不用管,然后在运行
cd Prometheus
./compile_gazebo.sh
编译prometheus_gazebo功能包,如果没报错,在开启新终端运行
roslaunch prometheus_gazebo sitl.launch
测试是否Gazebo仿真是否正确配置
若第一个终端无报错,第二个终端显示[Connected]
并能够查看到飞机状态,且Gazebo成功运行,代表成功运行。
此时运行如下指令启动终端控制节点,并根据终端提示输入指令
rosrun prometheus_control terminal_control
无人机不能接收控制命令,无响应
发现终端报错
[FATAL] [1595519040.562797928]: UAS: GeographicLib
exception: File not readable /usr/share/GeographicL
ib/geoids/egm96-5.pgm | Run install_geographiclib_d
ataset.sh script in order to install Geoid Model dataset!
按着指示,应该需要运行install_geographiclib_dataset.sh这个文件。
我们在终端输入:
sudo /opt/ros/melodic/lib/mavros/install_geographiclib_datasets.sh
如果是用源文件安装的mavros,则去mavros那个文件夹搜索install_geographiclib_datasets.sh文件,然后用 sudo权限运行即可。如果还有问题可参考
Ubuntu18.04安装mavros - 代码先锋网https://www.codeleading.com/article/78695438507/在打开新终端,运行下面命令启动控制节点
roslaunch prometheus_gazebo sitl_pos_control.launch
一般情况下,首先输入999解锁并切换至offboard模式,然后输入1起飞,然后再根据提示输入其他指令(悬停、降落、机体系移动、惯性系移动、轨迹追踪等等),此时发现无人机可以按照指令移动,结束。
本文参考
Home · amov-lab/Prometheus Wiki · GitHubhttps://github.com/amov-lab/Prometheus/wikiROS实验笔记之——基于Prometheus自主无人机开源项目的学习与仿真_gwpscut的博客-CSDN博客最近在公众号上看到Prometheus无人机的资料,发现里面开源了很好的无人机的仿真环境,并且有很好的教程。而本人正好在上《Introduction to Aerial Robotics》的课程,正好搭建一下仿真环境来测试一下。写下本博文作为学习记录用。(PS:无任何商业或者宣传之用,仅仅为本人学习记录用,相关资料给出参考)目录Prometheus - 自主无人机开源项目项目配置控制模块运动规划模块目标检测SLAM参考资料Prometheus - 自主无人机开..https://blog.csdn.net/gwplovekimi/article/details/115395686#t6