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"

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

被折叠的 条评论
为什么被折叠?



