ROS下基于YOLO的px4无人机目标检测+对应的各种问题解决办法(亲测有效,避免入坑)

本文详细介绍了在ROS环境下,使用YOLO算法进行PX4无人机目标检测的全过程,包括无人机仿真环境的搭建,依赖安装,以及可能遇到的问题及其解决方案。

一、搭建无人机仿真环境

1.安装依赖

sudo apt install -y \
ninja-build \
exiftool \
python-argparse \
python-empy \
python-toml \
python-numpy \
python-yaml \
python-dev \
python-pip \
ninja-build \
protobuf-compiler \
libeigen3-dev \
genromfs \
xmlstarlet
pip install \
pandas \
jinja2 \
pyserial \
cerberus \
pyulog \
numpy \
toml \
pyquaternion

2、ROS安装(已安装就忽略)

参考链接

3.Gazebo安装(已安装就忽略)

参考链接

4.MAVROS安装

这是一个飞机固件与ros通信的包:

sudo apt install ros-kinetic-mavros ros-kinetic-mavros-extras
wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
sudo chmod a+x ./install_geographiclib_datasets.sh
sudo ./install_geographiclib_datasets.sh ##此时执行速度很慢,耐心等待完成

5.PX4配置

下载固件

git clone https://github.com/PX4/Firmware
mv Firmware PX4_Firmware
cd PX4_Firmware
git checkout -b xtdrone/dev v1.11.0-beta1
git submodule update --init --recursive

一般来说,第一次安装飞控固件,编译时会报错,因为缺少了必要的python依赖,因此在下载玩Firmware后,在编译之前,首先:

cd PX4_Firmware
 bash
 bash ./Tools/setup/ubuntu.sh --no-nuttx --no-sim-tools ##此处跳过了仿真器的安装,因为已经在ros已经配置好了

这之后,再执行下面指令,一般就不会出错,如果继续报错,一般为个人电脑环境配置的问题,请根据终端中的错误提示自行安装依赖。

make posix_sitl_default gazebo

**

编译make posix_sitl_default gazebo可能会遇到的问题:(由于小编忘记了截图)于是便拿我参考的问题解决方法分享(错误大概一致都可以按照以下解决)

问题1:

[ros] ccache: failed to create /home/ 问题解决
解决办法:删除/home/xxx/.ccache文件
(xxx)是你虚拟机用户名的名称

sudo rm -rf /home/xxx/.ccache/ 
问题2:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
GSTREAMER_LIBRARIES (ADVANCED)

    linked by target "LiftDragPlugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_gst_camera_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_barometer_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_geotagged_images_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_magnetometer_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "sensor_msgs" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_irlock_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_video_stream_widget" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_controller_interface" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_wind_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "std_msgs" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_gps_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_sonar_plugin" 
评论 8
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值