当前位置:   article > 正文

树莓派Ubuntu22.04 安装ROS2 humble MID360_树莓派 ros2

树莓派 ros2

树梅派安装ROS2 humble MID360

主查考:https://blog.csdn.net/qq_29912325/article/details/130269367
辅助参考:https://github.com/Livox-SDK/livox_ros_driver2

查看官方简介
Livox-SDK 和 livox_ros_driver: Drivers for receiving LiDAR data and more, support Lidar Mid-40, Mid-70, Tele-15, Horizon, Avia.
Livox-SDK2 和 livox_ros_driver2: Drivers for receiving LiDAR data and controlling lidar, support Lidar HAP and Mid-360.


1. 编译Livox-SDK2
官方地址:https://github.com/Livox-SDK/Livox-SDK2

执行一下命令:

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


如上就安装完成了Livox-SDK2,会安装如下内容:

-- Installing: /usr/local/lib/liblivox_lidar_sdk_static.a

-- Installing: /usr/local/include/livox_lidar_def.h

-- Installing: /usr/local/include/livox_lidar_api.h

-- Installing: /usr/local/include/livox_lidar_cfg.h

-- Installing: /usr/local/lib/liblivox_lidar_sdk_shared.so


如需删除,执行如下命令:
sudo rm -rf /usr/local/lib/liblivox_lidar_sdk_*
sudo rm -rf /usr/local/include/livox_lidar_*

2.编译livox_ros_driver2
官方地址:https://github.com/Livox-SDK/livox_ros_driver2

2.1.克隆源代码
打开终端执行如下命令,会将源代码clone在/home/ws_livox/src/livox_ros_driver2目录下,这步创建了ROS2需要使用的工作空间。

git clone https://github.com/Livox-SDK/livox_ros_driver2.git ws_livox/src/livox_ros_driver2

cd   /src/livox_ros_driver2
注意目录权限
source /opt/ros/humble/setup.sh
可查看~./bashrc是否添加完成
./build.sh humble
修改对应的配置文件

source ../../install/setup.sh
ros2 launch livox_ros_driver2 [launch file]

测试运行
ros2 launch livox_ros_driver2 rviz_MID360_launch.py

3.编译FAST_LIO

git clone https://github.com/hku-mars/FAST_LIO.git
cd FAST_LIO
git submodule update --init
cd ../..

修改对应CMakelists.txt、package.xml、FAST_LIO/src/preprocess.h、FAST_LIO/src/preprocess.cpp、FAST_LIO/src/laserMapping.cpp中的livox_ros_driver,修改成livox_ros_driver2

catkin_make

source devel/setup.bash

测试运行

roslaunch fast_lio mapping_mid360.launch

问题一
By not providing "Findament_cmake.cmake" in CMAKE_MODULE_PATH this project
  has asked CMake to find a package configuration file provided by
  "ament_cmake", but CMake did not find one.
 
  Could not find a package configuration file provided by "ament_cmake" with
  any of the following names:
 
    ament_cmakeConfig.cmake
    ament_cmake-config.cmake
 
  Add the installation prefix of "ament_cmake" to CMAKE_PREFIX_PATH or set
  "ament_cmake_DIR" to a directory containing one of the above files.  If
  "ament_cmake" provides a separate development package or SDK, be sure it
  has been installed.
————————————————
我错误原因,个人目录权限不对 sudo chmod  777 -R  xxx

问题二
Package 'livox_ros_driver2' not found: "package 'livox_ros_driver2' not found, searching: ['/opt/ros/humble']"
————————————————
没有将source ../../install/setup.sh设置到~./bashrc

问题三

如果遇到类似的报错:what(): Could not load library dlopen error: liblivox_lidar_sdk_shared.so: cannot open shared object file: No such file or directory, at /tmp/binarydeb/ros-galactic-rcutils-4.0.4/src/shared_library.c:99,说明缺少Livox SDK2库,已安装但不可用,因为不在 LD_LIBRARY_PATH 环境变量中。所以将 /usr/local/lib 目录添加到变量.bashrc中:
————————————————
版权声明:本文为CSDN博主「ZARD帧心」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/ZARDforever123/article/details/134219903

  1. sudo gedit ~/.bashrc
  2. # 添加:
  3. export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

问题四

安装FAST_LIO 编译livox_ros_driver2出现下面,一直无法编译100%

make: *** [Makefile:141:all] 错误 2Invoking "make -j4 -l4" failed

 解决方法: 单独安装livox_ros_driver2编译,注册到.baserc中, 再使用官方教程中的FAST_LIO的catkin_make编译

  1. cd ~/$A_ROS_DIR$/src
  2. git clone https://github.com/hku-mars/FAST_LIO.git
  3. cd FAST_LIO
  4. git submodule update --init
  5. cd ../..
  6. catkin_make
  7. source devel/setup.bash

 通过后可以启动livox_ros_driver2和FAST_LIO

本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号