【Vehicle-machine collaboration slam】miniPC, Nano, T265, UWB linktrack PB

0. Foreword

0.1 Software and hardware

(1) windows virtual machine ubuntu20.04 + ROS noetic (for testing)
(2) nano ubuntu18.04 + ROS melodic (slave)
(3) mini PC ubuntu18.04 + ROS melodic (host)

0.2 Implementation steps

(1) Install system, change source, install ROS
(2) T265
(3) UWB (Linktrack PB)
(4) ROS master-slave configuration and interaction

1. Install the system, change the source, and install ROS

1.1 Install the system and change the source

  • Virtual machine installed ubuntu:
    https://blog.csdn.net/weixin_44029896/article/details/122877171?
  • Nanobody free:

2.1 Install ROS

  • ROS Noetic or Melodic:
    http://www.autolabor.com.cn/book/ROSTutorials/chapter1/12-roskai-fa-gong-ju-an-zhuang/124-an-zhuang-ros.html

2. T265

  • [See the end of this section when reporting an error]
  • Intel official website (for technical specifications):
    https://www.intelrealsense.com/zh-hans/tracking-camera-t265/
  • IntelRealSense Github official website (general website):
    https://github.com/IntelRealSense/librealsense

2.1 Install T265 SDK on ubuntu (tested 18, 20, Nano):

  • Official website tutorial (I use):
    https://github.com/IntelRealSense/librealsense/blob/master/doc/distribution_linux.md
  • Reference tutorial:
    https://blog.csdn.net/crp997576280/article/details/109544456?

(1) Register the public key of the server

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE || sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F6E65AC044F831AC80A06380C8B3A55A6F3EFCDE

(2) Add the server to the repository list

sudo add-apt-repository "deb https://librealsense.intel.com/Debian/apt-repo $(lsb_release -cs) main" -u

(3) Installation package-x86 architecture-miniPC Execute the following command

sudo apt-get install librealsense2-dkms
sudo apt-get install librealsense2-utils
sudo apt-get install librealsense2-dev
sudo apt-get install librealsense2-dbg

(3) Installation package-ARM architecture-Nano execute the following command

sudo apt-get install librealsense2-utils
sudo apt-get install librealsense2-dev

(4) test

realsense-viewer

2.2 Install T265 ROS package on ubuntu (tested 18, 20, nano):

  • Official website tutorial: (I use)
    https://github.com/IntelRealSense/realsense-ros
  • Reference tutorial:
    https://blog.csdn.net/crp997576280/article/details/109544456?
  • Note: (It is very necessary, I will write it later, and I will find that I forgot it again)
    There are two ways to download and obtain the T265 package, one is to download it directly from the ros companion, which is simple but not the latest. The other is to download the latest package, which is complicated but up-to-date. It is best to use the first method for Nano, because using the second method will report an error. The root cause is that the Nano ARM core cannot directly install the dkms package.

——————— Nano operates as follows: ————————
(0) Nano directly downloads the ROS companion package, and then skips to the fifth step to test.

sudo apt-get install ros-$ROS_DISTRO-realsense2-camera

——————— miniPC operates as follows:————————
(1) Create a new workspace

mkdir -p ~/T265/src
cd ~/T265/src/

(2) Download the source code

git clone https://github.com/IntelRealSense/realsense-ros.git
cd realsense-ros/
git checkout `git tag | sort -V | grep -P "^2.\d+\.\d+" | tail -1`
cd ..

(3) compile

catkin_init_workspace
cd ..
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install

(4) Add the workspace to the environment variable (restart the terminal after running)

echo "source ~/T265/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

(5) test

#输出图像
roslaunch realsense2_camera demo_t265.launch
#无图(个人理解)
roslaunch realsense2_camera rs_t265.launch

(6) ROS subscribes to odometer information

rostopic echo /camera/odom/sample
  • [Error resolution:]
  • ERROR1: ddynamic_reconfigure not found
cd ~/T265/src
git clone https://github.com/pal-robotics/ddynamic_reconfigure.git
  • ERROR2: git clone is stuck.
    Run this, then restart the terminal, and then git clone
sudo apt-get install gnutls-bin
git config --global http.sslVerify false
git config --global http.postBuffer 1048576000

3. UWB (linktrack pb module)

  • [See the end of this section when reporting an error]
  • Official website:
    https://www.nooploop.com/download/
  • Official ROS package (github):
    https://github.com/nooploop-dev/nlink_parser
  • Reference tutorial:
    https://blog.csdn.net/i_robots/article/details/107410771?

