Jetson Nano Super + Ubuntu 22.04 + ROS2 Humble:MID-360、FAST-LIO 与 EGO-Planner 实时建图部署记录

📅 2026/7/6 4:18:19 👁️ 阅读次数 📝 编程学习
Jetson Nano Super + Ubuntu 22.04 + ROS2 Humble:MID-360、FAST-LIO 与 EGO-Planner 实时建图部署记录

本文记录在 Jetson Nano Super / Jetson Orin Nano Super 平台上,基于 Ubuntu 22.04 和 ROS2 Humble 部署 Livox MID-360、FAST-LIO 和 EGO-Planner 的实机流程。
需要先明确技术边界:FAST-LIO 负责实时定位与建图,EGO-Planner 负责基于当前点云和里程计进行局部轨迹规划。也就是说,本文标题里的“建图”核心由 FAST-LIO 完成,EGO-Planner 主要消费 FAST-LIO 的位姿和点云结果。

1. 实验效果

MID-360 通过以太网接入 Jetson,ROS2 驱动发布雷达点云和 IMU,FAST-LIO 实时输出里程计和点云地图,EGO-Planner 根据局部点云生成下一步轨迹或位置指令。

实机测试平台如下,左侧为 MID-360 与载具/支架,右侧 Jetson/显示端运行 ROS2、FAST-LIO、EGO-Planner 和 RViz2。

2. 系统架构

ROS2 下的数据流如下:

Livox MID-360 | | UDP Ethernet v livox_ros_driver2 | | /livox/lidar livox_ros_driver2/msg/CustomMsg 或 PointCloud2 | /livox/imu sensor_msgs/msg/Imu v FAST-LIO ROS2 | | /Odometry 或 /odom | /cloud_registered | /path | /map_save service v EGO-Planner ROS2 适配版 | | /planning/pos_cmd | /planning/bspline v 控制器 / 飞控 / RViz2 可视化

各模块职责:

模块作用关键输出
livox_ros_driver2接收 MID-360 原始 UDP 数据并发布 ROS2 话题/livox/lidar/livox/imu
FAST-LIO ROS2LiDAR-IMU 紧耦合里程计和增量点云地图/Odometry/cloud_registered
EGO-Planner根据里程计、点云和目标点生成局部轨迹/planning/pos_cmd、轨迹话题
RViz2点云、TF、路径和轨迹可视化三维调试界面

3. 硬件与软件环境

本文环境:

计算平台:Jetson Nano Super / Jetson Orin Nano Super 系统:Ubuntu 22.04 ROS:ROS2 Humble 雷达:Livox MID-360 驱动:Livox-SDK2 + livox_ros_driver2 建图:FAST-LIO ROS2 适配版 规划:EGO-Planner ROS2 适配版或自移植版本

如果使用的是老款 Jetson Nano 4GB,需要注意它官方 JetPack 长期停留在较老 Ubuntu 版本,跑 Ubuntu 22.04 + ROS2 Humble 通常属于非官方系统或社区镜像,性能和依赖兼容性都要额外验证。本文更适合 Jetson Orin Nano Super 这类 Ubuntu 22.04 / JetPack 6.x 平台。

4. Jetson 性能准备

Jetson 上跑实时点云算法时,建议先进入高性能模式:

sudonvpmodel-m0sudojetson_clocks

安装基础依赖:

sudoaptupdatesudoaptinstall-y\build-essential cmakegitwgetcurl\python3-colcon-common-extensions python3-rosdep python3-vcstool\libpcl-dev libeigen3-dev libboost-all-dev libgoogle-glog-dev\ros-humble-rviz2 ros-humble-pcl-ros ros-humble-tf2-eigen\ros-humble-rmw-cyclonedds-cpp

初始化rosdep

sudorosdep init rosdep update

建议使用 CycloneDDS,Jetson 上在多节点点云通信时通常比默认 Fast DDS 更稳定:

