• 欢迎访问开心洋葱网站,在线教程,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站,欢迎加入开心洋葱 QQ群
  • 为方便开心洋葱网用户,开心洋葱官网已经开启复制功能!
  • 欢迎访问开心洋葱网站,手机也能访问哦~欢迎加入开心洋葱多维思维学习平台 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏开心洋葱吧~~~~~~~~~~~~~!
  • 由于近期流量激增,小站的ECS没能经的起亲们的访问,本站依然没有盈利,如果各位看如果觉着文字不错,还请看官给小站打个赏~~~~~~~~~~~~~!

无人机自动驾驶GAAS学习一

人工智能 永望 2243次浏览 0个评论

 

基本依赖项

 

pip install \
	pandas \
	jinja2 \
	pyserial \
	cerberus \
	pyulog \
	numpy \
	toml \
	pyquaternion

  Q1:程序“pip”尚未安装。 您可以使用以下命令安装: sudo apt install python-pip   Q2: Traceback (most recent call last): File “/usr/bin/pip”, line 9, in from pip import main ImportError: cannot import name main   解决: sudo gedit /usr/bin/pip   将  

from pip import main  
        if __name__ == '__main__':  
            sys.exit(main()) 

  修改为:  

  from pip import __main__  
if __name__ == '__main__':  
    sys.exit(__main__._main())

 

安装依赖的包

 

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 

 

安装ros系统:安装 ROS Kinetic

 

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
sudo apt-get update

  Q1:W: GPG 错误:http://packages.ros.org/ros/ubuntu xenial InRelease: 由于没有公钥,无法验证下列签名: NO_PUBKEY F42ED6FBAB17C654 W: 仓库 “http://packages.ros.org/ros/ubuntu xenial InRelease” 没有数字签名。 N: 无法认证来自该源的数据,所以使用它会带来潜在风险。 N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。   解决: sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys F42ED6FBAB17C654 Executing: /tmp/tmp.0ahh2pNlMq/gpg.1.sh –keyserver keyserver.ubuntu.com –recv-keys F42ED6FBAB17C654  

sudo apt-get install ros-kinetic-desktop-full

  Q1: W: Possible missing firmware /lib/firmware/i915/kbl_guc_ver9_14.bin for module i915 W: Possible missing firmware /lib/firmware/i915/bxt_guc_ver8_7.bin for module i915   解决: 首先去到这个网址,你会看到很多固件的选择项,你选择自己缺的那个点击进去。   https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/tree/i915   进去以后呢,点击plain就会下载了。 把缺的几个固件都下载好以后,把它们复制到/lib/firmware/i915下。  

sudo rosdep init
rosdep update
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
sudo apt install python-rosinstall python-catkin-tools python-rosinstall-generator python-wstool build-essential

 

install ros-gazebo plugins

 

sudo apt install ros-kinetic-gazebo-*

  完成上列步骤后,你可以通过下面的命令来测试是否成功安装  

roscore

  source:使当前shell读入路径为filepath的shell文件并依次执行文件中的所有语句,通常用于重新执行刚修改的初始化文件,使之立即生效,而不必注销并重新登录   接下来,需要生成catkin工作空间,你所有的基于ROS的库都可以存放在此。  

mkdir -p ~/catkin_ws/src

 

安装MAVROS

 

sudo apt-get install ros-kinetic-mavros ros-kinetic-mavros-extras

 

安装geographic lib :

 

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

 

PX4 Firmware配置

 

cd ~/catkin_ws/src
git clone https://github.com/PX4/Firmware.git
cd Firmware
git checkout v1.8.0
make posix_sitl_default gazebo

  仿真运行:  

roslaunch px4 mavros_posix_sitl.launch

  检查连接  

rostopic echo /mavros/state

 

git配置

 

sudo apt-get update
sudo apt install git
git config --global user.name "(这里填写你github上注册的名字)" git config --global user.email “(这里填写你注册邮箱的名字)” 
git config --list 回车就会显示你的注册名字和注册邮箱
ssh-keygen -t rsa -C ”(注册邮箱名)”

  之后连续按三次回车就行了。  