3.1 Download windows host computer, set uwb mode

  • Download the official host computer NAssistant from the official website , and set its parameters and modes according to the user manual .

3.2 Install the serial communication library

git clone https://github.com/nooploop-dev/serial.git
cd serial
make
make test
sudo make install

3.3 Download uwb ros package

mkdir -p ~/UWB/src
cd ~/UWB/src/
git clone --recursive https://github.com/nooploop-dev/nlink_parser.git 
cd ../
catkin_make
echo "source ~/UWB/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

3.4 Set the serial port number and permissions

  • (1) Plug and unplug, find the serial port number corresponding to UWB, and modify it in the linktrack.launch folder (mine is /dev/ttyACM0)
# 安装
sudo apt install cutecom 
# 启动
sudo cutecom
  • (2) Add permissions to the serial port
sudo chmod 777 /dev/xxx

3.5 Operation and Subscription

  • (1) Run the launch file (make sure the serial port number has been corrected)
roslaunch nlink_parser linktrack.launch
  • (2) View the published topic name, and then subscribe to him
rostopic list
rostopic echo /nlink_linktrack_nodeframexxx
  • [Error resolution:]
  • ERROR1: "ERROR: Cannot load message class for ... Are your messages built
    This error is because the environment variable was not added. It was added in the previous code, did you not restart the command line?
  • ERROR2: libserial.so file not found
sudo gedit ~/.bashrc
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

4. ROS master-slave configuration and locomotive interaction

4.1 ROS distributed communication settings

Reference website:
http://www.autolabor.com.cn/book/ROSTutorials/5/44-rosfen-bu-shi-tong-xin.html
Supporting video:
https://www.bilibili.com/video/BV1Ci4y1L7ZZ ?

4.2 ROS and vehicle communication

4.3 Communication between ROS and UAV (Mavros installation)

(0) thought record

  • Introduction: mavros is a ROS function package that is officially supported by both ros and mavlink protocols, so the tutorials are available for both, but they are actually the same.
  • Mavlink official website tutorial (I use):
    https://github.com/mavlink/mavros
  • ROS official website command tutorial:
    http://wiki.ros.org/mavros#Usage
  • Stepping on the pit: To put it bluntly, there are only two lines of code, but! ! ! ! ! ! ! Hey, it's been a whole morning. Pit: The GeographicLib required by mavros is too difficult to download, and I have been unable to download it. I didn’t find any useful ones on various Baidus on the Internet. Finally, I went to the official website to find it and copied it manually. (I don’t understand why it’s so hard to find on the official website)
  • Note: like other packages, mavros has two installation methods, one is source code and the other is binary. The difference is that the binary version can only call mavros with the ros command, and the source code cannot be seen. Advantages: easy installation.
  • (1) Install mavros
sudo apt-get install ros-noetic-mavros ros-noetic-mavros-extras
sudo apt-get install ros-melodic-mavros ros-melodic-mavros-extras

- (2) Install GeographicLib (official website method, if you report an error, use the next method I use)

The installation method given on the official website gives a script, run the script to download:

wget https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh
./install_geographiclib_datasets.sh
  • (2) Install GeographicLib - (I use)
    • Go directly to the GeographicLib official website to download the corresponding three packages, and get three folders after downloading.
      1. GeographicLib geoids egm96-5 official website download link:
      https://sourceforge.net/projects/geographiclib/files/geoids-distrib/egm96-5.tar.bz2/download
      2.GeographicLib gravity egm 96 official website download link
      https:/ /sourceforge.net/projects/geographiclib/files/gravity-distrib/egm96.zip/download
      3. GeographicLib magnetic emm2015 official website download link:
      https://sourceforge.net/projects/geographiclib/files/magnetic-distrib/emm2015.zip /download
    • After downloading, you get three compressed packages, and put them in a folder named GeographicLib after decompression. (file name must be like this)
    • Put that folder into the Ubuntu path: /usr/share
    • ok
  • (3) test

Plug the flight control into the USB, open the terminal, check whether the flight control is recognized, and enter the command

ll /dev/ttyACM*

After detection, add permissions, otherwise it will not start

sudo chmod 777 /dev/ttyACM0

start node

roslaunch mavros px4.launch _fcu_url:=/dev/ttyACM0:57600

Guess you like

Origin blog.csdn.net/weixin_44029896/article/details/125855610