PX4编译时容易出现的两个问题

一、在配置px4/Firmware时,编译make时报错:

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" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "mav_msgs" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "nav_msgs" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_lidar_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_opticalflow_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_mavlink_interface" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_uuv_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_vision_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_multirotor_base_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_imu_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_gimbal_controller_plugin" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "physics_msgs" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo
    linked by target "gazebo_motor_model" in directory /home/sch/catkin_ws/src/Firmware/Tools/sitl_gazebo

-- Configuring incomplete, errors occurred!

解决办法
安装 $ sudo apt-get install libgstreamer-plugins-base1.0-dev

二、make px4_sitl gazebo出现错误

具体问题如下:(详见附件图片)
lihzh21@ubuntu:~/Firmware$ make px4_sitl gazebo
[1/4] Performing build step for 'sitl_gazebo'
[20/52] Building CXX object CMakeFiles/gazebo_usv_dynamics_plugin.dir/src/gazebo_usv_dynamics_plugin.cpp.o
FAILED: /usr/bin/c++   -DLIBBULLET_VERSION=2.83 -DLIBBULLET_VERSION_GT_282 -Dgazebo_usv_dynamics_plugin_EXPORTS -I/usr/include/opencv -isystem /usr/include/gazebo-9 -isystem /usr/include/bullet -isystem /usr/include/simbody -isystem /usr/include/sdformat-6.2 -isystem /usr/include/ignition/math4 -isystem /usr/include/OGRE -isystem /usr/include/OGRE/Terrain -isystem /usr/include/OGRE/Paging -isystem /usr/include/ignition/transport4 -isystem /usr/include/ignition/msgs1 -isystem /usr/include/ignition/common1 -isystem /usr/include/ignition/fuel_tools1 -isystem /usr/include/x86_64-linux-gnu/qt5 -isystem /usr/include/x86_64-linux-gnu/qt5/QtCore -isystem /usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g++-64 -I/home/lihzh21/Firmware/Tools/sitl_gazebo/include -I. -I/usr/include/eigen3 -I/usr/include/eigen3/eigen3 -I/usr/include/gazebo-9/gazebo/msgs -I/home/lihzh21/Firmware/mavlink/include -I/home/lihzh21/Firmware/Tools/sitl_gazebo/external/OpticalFlow/include -I/usr/include/gstreamer-1.0 -I/usr/lib/x86_64-linux-gnu/gstreamer-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -isystem /usr/include/uuid -isystem /usr/include/x86_64-linux-gnu -Wno-deprecated-declarations -Wno-address-of-packed-member -fPIC   -I/usr/include/uuid -I/usr/include/x86_64-linux-gnu -std=gnu++14 -MMD -MT CMakeFiles/gazebo_usv_dynamics_plugin.dir/src/gazebo_usv_dynamics_plugin.cpp.o -MF CMakeFiles/gazebo_usv_dynamics_plugin.dir/src/gazebo_usv_dynamics_plugin.cpp.o.d -o CMakeFiles/gazebo_usv_dynamics_plugin.dir/src/gazebo_usv_dynamics_plugin.cpp.o -c /home/lihzh21/Firmware/Tools/sitl_gazebo/src/gazebo_usv_dynamics_plugin.cpp
/home/lihzh21/Firmware/Tools/sitl_gazebo/src/gazebo_usv_dynamics_plugin.cpp: In member function ‘virtual void gazebo::UsvDynamicsPlugin::Update()’:
/home/lihzh21/Firmware/Tools/sitl_gazebo/src/gazebo_usv_dynamics_plugin.cpp:251:29: error: missing template arguments before ‘xformV’
     ignition::math::Matrix4 xformV(vq);
                             ^
/home/lihzh21/Firmware/Tools/sitl_gazebo/src/gazebo_usv_dynamics_plugin.cpp:285:15: error: ‘xformV’ was not declared in this scope
       bpntW = xformV * bpnt;
               ^
At global scope:
cc1plus: warning: unrecognized command line option ‘-Wno-address-of-packed-member’
[20/52] Building CXX object CMakeFiles/gazebo_irlock_plugin.dir/src/gazebo_irlock_plugin.cpp.o
ninja: build stopped: subcommand failed.
FAILED: cd /home/lihzh21/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.
Makefile:205: recipe for target 'px4_sitl' failed
make: *** [px4_sitl] Error 1

解决方法:

错误信息提示Firmware/Tools/sitl_gazebo/src/gazebo_usv_dynamics_plugin.cpp这个文件中

 ignition::math::Matrix4 xformV(vq);

这个语句中,xformV之前没有定义类型
修改为

ignition::math::Matrix4 xformV(vq);

保存,重新make就可以正常使用了

你可能感兴趣的:(无人机)