echo"source /opt/ros/humble/setup.bash">>~/.bashrcecho"export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp">>~/.bashrcsource~/.bashrc

如果编译时内存不足,可以临时增加 swap。Orin Nano 8GB 一般够用,但同时编译多个大包时仍建议降低并行度:

colcon build --symlink-install --parallel-workers2

5. 配置 MID-360 网络

MID-360 使用网口通信,需要确保 Jetson 和雷达在同一网段。常见配置是把 Jetson 有线网卡设置成类似:

IP: 192.168.1.50 Netmask: 255.255.255.0 Gateway: 留空

检查网卡:

ipaddrping192.168.1.1

实际雷达 IP 以 Livox Viewer 或雷达配置文件为准。后面livox_ros_driver2/config/MID360_config.json里的host_net_info也要改成 Jetson 的有线网卡 IP。

6. 安装 Livox-SDK2 与 livox_ros_driver2

先安装 Livox-SDK2:

mkdir-p~/livox_ws/srccd~/livox_ws/srcgitclone https://github.com/Livox-SDK/Livox-SDK2.gitcdLivox-SDK2mkdirbuild&&cdbuild cmake..-DCMAKE_BUILD_TYPE=Releasemake-j2sudomakeinstall

再编译 ROS2 驱动:

cd~/livox_ws/srcgitclone https://github.com/Livox-SDK/livox_ros_driver2.gitcd~/livox_ws/src/livox_ros_driver2source/opt/ros/humble/setup.bash ./build.sh humble

ROS2 Humble 下启动 MID-360:

cd~/livox_wssourceinstall/setup.bash ros2 launch livox_ros_driver2 msg_MID360_launch.py

检查话题:

ros2 topic list|greplivox ros2 topic hz /livox/lidar ros2 topicecho/livox/imu--once

如果只想看 RViz2 点云:

ros2 launch livox_ros_driver2 rviz_MID360_launch.py

注意:FAST-LIO 对每个点的时间戳很敏感。MID-360 接 FAST-LIO 时,优先使用msg_MID360_launch.py发布的 Livox 自定义消息,因为它包含点级时间信息,利于运动畸变补偿。

7. 编译 FAST-LIO ROS2

ROS2 下建议使用已经适配 ROS2 Humble 的 FAST-LIO 版本,例如FAST_LIO_ROS2。编译前要先 source Livox 驱动,因为 FAST-LIO 需要livox_ros_driver2/msg/CustomMsg

mkdir-p~/fastlio2_ws/srccd~/fastlio2_ws/srcgitclone https://github.com/Ericsii/FAST_LIO_ROS2.git--recursivecd~/fastlio2_wssource/opt/ros/humble/setup.bashsource~/livox_ws/install/setup.bash rosdepinstall--from-paths src --ignore-src-ycolcon build --symlink-install --parallel-workers2sourceinstall/setup.bash

针对 MID-360,需要在 FAST-LIO 的 yaml 中确认以下参数:

common:lid_topic:"/livox/lidar"imu_topic:"/livox/imu"time_sync_en:falsemapping:extrinsic_est_en:falseextrinsic_T:[0.0,0.0,0.0]extrinsic_R:[1.0,0.0,0.0,0.0,1.0,0.0,0.0,0.0,1.0]

extrinsic_Textrinsic_R必须根据 MID-360 与机体/IMU 的实际安装关系填写。如果使用 MID-360 内置 IMU,仍要确认代码中外参定义方向,避免 LiDAR 到 IMU 和 IMU 到 LiDAR 写反。

启动 FAST-LIO:

cd~/fastlio2_wssource/opt/ros/humble/setup.bashsource~/livox_ws/install/setup.bashsourceinstall/setup.bash ros2 launch fast_lio mapping.launch.py config_file:=mid360.yaml

如果仓库没有mid360.yaml,可以从avia.yaml或其他 Livox 配置复制一份,重点修改:

lid_topic imu_topic time_sync_en extrinsic_T extrinsic_R filter_size_surf pcd_save

