1.问题
在执行PX4程序时,GAZEBO界面中没有生成无人机,终端出现下列报错(这部分报错是常规的字体颜色,所以很容易忽略):
raise OsNotDetected("Could not detect OS, tried %s" % attempted)
rospkg.os_detect.OsNotDetected: Could not detect OS, tried ['zorin', 'windows', 'nixos', 'clearlinux', 'ubuntu', 'slackware', 'rocky', 'rhel', 'qnx', 'pop', 'osx', 'sailfishos', 'tizen', 'oracle', 'opensuse', 'opensuse', 'opensuse', 'opensuse', 'opensuse', 'openembedded', 'neon', 'mx', 'mint', 'linaro', 'gentoo', 'funtoo', 'freebsd', 'fedora', 'elementary', 'elementary', 'debian', 'cygwin', 'euleros', 'centos', 'manjaro', 'buildroot', 'arch', 'amazon', 'alpine', 'almalinux']
还会有一串红色的报错:
[vehicle_spawn_melodic_19724_6703108910889243421-5] process has died [pid 19785, exit code 1, cmd /opt/ros/melodic/lib/gazebo_ros/spawn_model -sdf -file /home/oyy/Prometheus/Simulator/gazebo_simulator/amov_models/p450/p450.sdf -model p450 -x 0.0 -y 0.0 -z 0.2 -R 0.0 -P 0.0 -Y 0.0 __name:=vehicle_spawn_melodic_19724_6703108910889243421 __log:=/home/oyy/.ros/log/ef2c26a8-2d79-11ef-abd6-10f60a777545/vehicle_spawn_melodic_19724_6703108910889243421-5.log].
log file: /home/oyy/.ros/log/ef2c26a8-2d79-11ef-abd6-10f60a777545/vehicle_spawn_melodic_19724_6703108910889243421-5*.log
2.解决办法
关闭程序,在终端中执行下列指令:
sudo gedit /etc/lsb-release
查看文档信息是否如下所示:
DISTRIB_ID=Kylin
DISTRIB_RELEASE=V10
DISTRIB_CODENAME=kylin
DISTRIB_DESCRIPTION="Kylin V10 SP1"
DISTRIB_KYLIN_RELEASE=V10
DISTRIB_VERSION_TYPE=enterprise
DISTRIB_VERSION_MODE=normal
这是由于最近安装的一些.deb是来自于kylin的,比如微信。导致改变了里面原来的信息,现在重新修改回去如下(我的系统为Ubuntu18.04):
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=18.04
DISTRIB_CODENAME=bionic
DISTRIB_DESCRIPTION="Ubuntu 18.04.6 LTS"
执行完毕后重启电脑即可