cat ~/.ssh/id_rsa.pub

  把显示出来的代码全都复制下来 从终端的复制的代码,粘贴在key表单中  

下载GAAS 包

 

git clone git@github.com:generalized-intelligence/GAAS.git

 

模型文件所在地址更新到环境变量中:

 

 echo "export GAZEBO_MODEL_PATH=${GAZEBO_MODEL_PATH}:/home/yyl/catkin_ws/GAAS/simulator/models" >> ~/.bashrc

 

将模型以及配置文件拷贝到对应文件夹中:

 

cp -r /home/yyl/catkin_ws/GAAS/simulator/models* ~/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/
cp -r /home/yyl/catkin_ws/GAAS/simulator/worlds/* ~/catkin_ws/src/Firmware/Tools/sitl_gazebo/worlds/
cp -r /home/yyl/catkin_ws/GAAS/simulator/posix-config/* ~/catkin_ws/src/Firmware/posix-configs/SITL/init/ekf2/

  打开无人机仿真模型:  

roslaunch px4 mavros_posix_sitl.launch 

  检查MAVROS连接情况:  

rostopic echo /mavros/state

  初始化无人机并启动:  

cd /home/yyl/catkin_ws/GAAS/demo/tutorial_1/1_px4_mavros_offboard_controller
python px4_mavros_run.py

 

无人机自动驾驶软件系列 E02 : 通过无人机机载摄像头构建建筑物 3D 模型

  更新文件“  

cd /home/yyl/catkin_ws/GAAS
git pull origin master

  将 Gazebo 仿真用到的文件拷贝到 PX4 文件所在目录中:  

cp -r /home/yyl/catkin_ws/GAAS/simulator/launch/* ~/catkin_ws/src/Firmware/launch/
cp -r /home/yyl/catkin_ws/GAAS/simulator/models/* ~/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/
cp -r /home/yyl/catkin_ws/GAAS/simulator/worlds/* ~/catkin_ws/src/Firmware/Tools/sitl_gazebo/worlds/
cp -r /home/yyl/catkin_ws/GAAS/simulator/posix-config/* ~/catkin_ws/src/Firmware/posix-configs/SITL/init/ekf2/

  启动仿真  

roslaunch px4 sfm.launch

  检查 MAVROS 的连接情况:  

# 确保 "connected" 为 "True"
rostopic echo /mavros/state

  通过 Rviz 来查看发布出来的摄像头图片:  

rviz

  选择 “Add”->“by topic”->”/gi/simulation/left/image_raw“, 之后你可以看到当前的左目摄像头信息 订阅并存储左目摄像头的信息:  

rosbag record /gi/simulation/left/image_raw -O sfm.bag

  起飞无人机:  

python  /home/yyl/catkin_ws/GAAS/demo/tutoal_2/2_Struction_from_Motion/px4_mavros_run.py

  控制无人机圆型飞行:  

python /home/yyl/catkin_ws/GAAS/demo/tutorial_2/2_Struction_from_Motion/fly_circle.py

  处理 Rosbag:  

python bag2image.py --bag /home/yyl/sfm.bag  --output_path /home/yyl/piture    --image_topic /gi/simulation/left/image_raw

 

无人机自动驾驶软件系列 E03: 在无GPS环境下通过SLAM实现位置估

  更新GAAS : cd /home/yyl/catkin_ws/GAAS git pull origin master   将ROS的launch文件拷贝到PX4相应文件夹内:  

cp -r /home/yyl/catkin_ws/GAAS/simulator/launch/*  ~/catkin_ws/src/Firmware/launch

  将“(PX4_FIRMWARE_PATH)/Firmware/Tools/sitl_gazebo/models” 中的对应模型删除,并重新拷贝:  

cp -r /home/yyl/catkin_ws/GAAS/simulator/models/* ~/catkin_ws/src/Firmware/Tools/sitl_gazebo/models/

  If you are using ubuntu, just type “./install_dep.sh” to install all the dependencies except pangolin.  

sudo chmod +x ./install_dep.sh
./install_dep.sh

 

安装Pangolin:

  (参考https://www.cnblogs.com/newneul/p/8270137.html)   1、下载安装包:  

git clone https://github.com/stevenlovegrove/Pangolin.git

  2、安装依赖和编译软件  

sudo apt-get install libglew-dev
sudo apt-get install cmake
sudo apt-get install libpython2.7-dev

  3、编译安装   cd [path-to-pangolin(Pangolin路径)]//打开解压后的Pangolin文件夹 我的:  

cd /home/yyl/catkin_ws/GAAS/software/SLAM/ygz_slam_ros/Pangolin
mkdir build
cd build
cmake ..
make
sudo make install 

 

安装Dbow3:

 

 git clone https://github.com/rmsalinas/DBow3.git
cd DBow3
cmake ..
 make 
 sudo make install

 

安装PCL:

  (参考:https://blog.csdn.net/zkj126521/article/details/80157351)   1、下载源码:  

git clone https://github.com/PointCloudLibrary/pcl

  2、安装依赖包:  

sudo apt-get update 
sudo apt-get install git build-essential linux-libc-dev 
sudo apt-get install cmake cmake-gui 
sudo apt-get install libusb-1.0-0-dev libusb-dev libudev-dev
sudo apt-get install mpi-default-dev openmpi-bin openmpi-common
sudo apt-get install libflann1.8 libflann-dev 
sudo apt-get install libeigen3-dev 
sudo apt-get install libboost-all-dev 
sudo apt-get install libvtk5.10-qt4 libvtk5.10 libvtk5-dev 
sudo apt-get install libqhull* libgtest-dev 
sudo apt-get install freeglut3-dev pkg-config 
sudo apt-get install libxmu-dev libxi-dev 
sudo apt-get install mono-complete 
sudo apt-get install qt-sdk openjdk-8-jdk openjdk-8-jre 

  3、编译源码:  

cd pcl
cmake  -D CMAKE_BUILD_TYPE=None  -D BUILD_GPU=ON  -D BUILD_apps=ON  -D BUILD_examples=ON .  
make
sudo make instal

 

安装OpenNI、OpenNI2

 

sudo apt-get install libopenni-dev   
sudo apt-get install libopenni2-dev  

 

安装g2o:

  (参考https://blog.csdn.net/slzlincent/article/details/86555166)  

git clone https://github.com/RainerKuemmerle/g2o.git
sudo apt-get install libeigen3-dev
sudo apt-get install libsuitesparse-dev
sudo apt-get install qtdeclarative5-dev
sudo apt-get install qt5-qmake
sudo apt-get install libqglviewer-dev
cd g2o
mkdir build
cd build
cmake  ..
make
sudo make install

 

安装opencv4.1.1:

 

sudo apt-get install build-essential
sudo apt-get install cmake git g++
sudo apt-get install libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libv4l-dev liblapacke-dev
sudo apt-get install checkinstall yasm libxine2-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libfaac-dev libmp3lame-dev libtheora-dev
sudo apt-get install libopencore-amrnb-dev libopencore-amrwb-dev libavresample-dev x264 v4l-utils
sudo apt-get install libtbb2 libtbb-dev libjpeg-dev libpng-dev libtiff-dev libjasper-dev libdc1394-22-dev  
sudo apt-get install libxvidcore-dev libx264-dev ffmpeg
sudo apt-get install libatlas-base-dev gfortran   
sudo apt-get install libopencv-dev  libqt4-dev qt4-qmake libqglviewer-dev libsuitesparse-dev libcxsparse3.1.4 libcholmod3.0.6
sudo apt-get install python-dev python-numpy
sudo apt-get install libprotobuf-dev protobuf-compiler
sudo apt-get install libgoogle-glog-dev libgflags-dev
sudo apt-get install libgphoto2-dev libeigen3-dev libhdf5-dev doxygen
cd /home/yyl/catkin_ws/GAAS/software/SLAM/ygz_slam_ros/opencv-4.1.1
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D WITH_TBB=ON -D WITH_V4L=ON -D WITH_QT=ON -D WITH_OPENGL=ON -D OPENCV_EXTRA_MODULES_PATH=/home/yyl/catkin_ws/GAAS/software/SLAM/ygz_slam_ros/opencv-4.1.1/opencv_contrib-4.1.1/modules -D PYTHON_EXECUTABLE=/usr/bin/python -D BUILD_EXAMPLES=ON ..
make
sudo make install

 

编译openc出现的问题和解决:

  Q1:– Checking for module ‘tesseract’ – No package ‘tesseract’ found – Tesseract: NO   解决:有两种方法,我测试第一种通过 1、  

sudo apt-get install -y tesseract-ocr libtesseract-dev liblepto nica-dev
sudo pip3 install tesserocr pillow

  2、安装Tesseract(来源https://blog.csdn.net/tintinetmilou/article/details/80212305)  

安装依赖包:
sudo apt-get install autoconf automake libtool autoconf-archive pkg-config libpng12-dev libjpeg8-dev libtiff5-dev zlib1g-dev -y 
sudo apt-get install libicu-dev libpango1.0-dev libcairo2-dev   

 

leptonica安装

  sudo apt install git (如果没有下载git 需要执行去下载安装git) git clone https://github.com/DanBloomberg/leptonica cd leptonica autoreconf -vi ./autobuild ./configure make -j8 sudo make install  

安装tesseract

 

git clone --depth 1 https://github.com/tesseract-ocr/tesseract.git  
cd tesseract  
./autogen.sh  
./configure --enable-debug  
LDFLAGS="-L/usr/local/lib" CFLAGS="-I/usr/local/include" make -j8 
sudo make install  
sudo ldconfig  

 

检测安装成与否

  tesseract -v Q2: Failed to find gflags – Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.   解决:安装gflags(来源https://blog.csdn.net/weixin_44354586/article/details/89399763) 下载源码:  

git clone https://github.com/gflags/gflags
cd gflags
mkdir build
cd build
cmake ..
make
sudo make install

  Q3:The imported target “vtkRenderingPythonTkWidgets” references the file “/usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so” but this file does not exist. Possible reasons include:

  • The file was deleted, renamed, or moved to another location.
  • An install or uninstall procedure did not complete successfully.
  • The installation package was faulty and contained “/usr/lib/cmake/vtk-6.2/VTKTargets.cmake” but not all the files it references. 解决:(来源https://www.cnblogs.com/sincere-diligence/p/9336045.html)sudo ln -s /usr/lib/python2.7/dist-packages/vtk/libvtkRenderingPythonTkWidgets.x86_64-linux-gnu.so /usr/lib/x86_64-linux-gnu/libvtkRenderingPythonTkWidgets.so

  Q4:没有安装flake8 解决: 有两种方式: 1、# 安装到特定版本  

sudo python<version> -m pip install flake8

  我的是 sudo python2.7 -m pip install flake8   2、安装到默认python  

python -m install flake8

  未完,接下是GAAS 学习二…  

阶段总结

  (1)配置环境务必保证每一步是正确的,否则越到后面错误就越,因为包包依赖,包包关联。 (2)缺少那个包有4种解决的方法: 1)sudo apt-get install (包名称) 2)sudo pip/pip3 install (包名字) 3)源码编译 4)百度 install (包名字) (3)编译软件要看对应软件的安装说明(readme) (4)对于出现找不到XX .XX版的问题,修改CmakeList文件,去掉版本的要求 (5)对于找不到XX的问题多半是依赖包没装全或者安装完没有sudo make install (6)源码编译的步骤: 1)cd 文件夹 2)mkdir build 3)cd build 4)cmake … 5)make 6)sudo make install (7)有时下载或编译的速度慢了,可以取消在重新来


开心洋葱 , 版权所有丨如未注明 , 均为原创丨未经授权请勿修改 , 转载请注明无人机自动驾驶GAAS学习一
喜欢 (0)

您必须 登录 才能发表评论!

加载中……