Preface
Livox mid360 needs to be used Livox-SDK2
instead of Livox-SDK
, and correspondingly livox_ros_driver2
. And need to modify some codes in FAST_LIO.
1. Install Livox-SDK2
Refer to the official tutorial .
1.1. Install CMake
sudo apt install cmake
1.2. Install and compile 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
Note :
Livox-SDK2 can be downloaded from any location and compiled and installed.
2. Compile the FAST_LIO project
2.1. Create ROS1 project
mkdir fast_lio && cd fast_lio
mkdir src && cd src
2.2. Download the FAST_LIO source code src
in the folder
git clone https://github.com/hku-mars/FAST_LIO.git
cd FAST_LIO
git submodule update --init
cd ../..
2.3. Download the livox_ros_driver2 source code src
in the folder
git clone https://github.com/Livox-SDK/livox_ros_driver2.git
3. Modify FAST_LIO code
3.1. Modify FAST_LIO’s CMakelists.txt
. Before modification:
find_package(catkin REQUIRED COMPONENTS
geometry_msgs
nav_msgs
sensor_msgs
roscpp
rospy
std_msgs
pcl_ros
tf
livox_ros_driver # <-修改这里
message_generation
eigen_conversions
)
After modification:
find_package(catkin REQUIRED COMPONENTS
geometry_msgs
nav_msgs
sensor_msgs
roscpp
rospy
std_msgs
pcl_ros
tf
livox_ros_driver2 # <-修改这里
message_generation
eigen_conversions
)
3.2. Modify the package.xml of FAST_LIO
. Before modification:
<build_depend>livox_ros_driver</build_depend>
<run_depend>livox_ros_driver</run_depend>
After modification:
<build_depend>livox_ros_driver2</build_depend>
<run_depend>livox_ros_driver2</run_depend>
3.3. Modify the header file reference of FAST_LIO.
Open FAST_LIO/src/preprocess.h and FAST_LIO/src/laserMapping.cpp
respectively . Before modification:
#include <livox_ros_driver/CustomMsg.h>
After modification:
#include <livox_ros_driver2/CustomMsg.h>
3.3. Modify the namespace of FAST_LIO.
Open the namespaces in FAST_LIO/src/preprocess.h , FAST_LIO/src/preprocess.cpp , and FAST_LIO/src/laserMapping.cpp respectively
. There are many places that need to be modified . Before modification:
livox_ros_driver::
After modification:
livox_ros_driver2::
4. Compile project
Use the following instructions to compile in fast_lio/src/livox_ros_driver2 in the project directory . Do not use it directly.catkin_make
cd src/livox_ros_driver2
./build.sh ROS1
The compilation is successful as shown below.
If there is still a compilation error message, it means that livox_ros_driver:: has not all been changed to livox_ros_driver2:: , as shown below:
5. Modify the configuration of Livox mid360
Refer to the official tutorial .
5.1. Modify the computer IP address
. It is recommended that the computer IP be changed to 192.168.1.5. Otherwise, the corresponding computer IP in the configuration file below needs to be modified. It does not matter whether the DNS address is written or not.
5.2. Modify Livox mid360 IP
and open the file fast_lio/src/livox_ros_driver2/config/MID360_config.json . The IP of Livox mid360 has been fixed after leaving the factory. Look at the SN code under the QR code on it. Add a 1 in front of the last two numbers to get the corresponding IP. (For example, if the last two digits of the SN code are 12, then its corresponding IP address is 192.168.1.112).
{
"lidar_summary_info" : {
"lidar_type": 8
},
"MID360": {
"lidar_net_info" : {
"cmd_data_port": 56100,
"push_msg_port": 56200,
"point_data_port": 56300,
"imu_data_port": 56400,
"log_data_port": 56500
},
"host_net_info" : {
"cmd_data_ip" : "192.168.1.5", # <-这里和修改后的电脑ip一致
"cmd_data_port": 56101,
"push_msg_ip": "192.168.1.5", # <-这里和修改后的电脑ip一致
"push_msg_port": 56201,
"point_data_ip": "192.168.1.5", # <-这里和修改后的电脑ip一致
"point_data_port": 56301,
"imu_data_ip" : "192.168.1.5", # <-这里和修改后的电脑ip一致
"imu_data_port": 56401,
"log_data_ip" : "",
"log_data_port": 56501
}
},
"lidar_configs" : [
{
"ip" : "192.168.1.12", # <-这里是Livox mid360的ip
"pcl_data_type" : 1,
"pattern_mode" : 0,
"extrinsic_parameter" : {
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0,
"x": 0,
"y": 0,
"z": 0
}
}
]
}
6. Run the test
Open two terminals and run them respectively
source devel/setup.bash
roslaunch livox_ros_driver2 msg_MID360.launch
Run in another terminal
source devel/setup.bash
roslaunch fast_lio mapping_mid360.launch
The screenshot of successful operation is as follows: