# livox_ros_driver2 IMU加速度单位误用g而非m/s²

> 原文链接：https://robotics.hellobike.com/pitfalls/2025-12-23-livox-ros-driver2-157
> 频道：pitfalls | 更新日期：2025-12-23 | 标签：auto, github-issue, livox_ros_driver2
> 核心摘要：驱动发布IMU加速度单位为g违反ROS规范，需在代码中手动乘以9.8转换为m/s²以修复融合异常。

# livox_ros_driver2 IMU加速度单位误用g而非m/s²

::: v-pre
> 本文由 AI 根据公开内容整理，可能有误，请以原文为准：[IMU messages (sensor_msgs/Imu Message) using incorrect units?](https://github.com/Livox-SDK/livox_ros_driver2/issues/157)（GitHub Livox-SDK/livox_ros_driver2 #157）

**状态**：有绕过办法

## 问题

livox_ros_driver2 发布的 sensor_msgs/Imu 消息中 linear_acceleration 字段未乘以重力常数，实际输出单位为 g 而非 ROS 标准规定的 m/s²。水平放置 Mid-360 时 Z 轴数值接近 1 证实该问题，导致与 Pixhawk 等飞控进行 IMU 融合时出现异常。

## 环境

Livox MID-360 激光雷达，livox_ros_driver2 驱动，ROS Noetic，Pixhawk 飞控，PX4 固件。

## 解决办法

1. 打开 livox_ros_driver2 源码文件 `src/lddc.cpp` 定位至约 L493 行的 IMU 消息生成逻辑。
2. 修改 `imu_msg.linear_acceleration` 的 x、y、z 分量赋值代码，将原始 `imu_data.acc_x/y/z` 分别乘以 9.8（即 `imu_data.acc_x * 9.8`）。
3. 重新编译驱动包并替换原有节点，验证水平静止状态下 Z 轴加速度读数是否约为 9.8 m/s²。

讨论原作者：@greymfm 等，版权归原作者所有。
:::

## 原始参考来源 (Sources)

- [GitHub Livox-SDK/livox_ros_driver2 #157：IMU messages (sensor_msgs/Imu Message) using incorrect units?](https://github.com/Livox-SDK/livox_ros_driver2/issues/157)