.make px4_sitl_default gazebo这个过程可能比较考验电脑内存,我电脑有几次CPU都是100%运行,而且停下卡住
情况可能如下:
[11/33] Building CXX object CMakeFiles...plugin.dir/src/gazebo_uuv_plugin.cpp.o
FAILED: /usr/bin/c++ -DQT_CORE_LIB -DQT_GUI_LIB -DQT_NO_DEBUG -Dgazebo_uuv_plugin_EXPORTS -isystem /usr/include/qt4 -isystem /usr/include/qt4/QtGui -isystem /usr/include/qt4/QtCore -isystem /usr/include/gazebo-7 -isystem /usr/include/sdformat-4.4 -isystem /usr/include/ignition/math2 -isystem /usr/include/OGRE -I/home/weiweu/PX4_Firmware/Tools/sitl_gazebo/include -I. -I/usr/include/eigen3 -I/usr/include/eigen3/eigen3 -I/usr/include/gazebo-7/gazebo/msgs -I/home/weiweu/PX4_Firmware/mavlink/include -I/usr/include/OGRE/Paging -isystem /opt/ros/kinetic/include/opencv-3.3.1-dev -isystem /opt/ros/kinetic/include/opencv-3.3.1-dev/opencv -I/home/weiweu/PX4_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 -Wno-deprecated-declarations -Wno-address-of-packed-member -fPIC -std=gnu++14 -MMD -MT CMakeFiles/gazebo_uuv_plugin.dir/src/gazebo_uuv_plugin.cpp.o -MF CMakeFiles/gazebo_uuv_plugin.dir/src/gazebo_uuv_plugin.cpp.o.d -o CMakeFiles/gazebo_uuv_plugin.dir/src/gazebo_uuv_plugin.cpp.o -c /home/weiweu/PX4_Firmware/Tools/sitl_gazebo/src/gazebo_uuv_plugin.cpp
c++: internal compiler error: 已杀死 (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
[11/33] Building CXX object CMakeFiles...dir/src/gazebo_mavlink_interface.cpp.o
ninja: build stopped: subcommand failed.
[2/5] Generating ../../logs
FAILED: cd /home/weiweu/PX4_Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.
Makefile:198: recipe for target 'px4_sitl_default' failed
make: *** [px4_sitl_default] Error 1
可以尝试先增加临时swap空间,再执行make px4_sitl_default gazebo指令
#注释:of=/home/swap,放置swap的空间; count的大小就是增加的swap空间的大小,64M就是块大小,这里是64MB,所以总共空间就是bs*count=1024MB.这里分配空间的时候需要一点时间,等待执行完毕。
sudo dd if=/dev/zero of=/home/swap bs=64M count=16
#注释:把刚才空间格式化成swap各式
sudo mkswap /home/swap (可能会提示warning: don't erase bootbits sectorson whole disk. Use -f to force,不用理会)
#注释:使刚才创建的swap空间
sudo swapon /home/swap
Exception in thread “main” java.lang.reflect.InvocationTargetException…
解决方法: 参考链接:PX4开发环境搭建2:首次执行jmavsim仿真不成功->Exception in thread “main” java.lang.reflect.InvocationTargetException
编辑accessibility.properties文件:
sudo gedit /etc/java-8-openjdk/accessibility.properties
注释掉下面这一行:(没错,前面加个#号就行)
#assistive_technologies=org.GNOME.Acessibility.AtkWrapper
出现[gazebo-3]process has died && [gazebo_gui-4]process has died错误,尝试执行以下指令。
sudo apt upgrade libignition-math2
卸载ubuntu18自带ptotobuf安装protobuf3.6
1.卸载
sudo apt-get remove libprotobuf-dev
which protoc
然后删除路径即可
2.安装
sudo apt-get install autoconf automake libtool curl make g++ unzip
git clone -b v3.6.1 https://github.com/protocolbuffers/protobuf.git
cd protobuf
git submodule update --init --recursive
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig
protoc --version 输出版本号成功
warning: no files found matching ‘.h’
warning: no files found matching '.sh’
warning: no previously-included files found matching ‘.appveyor.yml’
warning: no previously-included files found matching ‘.coveragerc’
The headers or library files could not be found for jpeg,a required dependency when compiling Pillow from source.
sudo apt-get install libjpeg-dev zlib1g-dev
执行make px4_sitl_default gazebo遇到的问题
问题1:No package ‘gstreamer-base-1.0’ found解决如下:
sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
1
问题2:No module named 'jinja2’解决如下:
pip3 install jinja2 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com
1
执行 roslaunch px4 mavros_posix_sitl.launch遇到的问题
RLException: [mavros_posix_sitl.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
原因:缺少环境变量,在~/.bashrc文件增加以下代码,前两个source顺序能写反
source ~/catkin_ws/devel/setup.bash
source ~/PX4_Firmware/Tools/setup_gazebo.bash ~/PX4_Firmware/ ~/PX4_Firmware/build/px4_sitl_default
export ROS_PACKAGE_PATH=
R
O
S
P
A
C
K
A
G
E
P
A
T
H
:
/
P
X
4
F
i
r
m
w
a
r
e
e
x
p
o
r
t
R
O
S
P
A
C
K
A
G
E
P
A
T
H
=
ROS_PACKAGE_PATH:~/PX4_Firmware export ROS_PACKAGE_PATH=
ROSPACKAGEPATH: /PX4FirmwareexportROSPACKAGEPATH=ROS_PACKAGE_PATH:~/PX4_Firmware/Tools/sitl_gazebo
1
2
3
4
执行rostopic echo /mavros/state若出现connected: True,则说明MAVROS与SITL通信成功。
1
执行roslaunch px4 indoor1.launch 遇到的问题
[ 问题1 ] RLException: while processing /home/karasi/PX4_Firmware/launch/single_vehicle_spawn_xtd.launch:Invalid tag: Cannot load command parameter [model_description]: no such command [[‘xmlstarlet’, ‘ed’, ‘-d’, ‘//plugin[@name=“mavlink_interface”]/mavlink_tcp_port’, ‘-s’, ‘//plugin[@name=“mavlink_interface”]’, ‘-t’, ‘elem’, ‘-n’, ‘mavlink_tcp_port’, ‘-v’, ‘4560’, ‘/home/karasi/PX4_Firmware/Tools/sitl_gazebo/models/iris_stereo_camera/iris_stereo_camera.sdf’]]. Param xml is The traceback for the exception was written to the log file
原因:依赖没装全,解决如下
sudo apt install xmlstarlet
1
[ 问题2 ] Traceback (most recent call last): File “multirotor_communication.py”, line 8, in
from pyquaternion import Quaternion ImportError: No module named pyquaternion
原因:python程序在执行的时候缺少py库造成的,若python3安装完,依旧存在缺少问题,说明这里要给python2装。
当电脑同时安装了 python 2.x 和 python3.x时,给Python2.x环境安装包要用pip命令,给python3.x环境安装包要用pip3命令。安装命令如下:
sudo pip3 install pyquaternion
sudo pip install pyquaternion
1
2
[ 问题3 ] [gazebo-2] process has died [pid 24460, exit code 255, cmd /opt/ros/melodic/lib/gazebo_ros/gzserver -e ode
/home/karasi/PX4_Firmware/Tools/sitl_gazebo/worlds/indoor1.world __name:=gazebo __log:=/home/karasi/.ros/log/7812be94-7370-11ec-9bb2-98541b170070/gazebo-2.log]. log file: /home/karasi/.ros/log/7812be94-7370-11ec-9bb2-98541b170070/gazebo-2*.log
原因: 怀疑是gazebo进程的问题,可以试一下消灭gazebo所有进程,再重新roslaunch
killall -9 gzclient
killall -9 gzserver