检查 FAST-LIO 输出:

ros2 topic list|grep-E"Odom|odom|cloud|path"ros2 topic hz /cloud_registered ros2 topicecho/Odometry--once

RViz2 中建议添加:

Fixed Frame: camera_init 或 map,按实际 TF 为准 PointCloud2: /cloud_registered Odometry: /Odometry Path: /path TF

8. 接入 EGO-Planner ROS2

这里需要特别说明:ZJU-FAST-Lab 原版 EGO-Planner 主要是 ROS1/catkin 工程,ROS2 Humble 下通常需要使用社区 ROS2 移植版,或者自行把消息、launch、参数和 CMake 迁移到ament_cmake

接入原则不变,EGO-Planner 只需要拿到三个核心输入:

1. 里程计:nav_msgs/msg/Odometry 2. 局部点云:sensor_msgs/msg/PointCloud2 3. 目标点:geometry_msgs/msg/PoseStamped

和 FAST-LIO 对接时,推荐映射如下:

odom_topic -> /Odometry cloud_topic -> /cloud_registered goal_topic -> /goal_pose 或 /move_base_simple/goal

ROS2 launch 中可以写成类似:

Node(package="ego_planner",executable="ego_planner_node",name="ego_planner_node",output="screen",parameters=[{"odom_topic":"/Odometry","cloud_topic":"/cloud_registered","goal_topic":"/goal_pose","map_frame":"camera_init"}])

如果你的 EGO-Planner ROS2 版本仍使用私有话题命名,检查并 remap:

ros2nodeinfo /ego_planner_node ros2 topic list

常见 remap 关系:

/grid_map/odom -> /Odometry /grid_map/cloud -> /cloud_registered /waypoint -> /goal_pose

启动后检查规划输出:

ros2 topic list|grepplanning ros2 topicecho/planning/pos_cmd--once

9. 推荐启动顺序

9.1 启动 MID-360 驱动

cd~/livox_wssource/opt/ros/humble/setup.bashsourceinstall/setup.bash ros2 launch livox_ros_driver2 msg_MID360_launch.py

9.2 启动 FAST-LIO

cd~/fastlio2_wssource/opt/ros/humble/setup.bashsource~/livox_ws/install/setup.bashsourceinstall/setup.bash ros2 launch fast_lio mapping.launch.py config_file:=mid360.yaml

9.3 启动 RViz2

rviz2

添加/cloud_registered/Odometry/path和 TF,确认地图稳定。

9.4 启动 EGO-Planner

cd~/ego_ros2_wssource/opt/ros/humble/setup.bashsource~/fastlio2_ws/install/setup.bashsourceinstall/setup.bash ros2 launch ego_planner run_mid360_fastlio.launch.py

然后用 RViz2 的2D Goal Pose或自定义发布器发送目标点。

10. Jetson 上的参数建议

10.1 livox_ros_driver2

publish_freq不要一开始拉太高,建议先从 10 Hz 或 20 Hz 调通:

publish_freq: 10.0 或 20.0 xfer_format: 使用 Livox 自定义消息或含时间戳的格式

如果只做可视化可以用 PointCloud2;如果要跑 FAST-LIO,优先使用 CustomMsg。

10.2 FAST-LIO

Jetson 上主要瓶颈是 CPU 和内存带宽,建议:

filter_size_surf: 0.2 ~ 0.5 filter_size_map: 0.2 ~ 0.5 cube_side_length: 不要设置过大 pcd_save_en: 调试阶段关闭,最终保存时再打开

启动后用下面命令看资源占用:

tegrastats

如果 CPU 长期打满,可以先降低 MID-360 发布频率、加大体素滤波、关闭 RViz2 或把 RViz2 放到上位机远程显示。

10.3 EGO-Planner

实机首次测试建议保守:

