Refactor: update LiDAR documentation and unify IMU parameter descriptions

This commit is contained in:
xiexun
2025-08-12 16:11:57 +08:00
parent 414c145f83
commit b223624090
4 changed files with 433 additions and 179 deletions
-76
View File
@@ -1,76 +0,0 @@
# IMU集成测试报告
## 修改摘要
本次修改将原来分离的加速度计和陀螺仪控制整合成统一的IMU控制,主要修改包括:
### 1. Launch文件修改 (lidar.launch.py)
**之前的参数:**
- `enable_sync_output_accel_gyro`: 控制同步输出
- `enable_accel`: 控制加速度计
- `enable_gyro`: 控制陀螺仪
- `accel_rate`: 加速度计频率
- `gyro_rate`: 陀螺仪频率
**现在的参数:**
- `enable_imu`: 统一控制IMU(加速度计+陀螺仪)
- `imu_rate`: 统一的IMU频率
- `accel_range`: 加速度计量程
- `gyro_range`: 陀螺仪量程
### 2. 话题变化
**之前的话题:**
- `/camera/accel/sample`: 单独的加速度计数据
- `/camera/gyro/sample`: 单独的陀螺仪数据
- `/camera/gyro_accel/sample`: 同步的加速度计+陀螺仪数据
**现在的话题:**
- `/lidar/imu/sample`: 统一的IMU话题,包含同步的加速度计和陀螺仪数据
### 3. 外部参考话题变化
**之前的话题:**
- `/lidar/lidar_to_accel`: LiDAR到加速度计的外部参考
- `/lidar/lidar_to_gyro`: LiDAR到陀螺仪的外部参考
**现在的话题:**
- `/lidar/lidar_to_imu`: LiDAR到IMU的统一外部参考
### 4. 测试验证
#### 启动命令测试
```bash
# 新的启动命令
ros2 launch orbbec_camera lidar.launch.py enable_imu:=true imu_rate:=50hz
# 验证日志输出
# 应该看到: "Started IMU stream with accel range: 2g, gyro range: 1000dps, rate: 50hz"
```
#### 话题验证
```bash
# 检查IMU话题
ros2 topic list | grep -E "(imu|accel|gyro)"
# 预期输出:
# /lidar/imu/sample
# /lidar/lidar_to_imu
# 检查IMU数据
ros2 topic echo /lidar/imu/sample --once
# 预期: 包含angular_velocity和linear_acceleration的同步数据
```
### 5. 代码修改文件列表
- `orbbec_camera/launch/lidar.launch.py`
- `orbbec_camera/src/ob_lidar_node.cpp`
- `orbbec_camera/include/orbbec_camera/ob_lidar_node.h`
- `docs/launch_parameters.md`
- `docs/all_available_topics.md`
### 6. 修改优势
1. **简化配置**: 用户只需要设置一个`enable_imu`参数即可启用整个IMU功能
2. **统一频率**: 确保加速度计和陀螺仪使用相同的采样频率,提高数据同步性
3. **统一话题**: 所有IMU数据在一个话题中发布,便于下游节点使用
4. **减少复杂性**: 去除了复杂的同步选项,默认就是同步的
5. **更好的语义**: IMU作为一个整体概念更符合机器人领域的常见用法
### 7. 向后兼容性
此修改不向后兼容,使用旧参数的launch文件需要更新参数名称。但这是一个有意的设计决策,旨在简化和改进用户体验。
+182
View File
@@ -1 +1,183 @@
# OrbbecSDK ROS2 LiDAR Driver
This ROS2 driver supports your use of Orbbec single-line/multi-line LiDAR. This document provides installation instructions, usage guides, and other important information to help you quickly get started using this driver.
## 1. Installation
### 1.1 Prerequisites
Before using the OrbbecSDK ROS2 LiDAR driver, please ensure that the following dependencies are installed on your system:
- **ROS2**: A valid installation of ROS2 (Humble, Foxy, or other supported distributions).
- If you need help, please refer to the [ROS2 Installation Guide](https://docs.ros.org/en/foxy/Installation.html).
### 1.2 Install deb Dependencies
```bash
# assume you have sourced ROS environment, same blow
sudo apt install libgflags-dev nlohmann-json3-dev \
ros-$ROS_DISTRO-image-transport ros-${ROS_DISTRO}-image-transport-plugins ros-${ROS_DISTRO}-compressed-image-transport \
ros-$ROS_DISTRO-image-publisher ros-$ROS_DISTRO-camera-info-manager \
ros-$ROS_DISTRO-diagnostic-updater ros-$ROS_DISTRO-diagnostic-msgs ros-$ROS_DISTRO-statistics-msgs \
ros-$ROS_DISTRO-backward-ros libdw-dev
```
### 1.3 Install udev Rules
```bash
cd ~/ros2_ws/src/OrbbecSDK_ROS2/orbbec_camera/scripts
sudo bash install_udev_rules.sh
sudo udevadm control --reload-rules && sudo udevadm trigger
```
### 2. Getting Started
```bash
cd ~/ros2_ws/
# build release, Default is Debug
colcon build --event-handlers console_direct+ --cmake-args -DCMAKE_BUILD_TYPE=Release
```
Launch the LiDAR node
* First terminal
```bash
. ./install/setup.bash
ros2 launch orbbec_camera lidar.launch.py
```
* Second terminal
```bash
. ./install/setup.bash
rviz2
```
1. Open Rviz2.
2. Add a `PointCloud2` or `LaserScan` display.
3. For `PointCloud2`, select the `/lidar/cloud/points` topic; for `LaserScan`, select the `/lidar/scan/points` topic.
4. Set the `Fixed Frame` to `lidar_lidar_frame` to properly align the data.
* `PointCloud2` visualization example:
![module in rviz2](./docs/images/lidar0.jpg)
* `LaserScan` visualization example:
![module in rviz2](./docs/images/lidar1.png)
## 2. Usage
### 2.1 Running the Driver
To start the driver, launch the provided ROS2 launch file:
```bash
source install/setup.bash
# Launch the driver with point cloud data
ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_POINT
# Launch the driver with sphere point cloud data
ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_SPHERE_POINT
# Launch the driver with laser scan data
ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_SCAN
# Launch the driver with IMU enabled
ros2 launch orbbec_camera lidar.launch.py enable_imu:=true imu_rate:=50hz
# Launch the driver with both point cloud and IMU data
ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_POINT enable_imu:=true imu_rate:=100hz
```
This command will start the node that interfaces with the Orbbec LiDAR device. Please ensure that the LiDAR hardware is properly connected before running this command.
### 2.2 Get Device Information for Connected LiDARs
```bash
ros2 run orbbec_camera list_devices_node
```
This command will list the connected LiDAR devices and display their respective IP addresses and ports. You can use this information to configure the driver to connect to specific devices.
### 2.3 Check Which Configurations the LiDAR Supports
```bash
ros2 run orbbec_camera list_camera_profile_mode_node
```
### 2.4 Parameters and Configuration
The `lidar.launch.py` file contains default parameters for the driver. You can customize these settings by modifying the launch file or creating a custom configuration file. Key parameters include:
- **device_type**: The type of device to launch. Optional values: `lidar`, `camera`. Setting this parameter to `lidar` launches the LiDAR device, setting it to `camera` launches the camera device.
- **camera_name**: Launch node namespace.
- **device_num**: Number of devices. This must be filled if you need to launch multiple devices.
- **upgrade_firmware**: Firmware upgrade function. The input parameter is the firmware path.
- **connection_delay**: Delay time (in milliseconds) for reopening the device. Immediately reopening the device during hot-plugging may cause firmware crashes.
- **publish_tf**: Enable TF publishing.
- **tf_publish_rate**: TF publishing frequency.
- **lidar_format**: Data format for the LiDAR. Optional values: `LIDAR_POINT`, `LIDAR_SPHERE_POINT`, `LIDAR_SCAN`
- **lidar_rate**: Scan rate of the LiDAR.
- **enable_scan_to_point**: Enable conversion of scan data to point cloud data, publishing PointCloud2 data type topics.
- **repetitive_scan_mode**: Repetitive scan mode parameter.
- **filter_level**: Add filter level parameter.
- **vertical_fov**: Vertical angle parameter.
- **min_angle**: Minimum angle of the LiDAR scan range in degrees (e.g., `-135.0`). Default value: `-135.0`.
- **max_angle**: Maximum angle of the LiDAR scan range in degrees (e.g., `135.0`). Default value: `135.0`.
- **min_range**: Minimum distance the LiDAR can measure in meters. Default value: `0.05`.
- **max_range**: Maximum distance the LiDAR can measure in meters. Default value: `30.0`.
- **echo_mode**: Echo mode of the LiDAR. Optional values: `Last Echo`, `First Echo`
- **point_cloud_qos**: ROS 2 message Quality of Service (QoS) settings. Possible values include `SYSTEM_DEFAULT`, `DEFAULT`, `PARAMETER_EVENTS`, `SERVICES_DEFAULT`, `PARAMETERS`, and `SENSOR_DATA`, and are case-insensitive. These values correspond to `rmw_qos_profile_system_default`, `rmw_qos_profile_default`, `rmw_qos_profile_parameter_events`, `rmw_qos_profile_services_default`, `rmw_qos_profile_parameters`, and `SENSOR_DATA` respectively.
- **enumerate_net_device**: Enable automatic enumeration of network devices.
- **net_device_ip**: IP address of the network device.
- **net_device_port**: Port number on the network side.
- **log_level**: SDK log level, default value is `none`, optional values are `debug`, `info`, `warn`, `error`, `fatal`
- **time_domain**: Timestamp type of the device. Optional values are `device`, `global`, `system`
- **config_file_path**: Path to the YAML configuration file. Default value is "". If no configuration file is specified, default parameters from the launch file will be used.
- **enable_heartbeat**: Enable heartbeat function, default is `false`. If set to `true`, the camera node will send heartbeat signals to the firmware; this should also be set to `true` if hardware logging is required.
- **enable_imu**: Enable IMU (accelerometer + gyroscope) and output unified IMU topic data.
- **imu_rate**: Unified frequency of the IMU (both accelerometer and gyroscope).
- **accel_range**: Range of the accelerometer.
- **gyro_range**: Range of the gyroscope.
## Point Cloud Data Detailed Description
Livox PointCloud2 (PointXYZRT) point cloud format is as follows:
```
float32 x # X axis, unit:m
float32 y # Y axis, unit:m
float32 z # Z axis, unit:m
uint8 intensity # lidar intensity
uint8 tag # lidar tag
```
## 3. IMU Data
### 3.1 IMU Topics
When IMU is enabled, the following topics will be published:
- **`/lidar/imu/sample`**: Unified IMU topic containing synchronized accelerometer and gyroscope data in `sensor_msgs/Imu` format.
- **`/lidar/lidar_to_imu`**: Transform from LiDAR frame to IMU frame.
### 3.2 Using IMU Data
To enable IMU data collection:
```bash
# Launch with IMU enabled
ros2 launch orbbec_camera lidar.launch.py enable_imu:=true imu_rate:=50hz
# Check IMU topics
ros2 topic list | grep imu
# View IMU data
ros2 topic echo /lidar/imu/sample
```
The IMU data includes:
- **linear_acceleration**: 3D acceleration data (x, y, z) in m/s²
- **angular_velocity**: 3D angular velocity data (x, y, z) in rad/s
- **orientation**: Quaternion orientation (not provided by hardware, set to zero)
+101 -73
View File
@@ -1,20 +1,20 @@
# OrbbecSDK ROS2 雷达驱动 # OrbbecSDK ROS2 激光雷达驱动
此 ROS2 驱动程序支持您使用Orbbec 单线/多线 LiDAR,本文档提供安装说明、使用指南以及其他重要信息,帮助您快速上手使用该驱动程序。 本ROS2驱动支持您使用奥比中光单线/多线激光雷达。本文档提供安装说明、使用指南和其他重要信息,帮助您快速开始使用此驱动。
## 1. 安装 ## 1. 安装
### 1.1 先决条件 ### 1.1 先决条件
在使用 OrbbecSDK ROS2 LiDAR驱动程序之前,请确保您的系统上安装了以下依赖项: 在使用OrbbecSDK ROS2激光雷达驱动之前,请确保您的系统已安装以下依赖项:
- **ROS2**: 有效安装 ROS2(Humble、Foxy 或其他受支持的发行版)。 - **ROS2**: 有效的ROS2安装(Humble、Foxy或其他支持的发行版)。
- 如果您需要帮助,请参阅 [ROS2 安装指南](https://docs.ros.org/en/foxy/Installation.html). - 如果您需要帮助,请参考[ROS2安装指南](https://docs.ros.org/en/foxy/Installation.html)。
### 1.2 安装 deb 依赖项 ### 1.2 安装deb依赖项
```bash ```bash
# assume you have sourced ROS environment, same blow # 假设您已经配置了ROS环境,下同
sudo apt install libgflags-dev nlohmann-json3-dev \ sudo apt install libgflags-dev nlohmann-json3-dev \
ros-$ROS_DISTRO-image-transport ros-${ROS_DISTRO}-image-transport-plugins ros-${ROS_DISTRO}-compressed-image-transport \ ros-$ROS_DISTRO-image-transport ros-${ROS_DISTRO}-image-transport-plugins ros-${ROS_DISTRO}-compressed-image-transport \
ros-$ROS_DISTRO-image-publisher ros-$ROS_DISTRO-camera-info-manager \ ros-$ROS_DISTRO-image-publisher ros-$ROS_DISTRO-camera-info-manager \
@@ -22,7 +22,7 @@ ros-$ROS_DISTRO-diagnostic-updater ros-$ROS_DISTRO-diagnostic-msgs ros-$ROS_DIST
ros-$ROS_DISTRO-backward-ros libdw-dev ros-$ROS_DISTRO-backward-ros libdw-dev
``` ```
### 1.3 安装 udev 规则 ### 1.3 安装udev规则
```bash ```bash
cd ~/ros2_ws/src/OrbbecSDK_ROS2/orbbec_camera/scripts cd ~/ros2_ws/src/OrbbecSDK_ROS2/orbbec_camera/scripts
@@ -30,15 +30,15 @@ sudo bash install_udev_rules.sh
sudo udevadm control --reload-rules && sudo udevadm trigger sudo udevadm control --reload-rules && sudo udevadm trigger
``` ```
### 2. 入门 ### 2. 入门指南
```bash ```bash
cd ~/ros2_ws/ cd ~/ros2_ws/
# build release, Default is Debug # 构建发布版本,默认为调试版本
colcon build --event-handlers console_direct+ --cmake-args -DCMAKE_BUILD_TYPE=Release colcon build --event-handlers console_direct+ --cmake-args -DCMAKE_BUILD_TYPE=Release
``` ```
启动雷达节点 启动激光雷达节点
* 第一个终端 * 第一个终端
@@ -54,49 +54,50 @@ ros2 launch orbbec_camera lidar.launch.py
rviz2 rviz2
``` ```
1.打开Rviz2。 1. 打开Rviz2。
2. 添加 `PointCloud2`或 `LaserScan`显示。
3. 对于 `PointCloud2`,选择 `/lidar/cloud/points`话题;对于 `LaserScan`,选择 `/lidar/scan/points`话题。
4. 将 `Fixed Frame`设置为 `lidar_lidar_frame`以正确对齐数据。
2.添加一个 `PointCloud2`或者 `LaserScan`显示。 * `PointCloud2`可视化示例:
3.`PointCloud2`选择 `/lidar/cloud/points`话题,`LaserScan`选择 `/lidar/scan/points`话题。 ![rviz2中的模块](./docs/images/lidar0.jpg)
4.将 `Fixed Frame`设置为 `lidar_lidar_frame`,以正确对齐数据。 * `LaserScan`可视化示例:
* `PointCloud2`示例可视化: ![rviz2中的模块](./docs/images/lidar1.png)
![module in rviz2](./docs/images/lidar0.jpg) ## 2. 使用方法
* `LaserScan`示例可视化: ### 2.1 运行驱动
![module in rviz2](./docs/images/lidar1.png) 要启动驱动,请启动提供的ROS2启动文件:
## 2. 用法
### 2.1 运行驱动程序
要启动驱动程序,请启动提供的 ROS2 启动文件:
```bash ```bash
source install/setup.bash source install/setup.bash
# Launch the driver with point cloud data # 启动带有点云数据的驱动
ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_POINT ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_POINT
# Launch the driver with sphere point cloud data # 启动带有球面点云数据的驱动
ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_SPHERE_POINT ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_SPHERE_POINT
# Launch the driver with laser scan data # 启动带有激光扫描数据的驱动
ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_SCAN ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_SCAN
# 启动启用IMU的驱动
ros2 launch orbbec_camera lidar.launch.py enable_imu:=true imu_rate:=50hz
# 启动同时包含点云和IMU数据的驱动
ros2 launch orbbec_camera lidar.launch.py lidar_format:=LIDAR_POINT enable_imu:=true imu_rate:=100hz
``` ```
此命令将启动与 Orbbec LiDAR 设备接口的节点。运行此命令前,请确保 LiDAR 硬件已正确连接。 此命令将启动与奥比中光激光雷达设备接口的节点。请确保在运行此命令之前正确连接激光雷达硬件。
### 2.2 获取已连接雷达的设备信息 ### 2.2 获取已连接激光雷达的设备信息
```bash ```bash
ros2 run orbbec_camera list_devices_node ros2 run orbbec_camera list_devices_node
``` ```
此命令将列出已连接的 LiDAR 设备,并显示它们各自的 IP 地址和端口。您可以使用这些信息来配置驱动程序以连接到特定设备。 此命令将列出已连接的激光雷达设备并显示其各自的IP地址和端口。您可以使用此信息配置驱动以连接到特定设备。
### 2.3 检查雷达支持哪些配置 ### 2.3 检查激光雷达支持的配置
```bash ```bash
ros2 run orbbec_camera list_camera_profile_mode_node ros2 run orbbec_camera list_camera_profile_mode_node
@@ -104,50 +105,77 @@ ros2 run orbbec_camera list_camera_profile_mode_node
### 2.4 参数和配置 ### 2.4 参数和配置
`lidar.launch.py`文件包含驱动程序的默认参数。您可以通过修改启动文件或创建自定义配置文件来自定义这些设置。关键参数包括: `lidar.launch.py`文件包含驱动的默认参数。您可以通过修改启动文件或创建自定义配置文件来自定义这些设置。关键参数包括:
- **device_type**:启动的设备类型。可选的值:`lidar`、`camera`。该参数设置为 `lidar`则启动雷达设备,设置为 `camera`则启动相机设备。 - **device_type**: 要启动的设备类型。可选值:`lidar`、`camera`。将此参数设置为 `lidar`启动激光雷达设备,设置为 `camera`启动摄像头设备。
- **camera_name**:启动节点命名空间。 - **camera_name**: 启动节点命名空间。
- **device_num**:设备数量。如果需要启动多个设备,则必须填写此项。 - **device_num**: 设备数量。如果需要启动多个设备,则必须填写此项。
- **upgrade_firmware**:固件升级功能。输入参数是固件路径。 - **upgrade_firmware**: 固件升级功能。输入参数是固件路径。
- **connection_delay**:重新打开设备的延迟时间(以毫秒为单位)。并且在热插拔时立即重新打开设备可能会导致固件崩溃。 - **connection_delay**: 重新打开设备的延迟时间(毫秒)。在热插拔期间立即重新打开设备可能导致固件崩溃。
- **publish_tf**:启用 TF 发布。 - **publish_tf**: 启用TF发布。
- **tf_publish_rate**:TF 发布频率。 - **tf_publish_rate**: TF发布频率。
- **lidar_format**:雷达的数据格式。可选值:`LIDAR_POINT`、`LIDAR_SPHERE_POINT` 、`LIDAR_SCAN` - **lidar_format**: 激光雷达的数据格式。可选值:`LIDAR_POINT`、`LIDAR_SPHERE_POINT`、`LIDAR_SCAN`
- **lidar_rate**:雷达的扫描速率。 - **lidar_rate**: 激光雷达的扫描频率。
- **enable_scan_to_point**:启动scan数据转pointcloud数据,发布pointcloud2数据类型的话题。 - **enable_scan_to_point**: 启用扫描数据到点云数据的转换,发布PointCloud2数据类型话题。
- **repetitive_scan_mode**:重复扫描模式参数。 - **repetitive_scan_mode**: 重复扫描模式参数。
- **filter_level**:添加过滤等级参数。 - **filter_level**: 添加过滤级别参数。
- **vertical_fov**:垂直角度参数。 - **vertical_fov**: 垂直角度参数。
- **min_angle**:雷达扫描范围的最小角度,以度为单位(例如 `-135.0`)。默认值:`-135.0`。 - **min_angle**: 激光雷达扫描范围的最小角度(度)(例如,`-135.0`)。默认值:`-135.0`
- **max_angle**:雷达扫描范围的最大角度,以度为单位(例如 `135.0`)。默认值:`135.0`。 - **max_angle**: 激光雷达扫描范围的最大角度(度)(例如,`135.0`)。默认值:`135.0`
- **min_range**:雷达可测量的最小距离,以米为单位。默认值:`0.05`。 - **min_range**: 激光雷达可测量的最小距离(米)。默认值:`0.05`
- **max_range**:雷达可测量的最大距离,以米为单位。默认值:`30.0`。 - **max_range**: 激光雷达可测量的最大距离(米)。默认值:`30.0`
- **echo_mode**:雷达的回波模式。可选值:`Last Echo`,`First Echo` - **echo_mode**: 激光雷达的回波模式。可选值:`Last Echo`、`First Echo`
- **point_cloud_qos**:ROS 2 消息服务质量 (QoS) 设置。可能的值包括 `SYSTEM_DEFAULT`、`DEFAULT`、`PARAMETER_EVENTS`、`SERVICES_DEFAULT`、`PARAMETERS` 和 `SENSOR_DATA`,并且不区分大小写。这些值分别对应于 `rmw_qos_profile_system_default`、`rmw_qos_profile_default`、`rmw_qos_profile_parameter_events`、`rmw_qos_profile_services_default`、`rmw_qos_profile_parameters` 和 `SENSOR_DATA`。 - **point_cloud_qos**: ROS 2消息服务质量(QoS)设置。可能的值包括 `SYSTEM_DEFAULT`、`DEFAULT`、`PARAMETER_EVENTS`、`SERVICES_DEFAULT`、`PARAMETERS`和 `SENSOR_DATA`,不区分大小写。这些值分别对应 `rmw_qos_profile_system_default`、`rmw_qos_profile_default`、`rmw_qos_profile_parameter_events`、`rmw_qos_profile_services_default`、`rmw_qos_profile_parameters`和 `SENSOR_DATA`。
- **enumerate_net_device**:启用自动枚举网络设备。 - **enumerate_net_device**: 启用网络设备的自动枚举。
- **net_device_ip**:网络设备的IP地址。 - **net_device_ip**: 网络设备的IP地址。
- **net_device_port**:网络这边的端口号。 - **net_device_port**: 网络端的端口号。
- **log_level**:SDK日志级别,默认值为 `none`,可选值为 `debug`、`info`、`warn`、`error`、`fatal` - **log_level**: SDK日志级别,默认值为 `none`,可选值为 `debug`、`info`、`warn`、`error`、`fatal`
- **time_domain**:设备的时间戳类型。可选值为 `device`、`global`、`system` - **time_domain**: 设备的时间戳类型。可选值为 `device`、`global`、`system`
- **config_file_path**:YAML 配置文件的路径。默认值为“”。如果未指定配置文件,则将使用启动文件中的默认参数。 - **config_file_path**: YAML配置文件的路径。默认值为""。如果未指定配置文件,将使用启动文件中的默认参数。
- **enable_heartbeat**:启用心跳功能,默认为 `false`。如果设置为 `true`,摄像头节点将向固件发送心跳信号;如果需要硬件日志记录,也应设置为 `true`。 - **enable_heartbeat**: 启用心跳功能,默认为 `false`。如果设置为 `true`,相机节点将向固件发送心跳信号;如果需要硬件日志记录,也应将其设置为 `true`。
- **enable_sync_output_accel_gyro:**开启同步 accel_gyro,输出 IMU 主题实时数据。 - **enable_imu**: 启用IMU(加速度计+陀螺仪)并输出统一的IMU话题数据。
- **enable_accel:**启用加速度计,并输出加速度计topic话题。 - **imu_rate**: IMU的统一频率(加速度计和陀螺仪)。
- **accel_rate:**加速度计的频率。 - **accel_range**: 加速度计的量程。
- **accel_range:**加速度计的范围。 - **gyro_range**: 陀螺仪的量程。
- **enable_gyro:**启用陀螺仪,并输出陀螺仪信息 topic 数据。
- **gyro_rate:**陀螺仪的频率。
- **gyro_range:**陀螺仪的范围。
## pointcloud data 详细说明 ## 点云数据详细说明
Livox pointcloud2 (PointXYZRT) 点云格式,如下: Livox PointCloud2 (PointXYZRT) 点云格式如下:
``` ```
float32 x # X axis, unit:m float32 x # X轴,单位:米
float32 y # Y axis, unit:m float32 y # Y轴,单位:米
float32 z # Z axis, unit:m float32 z # Z轴,单位:米
uint8 intensity # lidar intensity uint8 intensity # 激光雷达强度
uint8 tag # lidar tag uint8 tag # 激光雷达标签
``` ```
## 3. IMU数据
### 3.1 IMU话题
启用IMU时,将发布以下话题:
- **`/lidar/imu/sample`**: 统一的IMU话题,包含 `sensor_msgs/Imu`格式的同步加速度计和陀螺仪数据。
- **`/lidar/lidar_to_imu`**: 从激光雷达坐标系到IMU坐标系的变换。
### 3.2 使用IMU数据
要启用IMU数据采集:
```bash
# 启动并启用IMU
ros2 launch orbbec_camera lidar.launch.py enable_imu:=true imu_rate:=50hz
# 检查IMU话题
ros2 topic list | grep imu
# 查看IMU数据
ros2 topic echo /lidar/imu/sample
```
IMU数据包括:
- **linear_acceleration**: 3D加速度数据(x、y、z),单位:m/s²
- **angular_velocity**: 3D角速度数据(x、y、z),单位:rad/s
- **orientation**: 四元数方向(硬件不提供,设置为零)
+150 -30
View File
@@ -51,36 +51,156 @@ def load_parameters(context, args):
def generate_launch_description(): def generate_launch_description():
args = [ args = [
DeclareLaunchArgument('device_type', default_value='lidar'), DeclareLaunchArgument(
DeclareLaunchArgument('camera_name', default_value='lidar'), 'device_type',
DeclareLaunchArgument('device_num', default_value='1'), default_value='lidar',
DeclareLaunchArgument('upgrade_firmware', default_value=''), description='Device type to start: lidar or camera. Set lidar to start LiDAR; set camera to start a camera device.'
DeclareLaunchArgument('connection_delay', default_value='10'), ),
DeclareLaunchArgument('publish_tf', default_value='true'), DeclareLaunchArgument(
DeclareLaunchArgument('tf_publish_rate', default_value='0.0'), 'camera_name',
DeclareLaunchArgument('lidar_format', default_value='ANY'),#LIDAR_POINT, LIDAR_SPHERE_POINT, LIDAR_SCAN default_value='lidar',
DeclareLaunchArgument('lidar_rate', default_value='20'), description='Node namespace/device name. Used as prefix for topics, parameters, and TF.'
DeclareLaunchArgument('enable_scan_to_point', default_value='false'), ),
DeclareLaunchArgument('repetitive_scan_mode', default_value='-1'), DeclareLaunchArgument(
DeclareLaunchArgument('filter_level', default_value='-1'), 'device_num',
DeclareLaunchArgument('vertical_fov', default_value='-1.0'), default_value='1',
DeclareLaunchArgument('min_angle', default_value='-135.0'), description='Number of devices to start. Required when launching multiple devices.'
DeclareLaunchArgument('max_angle', default_value='135.0'), ),
DeclareLaunchArgument('min_range', default_value='0.05'), DeclareLaunchArgument(
DeclareLaunchArgument('max_range', default_value='30.0'), 'upgrade_firmware',
DeclareLaunchArgument('echo_mode', default_value='single channel'), default_value='',
DeclareLaunchArgument('point_cloud_qos', default_value='default'), description='Firmware file path. If set, attempts firmware upgrade on startup; empty means no upgrade.'
DeclareLaunchArgument('enumerate_net_device', default_value='true'), ),
DeclareLaunchArgument('net_device_ip', default_value=''), DeclareLaunchArgument(
DeclareLaunchArgument('net_device_port', default_value='0'), 'connection_delay',
DeclareLaunchArgument('log_level', default_value='none'), default_value='10',
DeclareLaunchArgument('time_domain', default_value='device'),# global, device, system description='Reopen delay after hot-plug (milliseconds). Prevents firmware issues caused by immediate reconnect.'
DeclareLaunchArgument('config_file_path', default_value=''), ),
DeclareLaunchArgument('enable_heartbeat', default_value='false'), DeclareLaunchArgument(
DeclareLaunchArgument('enable_imu', default_value='true'), 'publish_tf',
DeclareLaunchArgument('imu_rate', default_value='50hz'), default_value='true',
DeclareLaunchArgument('accel_range', default_value='2g'), description='Whether to publish TF frames. true to enable, false to disable.'
DeclareLaunchArgument('gyro_range', default_value='1000dps'), ),
DeclareLaunchArgument(
'tf_publish_rate',
default_value='0.0',
description='TF publish frequency in Hz. <= 0 means use default or publish on demand.'
),
DeclareLaunchArgument(
'lidar_format',
default_value='ANY', # LIDAR_POINT, LIDAR_SPHERE_POINT, LIDAR_SCAN
description='LiDAR output format: LIDAR_POINT, LIDAR_SPHERE_POINT, or LIDAR_SCAN. ANY lets device/config decide.'
),
DeclareLaunchArgument(
'lidar_rate',
default_value='20',
description='LiDAR scan/publish rate in Hz. Supported range depends on device model.'
),
DeclareLaunchArgument(
'enable_scan_to_point',
default_value='false',
description='Convert LaserScan to PointCloud2 and publish. true to enable, false to disable.'
),
DeclareLaunchArgument(
'repetitive_scan_mode',
default_value='-1',
description='Repetitive scan mode. -1 uses device default; other values depend on device capability.'
),
DeclareLaunchArgument(
'filter_level',
default_value='-1',
description='Filtering level. -1 uses default; non-negative integers increase filtering strength.'
),
DeclareLaunchArgument(
'vertical_fov',
default_value='-1.0',
description='Vertical field of view in degrees. -1 uses device default.'
),
DeclareLaunchArgument(
'min_angle',
default_value='-135.0',
description='Minimum scan angle in degrees (e.g., -135.0).'
),
DeclareLaunchArgument(
'max_angle',
default_value='135.0',
description='Maximum scan angle in degrees (e.g., 135.0).'
),
DeclareLaunchArgument(
'min_range',
default_value='0.05',
description='Minimum measurable range in meters.'
),
DeclareLaunchArgument(
'max_range',
default_value='30.0',
description='Maximum measurable range in meters.'
),
DeclareLaunchArgument(
'echo_mode',
default_value='single channel',
description='Echo mode. Examples: single channel, First Echo, Last Echo. Actual options depend on device.'
),
DeclareLaunchArgument(
'point_cloud_qos',
default_value='default',
description='QoS for PointCloud/LaserScan: SYSTEM_DEFAULT, DEFAULT, PARAMETER_EVENTS, SERVICES_DEFAULT, PARAMETERS, SENSOR_DATA (case-insensitive).'
),
DeclareLaunchArgument(
'enumerate_net_device',
default_value='true',
description='Automatically enumerate network devices. true for auto-discovery; false to use specified IP/port only.'
),
DeclareLaunchArgument(
'net_device_ip',
default_value='',
description='IP address of the network device. Leave empty to rely on enumeration or device defaults.'
),
DeclareLaunchArgument(
'net_device_port',
default_value='0',
description='Port of the network device. 0 uses device/driver defaults.'
),
DeclareLaunchArgument(
'log_level',
default_value='none',
description='SDK log level: none, debug, info, warn, error, fatal.'
),
DeclareLaunchArgument(
'time_domain',
default_value='device', # global, device, system
description='Timestamp domain: device (device clock), global (time sync), or system (host clock).'
),
DeclareLaunchArgument(
'config_file_path',
default_value='',
description='Path to a YAML config file. If provided, overrides same-name launch arguments; otherwise defaults apply.'
),
DeclareLaunchArgument(
'enable_heartbeat',
default_value='false',
description='Send heartbeat to device. Enable when hardware logging/online monitoring is needed.'
),
DeclareLaunchArgument(
'enable_imu',
default_value='true',
description='Enable IMU (accelerometer and gyroscope) data publishing.'
),
DeclareLaunchArgument(
'imu_rate',
default_value='50hz',
description='IMU publish rate, e.g., 50hz, 100hz. Actual options depend on device.'
),
DeclareLaunchArgument(
'accel_range',
default_value='2g',
description='Accelerometer range, e.g., 2g, 4g, 8g, 16g. Device-dependent.'
),
DeclareLaunchArgument(
'gyro_range',
default_value='1000dps',
description='Gyroscope range, e.g., 250dps, 500dps, 1000dps, 2000dps. Device-dependent.'
),
] ]
def get_params(context, args): def get_params(context, args):