Based on open_ Implementation of UAV indoor positioning scheme based on vins

1, Basic environmental information

1. Some equipment information:

Flight control: Pixhawk ® PX4
Camera: Intel ® RealSense ™ Tracking Camera T265 ,Intel ® RealSense ™ Depth Camera D435i
Airborne computer: Intel ® NUC

2. Airborne computer information:

Operating system: Ubuntu 18 04
Equipped with ROS melody

3.VIO algorithm information:

open_vins v2.2
OpenCV 3.4.6
OpenCV_contrib 3.4.6

2, Environment construction

1. Software environment

1.1 librealsense
1.1.1 configuration
sudo apt-key adv --keyserver keys.gnupg.net --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE
sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u
sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg
1.1.2 testing
realsense-viewer
1.2 OpenCV and OpenCV_contrib
git clone --branch 3.4.6 https://github.com/opencv/opencv/
git clone --branch 3.4.6 https://github.com/opencv/opencv_contrib/
mkdir opencv/build/
cd opencv/build/
cmake -DOPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules ..
make
sudo make install

Conflicts between multiple versions of OpenCV may occur after this is completed. It is recommended to refer to https://immortalqx.github.io/2021/07/06/opencv-notes-0/ However, if problems such as roscore startup error are found later, you can try to replace the problems mentioned in this article bashrc or Comment on the two lines added in zshrc.

The PKG config -- modversion OpenCV command can be used to view the currently active OpenCV version number.

1.3 open_vins
mkdir -p ~/workspace/ov/src/
cd ~/workspace/ov/src/
git clone --branch 2.2 https://github.com/rpng/open_vins/
cd ..
catkin build
1.4 mavros

(not necessary if there is no plan for joint positioning with flight control)

sudo apt-get install ros-melodic-mavros ros-melodic-mavros-extras
wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
./install_geographiclib_datasets.sh
sudo usermod -a -G dialout $USER

2. Hardware environment

2.1 camera calibration

Personally, I think the calibration of imu is important and may be ignored, so only the calibration of imu inside the camera is shown here.

2.1.1 imu_utils configuration
sudo apt-get install libdw-dev
mkdir -p ~/imu_calib/src/
cd ~/imu_calib/src/
git clone https://github.com/gaowenliang/code_utils
cd ..
catkin_make

An error may be reported at this time

fatal error: backward.hpp: there is no such file or directory
#include "backward.hpp"
^~~~~~~~~~~~~~
compilation terminated."

Solution: in code_ Find the sumpixel under utils_ test. CPP, modify #include "backward.hpp" to #include "code_utils/backward.hpp". Continue next.

catkin_make
cd src/
git clone https://github.com/gaowenliang/imu_utils
cd ..
catkin_make
2.1.2 imu_ calib. Writing of launch

Internal parameters can be changed as required.

<launch>
    <node pkg="imu_utils" type="imu_an" name="imu_an" output="screen">
        <param name="imu_topic" type="string" value= "/camera/imu"/>
        <param name="imu_name" type="string" value= "D435i"/>
        <param name="data_save_path" type="string" value= "$(find imu_utils)/data/"/>
        <param name="max_time_min" type="int" value= "10"/>
        <param name="max_cluster" type="int" value= "100"/>
    </node>
</launch>

Using imu_utils calibrates the imu.

roslaunch realsense2_camera rs_camera.launch \unite_imu_method:="linear_interpolation" \enable_gyro:=true \enable_accel:=true	#Launching the camera node
rosbag record -O imu_calibration /camera/imu	#Launching the rosbag recording node

After rosbag recording lasts for a period of time, ctrl+c ends, and then continue with the following steps.

roslaunch imu_utils imu_calib.launch	#Launching the calibration node
rosbag play -r 200 imu_calibration.bag	#Playing the bag recorded just now

Then at IMU_ Find the corresponding calibration file in the data folder in the utils installation path and proceed to the next step.

2.2 configuration of flight control, etc

PX4 UAV commissioning technical document

3, Run

The involved launch files need to be written and modified by the user according to the following bash statement comments and requirements

roscore
roslaunch realsense2_camera rs_camera.launch	#Launching the camera node
roslaunch ov_msckf param.launch	#Launching the open_vins node
roslaunch mavros px4.launch	#Launching the px4 node
roslaunch px4_setup px4_setup_default.launch	#Launching the coordinate transforming node 

Note 1: some of the above launch files are modified

rs_ camera. Open is required inside the launch_ Topics needed by vins, such as using Intel ® RealSense ™ For Tracking Camera T265, you need to turn on / camera/imu, / camera/fisheye1/image_raw,/camera/fisheye2/image_raw; If Intel is used ® RealSense ™ Depth Camera D435i, you need to turn on / camera/imu, / camera/infra1/image_rect_raw,/camera/infra1/image_rect_raw.
The template is automatically installed with librealsense.

param. The launch depends on which camera to use. It mainly modifies the parameter information of camera and imu, as well as open_ Topics subscribed by vins.
The template can be opened on_ Vins official website.

px4.launch
The template is automatically installed with mavros

Note 2: about coordinate conversion function package

This function pack is mainly used to unify the camera coordinate system and flight control coordinate system. It needs to be written by itself without template.

Note 3: startup of mavros

The above documents do not mention the modification of udev rules, so there may be problems in the startup of mavros, so there is no message in the topic of mavros. Please refer to other documents to solve this problem.

Note 4: about specific implementation

All the above processes do not involve the source instruction, so you may report an error about this problem directly. I hereby remind you.

Keywords: slam

Added by bPHP on Mon, 17 Jan 2022 06:40:23 +0200