max_vel: 0.5 ~ 1.0 m/s max_acc: 0.5 ~ 1.5 m/s^2 planning_horizon: 4 ~ 6 m resolution: 0.15 ~ 0.25 m obstacles_inflation: 大于机体半径 + 定位误差

如果 Jetson 端同时跑 RViz2、FAST-LIO 和 Planner 卡顿,优先把 RViz2 放到另一台电脑,通过同一 ROS_DOMAIN_ID 订阅 Jetson 的话题。

11. 常见问题

11.1ros2 topic list看不到/livox/lidar

检查:

1. Jetson 有线网卡 IP 是否和 MID-360 同网段 2. MID360_config.json 中 host IP 是否写成 Jetson 网口 IP 3. 防火墙是否拦截 UDP 4. 是否启动了 msg_MID360_launch.py 5. 网线和供电是否稳定

11.2 FAST-LIO 报点云没有 time 字段

通常是启动了 RViz 点云格式 launch,而不是自定义消息 launch。应使用:

ros2 launch livox_ros_driver2 msg_MID360_launch.py

而不是只用于显示的 PointCloud2 launch。FAST-LIO 需要点级时间戳做去畸变。

11.3 地图重影、墙面变厚或漂移

优先检查:

1. IMU 是否正常发布 2. 雷达与 IMU 时间戳是否同步 3. 外参方向是否写反 4. 雷达是否固定牢靠 5. 启动时平台是否短暂静止

11.4 EGO-Planner 不出轨迹

一般是输入话题、坐标系或目标点问题:

ros2nodeinfo /ego_planner_node ros2 topicecho/Odometry--onceros2 topicecho/cloud_registered--onceros2 run tf2_tools view_frames

确认:

1. Planner 订阅到了 FAST-LIO 的里程计 2. 点云和里程计在同一个 frame 或 TF 可变换 3. 目标点 frame 与 map/camera_init 一致 4. 局部地图范围覆盖当前位置和目标方向 5. z 高度没有落在障碍物或地图外

11.5 Jetson 运行一段时间后变慢

检查功耗和温度:

tegrastats

建议:

1. 使用主动散热 2. 使用足够功率的电源 3. 开启 jetson_clocks 4. 降低点云发布频率 5. RViz2 放到上位机运行

12. rosbag2 录制与离线复现

实机调试时建议录包:

ros2 bag record\/livox/lidar\/livox/imu\/Odometry\/cloud_registered\/path\/planning/pos_cmd\/tf\/tf_static

离线回放:

ros2 bag play<bag目录>

保存点云地图时,在 FAST-LIO 配置里开启pcd_save,然后调用保存服务。不同 ROS2 适配版服务名可能略有差异,常见为:

ros2servicelist|grepmap ros2servicecall /map_save std_srvs/srv/Trigger{}

13. 总结

在 Jetson Nano Super / Orin Nano Super + Ubuntu 22.04 + ROS2 Humble 上,MID-360 实时建图链路的关键是:

livox_ros_driver2 负责稳定发布 MID-360 点云和 IMU; FAST-LIO ROS2 负责 LiDAR-IMU 里程计和实时点云地图; EGO-Planner ROS2 适配版负责消费里程计和点云,输出局部轨迹。

调试时建议按“驱动 -> FAST-LIO -> EGO-Planner”的顺序逐层验证。只要/livox/lidar/livox/imu/cloud_registered/Odometry这几条关键链路稳定,后续规划器接入就主要是话题名、frame 和参数的问题。

参考资料

  1. livox_ros_driver2: https://github.com/Livox-SDK/livox_ros_driver2
  2. Livox-SDK2: https://github.com/Livox-SDK/Livox-SDK2
  3. FAST_LIO_ROS2: https://github.com/Ericsii/FAST_LIO_ROS2
  4. EGO-Planner: https://github.com/ZJU-FAST-Lab/ego-planner
  5. EGO-Planner-v2 ROS2 相关 issue: https://github.com/ZJU-FAST-Lab/EGO-Planner-v2/issues/43