搭建无人机仿真环境之PX4安装中出现的一些问题的解决

摘自:https://blog.csdn.net/wangdongjiab/article/details/107230585

搭建无人机仿真环境之PX4安装

Djarea 2020-07-09 16:02:23 583 收藏 6

分类专栏: Gazebo PX4 文章标签: linux

版权

搭建无人机仿真环境之PX4安装

安装依赖包

sudo apt install python3-pip
pip3 install --user pandas -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install --user jinja2 -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install --user empy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install --user packaging -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install --user toml -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install --user numpy -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
pip3 install --user pyquaternion -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8

如果遇到问题:

安装包出现Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError

解决办法如:

pip install pandas -i http://pypi.douban.com/simple --trusted-host pypi.douban.com

下载固件

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
make posix_sitl_default gazebo
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

如果遇到git clone 速度非常慢,可以将原本的网站中的http://github.com 进行替换为github.com.cnpmjs.org。例如 git clone https://github.com.cnpmjs.org/PX4/Firmware

git submodule update --init --recursive中遇到的问题

  • 问题1

如果使用镜像github.com.cnpmjs.org进行git clone ,在执行git submodule update --init --recursive时出现:

~/PX4_Firmware$ git submodule update --init --recursive
子模组 'Tools/jMAVSim'(https://github.com.cnpmjs.org/PX4/jMAVSim.git)未对路径 'Tools/jMAVSim' 注册
子模组 'Tools/sitl_gazebo'(https://github.com.cnpmjs.org/PX4/sitl_gazebo.git)未对路径 'Tools/sitl_gazebo' 注册
子模组 'boards/atlflight/cmake_hexagon'(https://github.com.cnpmjs.org/PX4/cmake_hexagon.git)未对路径 'boards/atlflight/cmake_hexagon' 注册
子模组 'mavlink/include/mavlink/v2.0'(https://github.com.cnpmjs.org/mavlink/c_library_v2.git)未对路径 'mavlink/include/mavlink/v2.0' 注册
子模组 'platforms/nuttx/NuttX/apps'(https://github.com.cnpmjs.org/PX4/NuttX-apps.git)未对路径 'platforms/nuttx/NuttX/apps' 注册
子模组 'platforms/nuttx/NuttX/nuttx'(https://github.com.cnpmjs.org/PX4/NuttX.git)未对路径 'platforms/nuttx/NuttX/nuttx' 注册
子模组 'platforms/qurt/dspal'(https://github.com.cnpmjs.org/ATLFlight/dspal.git)未对路径 'platforms/qurt/dspal' 注册
子模组 'src/drivers/gps/devices'(https://github.com.cnpmjs.org/PX4/GpsDrivers.git)未对路径 'src/drivers/gps/devices' 注册
子模组 'src/drivers/uavcan/libuavcan'(https://github.com.cnpmjs.org/PX4/uavcan.git)未对路径 'src/drivers/uavcan/libuavcan' 注册
子模组 'src/lib/ecl'(https://github.com.cnpmjs.org/PX4/ecl.git)未对路径 'src/lib/ecl' 注册
子模组 'src/lib/matrix'(https://github.com.cnpmjs.org/PX4/Matrix.git)未对路径 'src/lib/matrix' 注册
子模组 'src/modules/micrortps_bridge/micro-CDR'(https://github.com.cnpmjs.org/PX4/micro-CDR.git)未对路径 'src/modules/micrortps_bridge/micro-CDR' 注册

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14

解决方法:
检查 .gitmodule文件中的url格式
按照以下方法更换一下即可:

gedit .gitmodules
  • 1

将.gitmodules文件中所有github.com替换为github.com.cnpmjs.org,例如
[submodule “mavlink/include/mavlink/v2.0”]
path = mavlink/include/mavlink/v2.0
url = https://github.com.cnpmjs.org/mavlink/c_library_v2.git
branch = master

修改完后,再次执行:

git submodule sync
  • 1
  • 问题2
dj@dj-virtual-machine:~/PX4_Firmware$ git submodule update --init --recursive
fatal: Needed a single revision
无法在子模组路径 'Tools/jMAVSim' 中找到当前版本
  • 1
  • 2
  • 3

解决方法:
删除对应文件夹,如删除文件夹 jMAVSim

make posix_sitl_default gazebo中遇到的问题

  • 问题1
CMake Error at CMakeLists.txt:32 (find_package):
  By not providing "Findgazebo.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "gazebo", but
  CMake did not find one.

  Could not find a package configuration file provided by "gazebo" with any
  of the following names:

    gazeboConfig.cmake
    gazebo-config.cmake

  Add the installation prefix of "gazebo" to CMAKE_PREFIX_PATH or set
  "gazebo_DIR" to a directory containing one of the above files.  If "gazebo"
  provides a separate development package or SDK, be sure it has been
  installed.
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15

解决方法:

sudo apt-get install libgazebo9-dev
  • 1
  • 问题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 "gazebo_vision_plugin" in directory /home/dj/PX4_Firmware/Tools/sitl_gazebo
    linked by target "gazebo_uuv_plugin" in directory /home/dj/PX4_Firmware/Tools/sitl_gazebo
    
... ...
    
-- Configuring incomplete, errors occurred!
See also "/home/dj/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeOutput.log".
See also "/home/dj/PX4_Firmware/build/px4_sitl_default/build_gazebo/CMakeFiles/CMakeError.log".
[143/573] Building CXX object platform...CMakeFiles/px4_layer.dir/px4_sem.cpp.o
FAILED: external/Stamp/sitl_gazebo/sitl_gazebo-configure 
cd /home/dj/PX4_Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DSEND_VISION_ESTIMATION_DATA=ON -GNinja /home/dj/PX4_Firmware/Tools/sitl_gazebo && /usr/bin/cmake -E touch /home/dj/PX4_Firmware/build/px4_sitl_default/external/Stamp/sitl_gazebo/sitl_gazebo-configure
[151/573] Building CXX object platform...n/CMakeFiles/px4_layer.dir/tasks.cpp.o
ninja: build stopped: subcommand failed.
Makefile:198: recipe for target 'px4_sitl_default' failed
make: *** [px4_sitl_default] Error 1
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18

解决方法:

sudo apt-get install libgstreamer-plugins-base1.0-dev
  • 1
  • 问题3

运行Gazebo出现:[Err] [REST.cc:205] Error in REST request

解决方法:
打开编辑~/.ignition/fuel/config.yaml文件

sudo gedit ~/.ignition/fuel/config.yaml
  • 1

首先注释 url : https://api.ignitionfuel.org
然后添加 url: https://api.ignitionrobotics.org

servers:
  -
    name: osrf
    url: https://api.ignitionrobotics.org  
# url: https://api.ignitionfuel.org
  • 1
  • 2
  • 3
  • 4
  • 5

重新启动即可

运行roslaunch px4 mavros_posix_sitl.launch遇到的问题

  • 问题1
VMware: vmw_ioctl_command error 无效的参数.
Aborted (core dumped)
[gazebo_gui-4] process has died [pid 2104, exit code 134, cmd /opt/ros/melodic/lib/gazebo_ros/gzclient __name:=gazebo_gui __log:=/home/dj/.ros/log/92926e0c-c1e4-11ea-b959-000c2928d800/gazebo_gui-4.log].
log file: /home/dj/.ros/log/92926e0c-c1e4-11ea-b959-000c2928d800/gazebo_gui-4*.log
  • 1
  • 2
  • 3
  • 4

解决方法:

$ export SVGA_VGPU10=0
  • 1
  • 问题2
Resource not found: gazebo_ros
ROS path [0]=/opt/ros/melodic/share/ros
ROS path [1]=/opt/ros/melodic/share
ROS path [2]=/home/dj/PX4_Firmware
ROS path [3]=/home/dj/PX4_Firmware/Tools/sitl_gazebo
The traceback for the exception was written to the log file
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6

解决方法:

$ sudo apt-get install ros-melodic-gazebo-ros-pkgs ros-melodic-gazebo-ros-control
  • 1

-问题3

RLException: [indoor1.launch] is neither a launch file in package [px4] nor is [px4] a launch file name
The traceback for the exception was written to the log file
  • 1
  • 2

解决方法:

source ~/PX4_Firmware/Tools/setup_gazebo.bash ~/PX4_Firmware/ ~/PX4_Firmware/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/PX4_Firmware
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/PX4_Firmware/Tools/sitl_gazebo

猜你喜欢

转载自blog.csdn.net/sinat_16643223/article/details/113075944