Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360

To ensure stable and high-precision outdoor positioning, I started using a 3D LiDAR, the MID360 LiDAR.Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360This LiDAR transmits point cloud data to the host via Ethernet, powered by an external 12V power supply.The implementation mainly includes the following aspects:1. Building the hardware unmanned vehicle platform2. Compiling the MID360 driver and testing it on RK3588-ROS2-Humble3. Compiling the Fast-LIO algorithm and verifying the running recorded data4. Implementing SLAM mapping and viewing point clouds5. Saving point cloud maps and viewing them6. Tracking and testing odometry positioning effects7. Modifying the mapping algorithm to remove real-time display in RViz to reduce memory usage8. Implementing power-on auto-start serviceImplementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID3601. Building the hardware unmanned vehicle platformThe vehicle uses a 4-wheel differential drive, with an STM32 microcontroller at the base and the main control using the RK3588, with a basic configuration of 8 cores and 4GB of RAM.Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID3602. Compiling the MID360 driver on RK3588-ROS2-Humble

First, compile the Livox-SDK2.

git clone https://github.com/Livox-SDK/Livox-SDK2.git
cd ./Livox-SDK2/
mkdir build
cd build
cmake .. && make -j
sudo make install

This SDK2 compiles successfully on ROS2-Humble.

Next, compile the livox_ros_driver2.

This package depends on PCL. Install the pcl-ros package.

sudo apt-get install ros-humble-pcl-ros.

Continue by creating a new folder,

mkdir livox_ws
cd livox_ws/
mkdir src
cd src
git clone https://github.com/Livox-SDK/livox_ros_driver2.git
cd ../
cat @lubancat:~/livox_ws/src/livox_ros_driver2$ ./build.sh humble
Working Path: /home/cat/livox_ws/src/livox_ros_driver2
ROS version is: ROS2
Starting >>> livox_ros_driver2
[Processing: livox_ros_driver2]
Finished <<< livox_ros_driver2 [32.1s]
Summary: 1 package finished [32.5s]

At this point, the MID360 driver has compiled successfully. Next, test whether the driver can be used.

Modify the Lubancait Ethernet IP address.

sudo ifconfig eth0 192.168.1.50

Modify the configuration file

cat@lubancat:~/livox_ws/src$

vi livox_ros_driver2/config/MID360_config.json

Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360

Start and check the output:

source ../../install/setup.sh

ros2 launch livox_ros_driver2 msg_MID360.launch

Send the livox_ros_driver2/CustomMsg topic type of /livox/lidar, which is the data type required by Fast-LIO.

Note: You need to modify not only

ws_livox/src/livox_ros_driver2-1.2.4/config/MID360_config.json

but also

ws_livox/install/livox_ros_driver2/share/livox_ros_driver2/config/MID360_config.json

Finally, the driver works successfully.

3. Compiling the Fast-LIO algorithm and verifying the operationFAST-LIO (Fast LiDAR-Inertial Odometry) is an efficient LiDAR-inertial odometry algorithm developed by the University of Hong Kong (HKU). FAST-LIO combines data from LiDAR and Inertial Measurement Units (IMUs) to achieve high-precision pose estimation through tightly-coupled iterative Extended Kalman Filtering (EKF). This algorithm performs excellently in fast motion, noisy, or cluttered environments, characterized by high computational efficiency and robustness.Create a new folder and download the Fast-LIO adapted for ROS2 Humble version inside src.

mkdir lio_ws
cd lio_ws
mkdir src
cd src
cat@lubancat:~/lio_ws/src$
git clone https://github.com/Ericsii/FAST_LIO.git --recursive
cd ..
colcon build --symlink-install
./install/setup.bash # use setup.zsh if using zsh

After compiling directly on my RK3588 board, there were no errors. It passed smoothly.

Run one terminal:

ros2 launch livox_ros_driver2 msg_MID360_launch.py

Run another terminal:

cat@lubancat:~/lio_ws/install/fast_lio/share/fast_lio$ source /opt/ros/humble/setup.bash
cat@lubancat:~/lio_ws/install/fast_lio/share/fast_lio$ ros2 launch fast_lio mapping.launch.py config_file:=avia.yaml

After installing RViz2 on Lubancat 3588, you can use MobaXterm to directly open RViz2 and display it without needing to open RViz2 in Ubuntu.

Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID3604. Implementing SLAM mapping and viewing point cloudsControl the vehicle’s operationImplementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360Observe the changes in RViz.Since RViz is displayed on a PC, the memory usage on the RK3588 will not be too high.Check the running status of the RK3588 using the command htop:

5. Saving point cloud maps and viewing themHere, the rqt tool was not used. In ROS2, maps cannot be directly saved as PCD; you need to call a service.

cat@lubancat:~$ ros2 service call /map_save std_srvs/srv/Trigger
requester: making request: std_srvs.srv.Trigger_Request()
response: std_srvs.srv.Trigger_Response(success=True, message='Map saved.')

This allows you to save test.pcd.

View the point cloud file data

You can use the pcl_viewer tool to view it:

sudo apt-get install pcl-tools
pcl_viewer test.pcd

Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360

Test data:

Running Fast-LIO without operating the LiDAR:

Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360

Memory consumption is over 200MB. After running the MID360 LiDAR, it is less than 400MB.

Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID3606. Tracking and testing odometry positioning effectsThe topics output by the Fast-LIO algorithm include:Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360The services include:Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360Among them, the topic /Odometry is the odometry output for positioning.The service /map_save is the service call for saving.The odometry output format is:Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360After a simple round-trip positioning, the odometry positioning can achieve a few centimeters accuracy indoors.Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID3607. Modifying the mapping algorithm to remove real-time display in RViz to reduce memory usageModify the configuration file mapping.launch.pySet RViz to false as follows:

declare_rviz_cmd = DeclareLaunchArgument(
          'rviz', default_value='false',  # Change default to 'false'
          description='Use RViz to monitor results'
    )    # Removed the rviz_node entirely      # rviz_node = Node(
      #     package='rviz2',
      #     executable='rviz2',
      #     arguments=['-d', rviz_cfg],
      #     condition=IfCondition(rviz_use)
      # )  

8. Implementing power-on auto-start serviceUse systemd to write a script to start the service.

[Unit]
Description=Livox ROS Driver
After=ros2.service
[Service]
Type=simple
User=cat
ExecStart=/usr/bin/bash -c "export ROS_DOMAIN_ID=1 && source /opt/ros/humble/setup.bash && source /home/cat/livox_ws/install/setup.bash && ros2 launch livox_ros_driver2 msg_MID360_launch.py"
[Install]
WantedBy=multi-user.target

SummaryThe MID360 and similar 3D LiDARs use LIO-related algorithms, which are quite mature and can achieve positioning and navigation outdoors. Additionally, incorporating AI-related image vision can ensure stability through visual detection and segmentation.Furthermore, search for learnable AI robot navigation technologies for both indoor and outdoor environments.Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360Implementing Fast-LIO Robot SLAM Indoor Positioning Algorithm with RK3588, ROS2 Humble, EasyMQoS, and MID360

Leave a Comment