1.真实环境安装livox-360 ROS版本驱动
1. 安装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
卸载sdk
$ sudo rm -rf /usr/local/lib/liblivox_lidar_sdk_*
$ sudo rm -rf /usr/local/include/livox_lidar_*
2. 安装ros驱动
git clone https://github.com/Livox-SDK/livox_ros_driver2.git ws_livox/src/livox_ros_driver2
cd livox_ros_driver2
source /opt/ros/noetic/setup.sh
# For ros1
./build.sh ROS1
3. 连接激光雷达与PC
网口线连接是通过enx…
IPV4方式要改成manual方式
设置激光雷达ip,子网掩码,网关如下
修改/src/livox_ros_driver2/config/MID360_config.json
中对应的IP地址
其中 "host_net_info"
中的所有ip都为激光雷达的ip
"lidar_configs"
中的"ip"
为192.168.1.1xx,其中xx为激光雷达SN码的最后两位
{
"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.50",
"cmd_data_port": 56101,
"push_msg_ip": "192.168.1.50",
"push_msg_port": 56201,
"point_data_ip": "192.168.1.50",
"point_data_port": 56301,
"imu_data_ip" : "192.168.1.50",
"imu_data_port": 56401,
"log_data_ip" : "",
"log_data_port": 56501
}
},
"lidar_configs" : [
{
"ip" : "192.168.1.126",
"pcl_data_type" : 1,
"pattern_mode" : 0,
"extrinsic_parameter" : {
"roll": 0.0,
"pitch": 0.0,
"yaw": 0.0,
"x": 0,
"y": 0,
"z": 0
}
}
]
}
4. 测试
将工作空间添加到.bashrc中并激活
查看是否配置成功
roslaunch livox_ros_driver2 rviz_MID360.launch
2.真实环境安装安装fasterlio
依赖安装
sudo apt-get install libgoogle-glog-dev
sudo apt-get install libeigen3-dev
sudo apt-get install libpcl-dev
sudo apt-get install libyaml-cpp-dev
Faster-LIO需要将gcc、g++编译器版本更新到9.0以上,编译器更新
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt install gcc-9
sudo apt install g++-9
cd /usr/bin
sudo rm gcc g++
sudo ln -s gcc-9 gcc
sudo ln -s g++-9 g++
查看编译器版本
g++ --version
gcc --version
安装tbb库
cd ~
wget https://github.com/intel/tbb/archive/2019_U8.tar.gz
tar zxvf 2019_U8.tar.gz
rm 2019_U8.tar.gz
cd oneTBB-2019_U8
cp build/linux.gcc.inc build/linux.gcc-9.inc
code -n build/linux.gcc-9.inc
#对文本内容进行修改
CPLUS ?= g++-9
CONLY ?= gcc-9
#编译
make compiler=gcc-9 stdver=c++17 tbb_build_prefix=my_tbb_build
将tbb安装到系统
sudo mkdir /usr/local/tbb-2019_U8
sudo cp -r include /usr/local/tbb-2019_U8/include
sudo ln -s /usr/local/tbb-2019_U8/include/tbb /usr/local/include/tbb
sudo cp -r build/my_tbb_build_release /usr/local/tbb-2019_U8/lib
sudo ln -s /usr/local/tbb-2019_U8/lib/libtbb.so.2 /usr/local/lib/libtbb.so
sudo ln -s /usr/local/tbb-2019_U8/lib/libtbbmalloc.so.2 /usr/local/lib/libtbbmalloc.so
sudo ln -s /usr/local/tbb-2019_U8/lib/libtbbmalloc_proxy.so.2 /usr/local/lib/libtbbmalloc_proxy.so
一定要加这句,将tbb放入系统库中
echo'export LD_LIBRARY_PATH=/usr/local/tbb-2019_U8/lib:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc
安装faterlio
cd ~/catkin_ws/src
git clone https://github.com/gaoxiang12/faster-lio.git
将~/catkin_ws/src/faster-lio/src/cmakelist的target_link_libraries路径改为具体的tbb路径
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
${PCL_LIBRARIES}
${PYTHON_LIBRARIES}
/usr/local/lib/libtbb.so
/usr/local/lib/libtbbmalloc.so
/usr/local/lib/libtbbmalloc_proxy.so
glog
yaml-cpp
)
编译
#编译
cd ~/catkin_ws
catkin_make
若这样编译不成功,可以尝试
mkdir build
cd build
cmake .. -DCUSTOM_TBB_DIR=`pwd`/../thirdparty/tbb2018_20170726oss
make -j8
cd ~/catkin_ws/src
git clone https://github.com/Livox-SDK/livox_ros_driver.git
#由于前面已经安装了livox_ros_driver,所以需要将faster-lio/thirdparty/livox_ros_driver删除,否则编译时会报错
cd ~/catkin_ws/src/faster-lio/thirdparty
rm -rf livox_ros_driver
#再将faster-lio下的CMakeLists的部分内容注释掉
cd ~/catkin_ws/src/faster-lio
gedit CMakeLists.txt
#将第15行的add_subdirectory(thirdparty/livox_ros_driver)注释掉,保存
#修改faster_lio配置文件
cd ~/catkin_ws/src/faster-lio/config/
gedit avia.yaml
3.XTDrone安装livox-360 模型
1. 安装相关依赖
安装livox_ros_driver
cd catkin_ws/src
git clone https://github.com/Livox-SDK/livox_ros_driver.git
cd ..
catkin_make
安装livox360激光雷达仿真模型
cd ~/catkin_ws/src
git clone https://github.com/Luchuanzhao/Livox_simulation_customMsg.git
mv Livox_simulation_customMsg livox_laser_simulation
通过修改~/catkin_ws/src/livox_laser_simulation/src/livox_points_plugin.cpp
源码将CustomMsg点云格式为PointCloud
添加mid360.csv
这个文件在home/byy/catkin_ws/src/livox_laser_simulation/scan_mode
文件夹
#将101行改为自己所需要的点云格式:0->PointCloud;1/2->PointCloud2;3->CustomMsg
publishPointCloudType = 0;
#注释掉340、341行的坐标变换代码,要不然rviz中得不到图像
// tfBroadcaster->sendTr