Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fbb396708c | |||
| 117b02bec7 | |||
| 196044b993 | |||
| 645819a65f | |||
| 1b551f974b | |||
| 765173676f |
@@ -0,0 +1,2 @@
|
|||||||
|
# Keep structured point-cloud assets byte-identical across platforms.
|
||||||
|
*.pcd -text
|
||||||
@@ -31,6 +31,7 @@ log/
|
|||||||
!05_software/real/sim2real/vendored/odin1_imu/lib/*.a
|
!05_software/real/sim2real/vendored/odin1_imu/lib/*.a
|
||||||
!05_software/real/sim2real_v2/vendored/odin1_imu/lib/*.a
|
!05_software/real/sim2real_v2/vendored/odin1_imu/lib/*.a
|
||||||
!05_software/real/sim2real_ros2_v2/src/odin_ros_driver/lib/*.a
|
!05_software/real/sim2real_ros2_v2/src/odin_ros_driver/lib/*.a
|
||||||
|
!05_software/real/sim2real_ros2_v3/src/odin_ros_driver/lib/*.a
|
||||||
|
|
||||||
# Training outputs
|
# Training outputs
|
||||||
logs/
|
logs/
|
||||||
|
|||||||
+7
-6
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
本目录用于保存 16DOF 轮足项目自身的技术文档和使用说明。
|
本目录用于保存 16DOF 轮足项目自身的技术文档和使用说明。
|
||||||
|
|
||||||
后续建议按主题组织:
|
当前文档结构:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
01_doc/
|
01_doc/
|
||||||
├─ architecture/ # 系统架构和数据流
|
├─ architecture/
|
||||||
├─ control/ # 控制与强化学习原理
|
│ └─ early_software_stack.md # 第一代训练—仿真—真机闭环
|
||||||
├─ deployment/ # Sim2Sim 和 Sim2Real 部署
|
├─ training_evolution.md # v0.4~v0.6 训练架构演进
|
||||||
├─ hardware/ # 接线、标定和硬件兼容性
|
└─ version_history.md # 全项目 Tag 与里程碑
|
||||||
└─ user_guide/ # 安装、运行和调试说明
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
具体运行说明放在对应工程目录内,避免在顶层重复并逐渐失真:训练见 `05_software/train/rc_mjlab/`,真机部署见 `05_software/real/`。
|
||||||
|
|||||||
@@ -34,4 +34,4 @@
|
|||||||
比赛得分:1050
|
比赛得分:1050
|
||||||
```
|
```
|
||||||
|
|
||||||
`model_6800.onnx` 是比赛最终部署工件,不用模型编号替代训练代码版本号。它将在最终比赛部署版本中与运行配置一起归档。
|
`model_6800.onnx` 是比赛最终部署工件,不用模型编号替代训练代码版本号。它已随比赛部署归档;当前规范目录为 `05_software/real/sim2real_ros2_v3/policies/`。
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# 版本演进
|
# 版本演进
|
||||||
|
|
||||||
本项目使用同一条 `16dof` 主线和里程碑 Tag 保存线性演进,不在源码目录中复制历史版本。
|
本项目使用里程碑 Tag 保存时间演进;同一架构的小步迭代不复制目录。ROS 2 的无后缀、`_v2`、`_v3` 目录分别代表三个架构大版本,并在 `v1.1.0` 中同时保留。
|
||||||
|
|
||||||
| Tag | 阶段 | 核心内容 |
|
| Tag | 阶段 | 核心内容 |
|
||||||
| --- | --- | --- |
|
| --- | --- | --- |
|
||||||
@@ -18,8 +18,13 @@
|
|||||||
| `v0.10.0` | ROS 2/C++ 初版 | 50 Hz C++ 推理、200 Hz CAN 热路径和 ROS 2 系统集成 |
|
| `v0.10.0` | ROS 2/C++ 初版 | 50 Hz C++ 推理、200 Hz CAN 热路径和 ROS 2 系统集成 |
|
||||||
| `v0.11.0` | ROS 2 导航原型 | 简单导航、PCD 交互定位、任务点和 Web 导航调试 |
|
| `v0.11.0` | ROS 2 导航原型 | 简单导航、PCD 交互定位、任务点和 Web 导航调试 |
|
||||||
| `v0.11.1` | Odin 与站姿调参 | 完整 Odin 驱动、TensorRT、多策略切换和调参站姿 |
|
| `v0.11.1` | Odin 与站姿调参 | 完整 Odin 驱动、TensorRT、多策略切换和调参站姿 |
|
||||||
|
| `v0.12.0` | 里程计导航联调 | 纯里程计 fallback、A_min 路线、TF 冲突保护和 model_9600 |
|
||||||
|
| `v1.0.0` | 比赛最终部署初次归档 | last_not_slalom_1050、model_6800/model_84、最终路线和触控屏;当时暂存于无后缀目录 |
|
||||||
|
| `v1.0.1` | 比赛成果媒体补充 | 最终机器人图片与 1050 分比赛视频 |
|
||||||
|
| `v1.0.2` | 文档一致性修正 | 统一历史 Tag、当前快照和成果媒体的描述 |
|
||||||
|
| `v1.1.0` | 三代目录规范化 | 恢复无后缀初版、保留 v2 里程计版、明确最终比赛 v3,并校准训练 README |
|
||||||
|
|
||||||
> 原先临时归档为 `v0.9.0` 的最终 ROS 2/C++ 比赛部署已保存在 `backup/final-ros2-v0.9.0` 分支和 `backup-v0.9.0-ros2-final` 标签中,重排完成后将正式归入 `v1.0.0`。
|
> 原先临时归档为 `v0.9.0` 的最终 ROS 2/C++ 比赛部署已保存在 `backup/final-ros2-v0.9.0` 分支和 `backup-v0.9.0-ros2-final` 标签中,重排后已正式归入 `v1.0.0`。
|
||||||
|
|
||||||
## `v0.9.0` 的 Python Sim2Real v2
|
## `v0.9.0` 的 Python Sim2Real v2
|
||||||
|
|
||||||
@@ -53,6 +58,40 @@
|
|||||||
- `map_b.pcd` 从 1,080,047 点确定性抽样为 270,012 点,并保留原始和抽样哈希。
|
- `map_b.pcd` 从 1,080,047 点确定性抽样为 270,012 点,并保留原始和抽样哈希。
|
||||||
- 排除嵌套 Git、Odin 运行日志、缓存、开发草稿和未被配置引用的候选策略。
|
- 排除嵌套 Git、Odin 运行日志、缓存、开发草稿和未被配置引用的候选策略。
|
||||||
|
|
||||||
|
## `v0.12.0` 的里程计导航联调
|
||||||
|
|
||||||
|
- 归档 `real/sim2real_ros2_v2(odom)`,继续沿用 `sim2real_ros2_v2` 目录的线性演进。
|
||||||
|
- 将 Rough 策略切换为 `model_9600`,默认站姿恢复为髋俯仰 `0.550`、膝关节 `-1.125`。
|
||||||
|
- Odin `custom_map_mode` 固定为纯里程计,加入 odom 新鲜度、外部 map/odom TF 冲突和任务结束交接保护。
|
||||||
|
- 增加 A_min 路线、PCD 地图编辑工具和三份抽样点云;原始大 PCD 不直接进入 Git。
|
||||||
|
- 保留完整 Odin 驱动、标定参数和 SDK 静态库;未找到的 `map_a.bin` 仍不伪造,重定位闭环不在本 Tag 声称已复现。
|
||||||
|
|
||||||
|
## `v1.0.0` 的比赛最终部署
|
||||||
|
|
||||||
|
- 首次归档原始 `sim2real_ros2_v2(last_not_slalom_1050)` 最终 ROS 2/C++ 真机工程;该 Tag 中暂存于无后缀 `real/sim2real_ros2`,目录命名在 `v1.1.0` 才修正为 `real/sim2real_ros2_v3`。`1050` 是比赛成绩,不是模型编号。
|
||||||
|
- Rough 使用 `model_6800`,Wall 使用 `model_84`,Crawl 按比赛配置使用 IK 后端。
|
||||||
|
- 保留最终五份路线、1 号场地抽样 PCD、Odin 驱动、CAN 硬件桥、命令仲裁、导航和 Orin 触控屏 UI。
|
||||||
|
- 最终配置默认命令源为 `NAV`、定位模式为 `relocal`,但真实 Odin `1hao.bin` 不在备份中,重定位闭环需要从比赛设备补回。
|
||||||
|
- 排除嵌套 Git、日志、备份、候选策略、构建产物和开发草稿;TensorRT engine 仅代表比赛机环境。
|
||||||
|
|
||||||
|
## `v1.0.1` 的比赛成果媒体补充
|
||||||
|
|
||||||
|
- 保持 `v1.0.0` 的比赛最终代码和部署内容不变。
|
||||||
|
- 补充最终机器人图片和比赛视频,成绩为 1050 分、第七名(前 5%)。
|
||||||
|
- 代码复现可查看 `v1.0.0`,包含成果媒体的对应快照可查看 `v1.0.1`。
|
||||||
|
|
||||||
|
## `v1.0.2` 的文档一致性修正
|
||||||
|
|
||||||
|
- 统一 ROS 2 历史 Tag、当前工作树和媒体补丁的说明。
|
||||||
|
- 该版本仅修正文档,没有改变训练或真机运行代码。
|
||||||
|
|
||||||
|
## `v1.1.0` 的目录与说明规范化
|
||||||
|
|
||||||
|
- 从 `v0.10.0` 恢复无后缀 `sim2real_ros2` 初版快照。
|
||||||
|
- `sim2real_ros2_v2` 保持 `v0.12.0` 里程计联调快照。
|
||||||
|
- 将 `last_not_slalom_1050` 最终比赛部署正式命名为 `sim2real_ros2_v3`。
|
||||||
|
- 依据当前源码重新校准 `rc_mjlab` README 中的物理步长、控制频率、环境数、执行器、地形、奖励和随机化说明。
|
||||||
|
|
||||||
## `v0.4.0` 的模型变化
|
## `v0.4.0` 的模型变化
|
||||||
|
|
||||||
- 机械 CAD 不变。
|
- 机械 CAD 不变。
|
||||||
|
|||||||
@@ -3,3 +3,5 @@
|
|||||||
本目录用于保存 16DOF 轮足机器人的自研电路、接线图、BOM、传感器与计算平台说明。
|
本目录用于保存 16DOF 轮足机器人的自研电路、接线图、BOM、传感器与计算平台说明。
|
||||||
|
|
||||||
第三方硬件资料不作为自研成果提交。
|
第三方硬件资料不作为自研成果提交。
|
||||||
|
|
||||||
|
当前目录仅有范围说明,尚未归档 16DOF 平台的自研原理图、PCB、BOM 或正式接线图,不应将本目录视为已完成的硬件开源包。
|
||||||
|
|||||||
@@ -3,3 +3,5 @@
|
|||||||
本目录用于保存运行在 MCU 或其他嵌入式控制器上的固件源码和构建工程。
|
本目录用于保存运行在 MCU 或其他嵌入式控制器上的固件源码和构建工程。
|
||||||
|
|
||||||
编译生成的 `.hex`、`.bin`、`.elf`、`.axf` 等文件不进入源码目录,可在需要时作为 Release 附件发布。
|
编译生成的 `.hex`、`.bin`、`.elf`、`.axf` 等文件不进入源码目录,可在需要时作为 Release 附件发布。
|
||||||
|
|
||||||
|
当前 16DOF 主线尚未在本目录归档 MCU/Keil 工程;该目录是预留入口。8DOF 大疆 A 板 Keil 工程由 `8dof` 分支和 `v0.1.0` 保存。
|
||||||
|
|||||||
@@ -11,9 +11,12 @@
|
|||||||
├─ sim2real/ # 第一代 Python 策略真机部署
|
├─ sim2real/ # 第一代 Python 策略真机部署
|
||||||
├─ sim2real_v2/ # Python Sim2Real v2
|
├─ sim2real_v2/ # Python Sim2Real v2
|
||||||
├─ sim2real_ros2/ # ROS 2/C++ Sim2Real 初版
|
├─ sim2real_ros2/ # ROS 2/C++ Sim2Real 初版
|
||||||
└─ sim2real_ros2_v2/ # ROS 2 导航原型及后续演进
|
├─ sim2real_ros2_v2/ # ROS 2 导航原型及里程计演进
|
||||||
|
└─ sim2real_ros2_v3/ # 最终比赛 ROS 2/C++ 部署
|
||||||
```
|
```
|
||||||
|
|
||||||
|
当前工作树按架构大版本同时保留三个 ROS 2 目录:无后缀目录是初版,`_v2` 是第二版演进的最终里程计快照,`_v3` 是 `last_not_slalom_1050` 最终比赛部署。各目录内部的小阶段仍可通过对应 Tag 恢复。
|
||||||
|
|
||||||
## 数据流
|
## 数据流
|
||||||
|
|
||||||
```text
|
```text
|
||||||
@@ -33,7 +36,7 @@ MJCF + mjlab task
|
|||||||
IK real --------------------------------> 电机
|
IK real --------------------------------> 电机
|
||||||
```
|
```
|
||||||
|
|
||||||
`rc_mjlab` 是自包含工程。训练、MJCF、MuJoCo、Sim2Sim、导航工具和策略权重通过相对路径绑定,因此保留其内部布局,没有为了目录外观拆散。第一代完整闭环见 `v0.3.0`,第一份新版 MJCF 与训练框架见 `v0.4.0`,随机化增强版见 `v0.5.0`,比赛最终训练架构见 `v0.6.0`,后期 MuJoCo 工具集见 `v0.7.0`,后期 Sim2Sim 与比赛 Rough 策略见 `v0.8.0`,完整导航打点工具见 `v0.8.1`,Python Sim2Real v2 对应 `v0.9.0`,ROS 2/C++ 初版对应 `v0.10.0`,简单导航原型对应 `v0.11.0`,完整 Odin/TensorRT 与站姿调参对应 `v0.11.1`。
|
`rc_mjlab` 是自包含工程。训练、MJCF、MuJoCo、Sim2Sim、导航工具和策略权重通过相对路径绑定,因此保留其内部布局,没有为了目录外观拆散。第一代完整闭环见 `v0.3.0`,第一份新版 MJCF 与训练框架见 `v0.4.0`,随机化增强版见 `v0.5.0`,比赛最终训练架构见 `v0.6.0`,后期 MuJoCo 工具集见 `v0.7.0`,后期 Sim2Sim 与比赛 Rough 策略见 `v0.8.0`,完整导航打点工具见 `v0.8.1`,Python Sim2Real v2 对应 `v0.9.0`,ROS 2/C++ 初版对应 `v0.10.0`,简单导航原型对应 `v0.11.0`,完整 Odin/TensorRT 与站姿调参对应 `v0.11.1`,纯里程计导航联调对应 `v0.12.0`,1050 分比赛最终部署对应 `v1.0.0`。
|
||||||
|
|
||||||
详细说明见:
|
详细说明见:
|
||||||
|
|
||||||
|
|||||||
@@ -22,21 +22,27 @@
|
|||||||
|
|
||||||
## `sim2real_v2`
|
## `sim2real_v2`
|
||||||
|
|
||||||
Python Sim2Real v2,保留 `53D -> 16D` 策略接口,并增加电机反馈新鲜度、Odin odom 诊断、命令平滑、Web 运行时诊断和安全监控工具。该版本对应重排主线的 `v0.9.0`。
|
Python Sim2Real v2,保留 `53D -> 16D` 策略接口,并增加电机反馈新鲜度、Odin odom 诊断、命令平滑、Web 运行时诊断和安全监控工具,对应 `v0.9.0`。
|
||||||
|
|
||||||
部署说明见 [`sim2real_v2/README.md`](sim2real_v2/README.md) 与 [`sim2real_v2/DEPLOYMENT.md`](sim2real_v2/DEPLOYMENT.md)。
|
部署说明见 [`sim2real_v2/README.md`](sim2real_v2/README.md) 与 [`sim2real_v2/DEPLOYMENT.md`](sim2real_v2/DEPLOYMENT.md)。
|
||||||
|
|
||||||
## `sim2real_ros2`
|
## ROS 2/C++ 版本线
|
||||||
|
|
||||||
ROS 2/C++ Sim2Real 初版,将策略热路径迁移为 50 Hz C++ 推理和 200 Hz CAN 电机循环,并加入 ROS 2 消息、命令仲裁、Nav2 与统一启动结构。该版本对应重排主线的 `v0.10.0`。
|
### `sim2real_ros2`(初版,`v0.10.0`)
|
||||||
|
|
||||||
原始快照没有随工程保存 Odin ROS 2 驱动源码,该依赖边界见 [`sim2real_ros2/README.md`](sim2real_ros2/README.md)。
|
无后缀目录固定表示 ROS 2/C++ Sim2Real 初版:将策略热路径迁移为 50 Hz C++ 推理和 200 Hz CAN 电机循环,并加入 ROS 2 消息、命令仲裁、Nav2 与统一启动结构。原始快照未随工程保存 Odin ROS 2 驱动源码,依赖边界见 [`sim2real_ros2/README.md`](sim2real_ros2/README.md)。
|
||||||
|
|
||||||
## `sim2real_ros2_v2`
|
### `sim2real_ros2_v2`(`v0.11.0`~`v0.12.0`)
|
||||||
|
|
||||||
ROS 2 Sim2Real v2 导航原型,在初版基础上增加简单导航节点、PCD 交互定位、任务点/任务序列和 Web 导航调试。该版本对应重排主线的 `v0.11.0`。
|
在 `v0.11.0` 中,该目录是 ROS 2 Sim2Real v2 导航原型,增加简单导航节点、PCD 交互定位、任务点/任务序列和 Web 导航调试。
|
||||||
|
|
||||||
`v0.11.1` 在同一目录继续演进,首次随工程归档完整 Odin 驱动、TensorRT、多策略切换和硬件诊断,并使用 `hip=0.670`、`knee=-1.390` 的调参站姿。各 Tag 可恢复对应阶段,当前目录说明见 [`sim2real_ros2_v2/README.md`](sim2real_ros2_v2/README.md)。
|
`v0.11.1` 在同一路径继续演进,首次归档完整 Odin 驱动、TensorRT、多策略切换和硬件诊断,并使用 `hip=0.670`、`knee=-1.390` 的调参站姿。
|
||||||
|
|
||||||
|
`v0.12.0` 仍在同一路径上形成里程计导航联调快照:固定纯里程计模式,加入 odom fallback 的 TF 冲突保护、A_min 路线和多地图工具;默认 Rough 策略为 `model_9600`,默认站姿回到比赛站姿。当前该目录保持 `v0.12.0` 快照,阶段说明见 [`sim2real_ros2_v2/README.md`](sim2real_ros2_v2/README.md)。
|
||||||
|
|
||||||
|
### `sim2real_ros2_v3`(最终比赛版;代码快照 `v1.0.0`,规范目录 `v1.1.0`)
|
||||||
|
|
||||||
|
第三版来自原始目录 `sim2real_ros2_v2(last_not_slalom_1050)`,整理时正式命名为 `sim2real_ros2_v3`。它是 1050 分比赛最终部署,包含 `model_6800` Rough、`model_84` Wall、最终路线、完整 Odin 驱动、CAN 和触控屏。部署说明见 [`sim2real_ros2_v3/README.md`](sim2real_ros2_v3/README.md)。
|
||||||
|
|
||||||
## 实机记录
|
## 实机记录
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
# `sim2real` 部署说明
|
# `sim2real` 部署说明
|
||||||
|
|
||||||
|
> 版本范围:第一代 Python Sim2Real(`v0.3.0`)。本文“当前”均指该快照。
|
||||||
|
|
||||||
## 模型
|
## 模型
|
||||||
|
|
||||||
当前只使用:
|
当前只使用:
|
||||||
|
|
||||||
- `sim2real/policies/model_rough.pt`
|
- `policies/model_rough.pt`
|
||||||
|
|
||||||
## 模型契约
|
## 模型契约
|
||||||
|
|
||||||
@@ -38,7 +40,7 @@
|
|||||||
|
|
||||||
## 纯 Python 命令
|
## 纯 Python 命令
|
||||||
|
|
||||||
默认前提:当前目录就是 `sim2real/`
|
默认前提:当前目录是 `05_software/real/sim2real/`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python -m pip install -r requirements-orin.txt
|
python -m pip install -r requirements-orin.txt
|
||||||
|
|||||||
@@ -1,9 +1,11 @@
|
|||||||
# `FACTS_AND_ASSUMPTIONS`
|
# `FACTS_AND_ASSUMPTIONS`
|
||||||
|
|
||||||
|
> 版本范围:第一代 Python Sim2Real(`v0.3.0`)。事实项只适用于该快照。
|
||||||
|
|
||||||
## 已确认
|
## 已确认
|
||||||
|
|
||||||
- 当前部署模型:`sim2real/policies/model_rough.pt`
|
- 当前部署模型:`policies/model_rough.pt`
|
||||||
- 源模型:`model_2000.pt`
|
- 原始说明记录的源模型名:`model_2000.pt`;同名文件未随本目录归档
|
||||||
- actor 输入:`53D`
|
- actor 输入:`53D`
|
||||||
- actor 输出:`16D`
|
- actor 输出:`16D`
|
||||||
- 当前 actor 不吃 `base_lin_vel`
|
- 当前 actor 不吃 `base_lin_vel`
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# `Orin Nano` 部署说明
|
# `Orin Nano` 部署说明
|
||||||
|
|
||||||
|
> 版本范围:第一代 Python Sim2Real(`v0.3.0`)。本文不是最终 ROS 2 v3 部署指南。
|
||||||
|
|
||||||
## 是否必须转 ONNX
|
## 是否必须转 ONNX
|
||||||
|
|
||||||
不必须。
|
不必须。
|
||||||
@@ -26,7 +28,7 @@
|
|||||||
|
|
||||||
## 纯 Python 部署命令
|
## 纯 Python 部署命令
|
||||||
|
|
||||||
默认前提:当前目录就是 `sim2real/`
|
默认前提:当前目录是 `05_software/real/sim2real/`
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python3 -m pip install -r requirements-orin.txt
|
python3 -m pip install -r requirements-orin.txt
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
# `sim2real`
|
# `sim2real`
|
||||||
|
|
||||||
当前版本只部署现在这套 `53D -> 16D` 模型,不再兼容旧版 `crawl`、多策略和历史观测。
|
本目录是第一代 Python Sim2Real 快照,对应 `v0.3.0`。下文“当前”均指该历史快照,不指仓库 `main` 的最终 ROS 2 v3。
|
||||||
|
|
||||||
|
该快照只部署当时的 `53D -> 16D` Rough 模型,不兼容更早的 Crawl、多策略和其他历史观测契约。
|
||||||
|
|
||||||
## 当前部署模型
|
## 当前部署模型
|
||||||
|
|
||||||
- 使用文件:`sim2real/policies/model_rough.pt`
|
- 使用文件:`policies/model_rough.pt`
|
||||||
- 来源文件:`model_2000.pt`
|
- 原始说明记录的来源名:`model_2000.pt`;该同名源文件未随本目录归档,仓库只保留重命名后的 `policies/model_rough.pt`
|
||||||
|
|
||||||
## 当前 actor 输入
|
## 当前 actor 输入
|
||||||
|
|
||||||
@@ -52,7 +54,7 @@
|
|||||||
|
|
||||||
## 启动命令
|
## 启动命令
|
||||||
|
|
||||||
默认前提:当前目录就是 `sim2real/`
|
默认前提:当前目录是 `05_software/real/sim2real/`
|
||||||
|
|
||||||
纯 `python`:
|
纯 `python`:
|
||||||
|
|
||||||
@@ -65,13 +67,12 @@ python main.py
|
|||||||
python web/server.py --host 0.0.0.0 --port 8080
|
python web/server.py --host 0.0.0.0 --port 8080
|
||||||
```
|
```
|
||||||
|
|
||||||
Windows 本机:
|
Windows 本机可使用目标虚拟环境中的 Python;不要依赖个人机器的绝对安装路径:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
D:\Minicoda3\envs\py10\python.exe -m pip install -r requirements-orin.txt
|
python -m pip install -r requirements-orin.txt
|
||||||
D:\Minicoda3\envs\py10\python.exe tools\alignment_check.py --policy policies\model_rough.pt --manifest deployment_manifest.yaml
|
python tools\alignment_check.py --policy policies\model_rough.pt --manifest deployment_manifest.yaml
|
||||||
D:\Minicoda3\envs\py10\python.exe tools\standalone_check.py
|
python tools\standalone_check.py
|
||||||
D:\Minicoda3\envs\py10\python.exe main.py
|
python main.py
|
||||||
D:\Minicoda3\envs\py10\python.exe web\server.py --host 0.0.0.0 --port 8080
|
python web\server.py --host 0.0.0.0 --port 8080
|
||||||
```
|
```
|
||||||
#sim2real/policies/model_rough.pt
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# ROS2 C++ Sim2Real 运动控制栈 - 部署指南
|
# ROS 2/C++ Sim2Real 初版部署指南
|
||||||
|
|
||||||
本工作区提供了一个自包含、独立的 C++ ROS2 Humble 实现,用于在 Jetson Orin 目标机上部署轮腿四足机器人控制策略。
|
本工作区保存 `v0.10.0` 的 ROS 2 Humble/C++ 初版。控制栈主体源码已归档,但 Odin 驱动源码在该快照中缺失,因此不是自包含部署包;完成真实传感器闭环前必须补充兼容驱动。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# ROS 2/C++ Sim2Real 初版
|
# ROS 2/C++ Sim2Real 初版
|
||||||
|
|
||||||
本目录归档 `real/sim2real_ros2`,对应重排主线的 `v0.10.0`。这是轮腿机器人 Sim2Real 部署栈从 Python 运行时迁移到 ROS 2 + C++ 的第一版系统工程。
|
本目录归档 `real/sim2real_ros2`,对应 `v0.10.0`。这是轮腿机器人 Sim2Real 部署栈从 Python 运行时迁移到 ROS 2 + C++ 的第一版系统工程。
|
||||||
|
|
||||||
本工程保留当前 `sim2real` 已验证的部署契约,同时将运行时热路径迁移到 C++:
|
本工程保留当前 `sim2real` 已验证的部署契约,同时将运行时热路径迁移到 C++:
|
||||||
|
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
- `src/sim2real_bringup`
|
- `src/sim2real_bringup`
|
||||||
统一启动文件与运行时参数配置。
|
统一启动文件与运行时参数配置。
|
||||||
- `src/odin_ros_driver`
|
- `src/odin_ros_driver`
|
||||||
Odin 传感器 ROS 2 驱动(含 IMU、点云、里程计发布)。
|
仅保留依赖边界说明;原始 `v0.10.0` 快照没有归档 Odin 驱动源码,不能独立提供 IMU、点云和里程计发布。
|
||||||
- `docs`
|
- `docs`
|
||||||
架构说明与迁移计划。
|
架构说明与迁移计划。
|
||||||
|
|
||||||
@@ -58,11 +58,11 @@ Nav2 / cmd_vel ------------------------------> sim2real_runtime
|
|||||||
|
|
||||||
迁移过程中以下文件被视为真值源:
|
迁移过程中以下文件被视为真值源:
|
||||||
|
|
||||||
- `sim2real/deployment_manifest.yaml`
|
- `../sim2real/deployment_manifest.yaml`
|
||||||
- `sim2real/interface/motor_mapping.py`
|
- `../sim2real/interface/motor_mapping.py`
|
||||||
- `sim2real/interface/real_io.py`
|
- `../sim2real/interface/real_io.py`
|
||||||
- `sim2real/policy/policy_runner.py`
|
- `../sim2real/policy/policy_runner.py`
|
||||||
- `sim2real/web/session.py`
|
- `../sim2real/web/session.py`
|
||||||
|
|
||||||
## 注意事项
|
## 注意事项
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# 迁移计划
|
# 迁移计划
|
||||||
|
|
||||||
|
> 版本范围:ROS 2/C++ 初版(`v0.10.0`)。这是历史迁移记录,不是最终比赛版验收报告;本快照未归档 Odin 驱动源码。
|
||||||
|
|
||||||
## Phase 1: 硬件核心迁移 ✅ 已完成
|
## Phase 1: 硬件核心迁移 ✅ 已完成
|
||||||
|
|
||||||
将当前高频热路径从 Python 迁出。
|
将当前高频热路径从 Python 迁出。
|
||||||
@@ -39,11 +41,7 @@
|
|||||||
|
|
||||||
## Phase 3: ROS 2 系统集成 ✅ 已完成
|
## Phase 3: ROS 2 系统集成 ✅ 已完成
|
||||||
|
|
||||||
参考的源项目:
|
参考过的外部项目包括 Odin ROS 驱动、EDULITE A3 ROS 工程和 RL-SAR;这些外部参考目录不属于本仓库公开内容。
|
||||||
|
|
||||||
- `00_ reference/odin_ros_driver`
|
|
||||||
- `00_ reference/EDULITE_A3/el_a3_ros`
|
|
||||||
- `00_ reference/rl_sar`
|
|
||||||
|
|
||||||
交付物:
|
交付物:
|
||||||
|
|
||||||
@@ -76,5 +74,5 @@
|
|||||||
| 策略运行时 | `sim2real_runtime_node` | 50Hz ONNX 推理 + 53D 观测 + raw_action clip |
|
| 策略运行时 | `sim2real_runtime_node` | 50Hz ONNX 推理 + 53D 观测 + raw_action clip |
|
||||||
| 里程计中继 | `odom_relay_node` | /odin1/odometry → /odom + odom→base_link TF |
|
| 里程计中继 | `odom_relay_node` | /odin1/odometry → /odom + odom→base_link TF |
|
||||||
| 导航栈 | Nav2 全套节点 | AMCL + costmap + DWB + Navfn + BT + lifecycle |
|
| 导航栈 | Nav2 全套节点 | AMCL + costmap + DWB + Navfn + BT + lifecycle |
|
||||||
| 传感器驱动 | `odin_ros_driver` | IMU + 点云 + 里程计原始发布 |
|
| 传感器驱动 | 外部 Odin 驱动 | 本快照未归档源码,不能视为自包含组件 |
|
||||||
| 点云转换 | `pointcloud_to_laserscan` | /odin1/cloud_slam → /scan (供 AMCL 使用) |
|
| 点云转换 | `pointcloud_to_laserscan` | 外部 ROS 包;/odin1/cloud_slam → /scan(供 AMCL 使用) |
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# ROS2 C++ Sim2Real 运动控制栈 - 部署指南
|
# ROS 2/C++ Sim2Real v2 部署指南
|
||||||
|
|
||||||
本工作区提供了一个自包含、独立的 C++ ROS2 Humble 实现,用于在 Jetson Orin 目标机上部署轮腿四足机器人控制策略。
|
本工作区保存 `v0.12.0` 里程计联调快照,包含 ROS 2 Humble/C++ 主体和 Odin 驱动。系统依赖、设备标定和 TensorRT engine 仍与目标机环境绑定,不能仅凭源码声明在新设备上已复现。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ chmod +x start_sim2real.sh
|
|||||||
强烈推荐使用 Docker 隔离依赖,避免 Jetson Orin 上的库版本冲突。
|
强烈推荐使用 Docker 隔离依赖,避免 Jetson Orin 上的库版本冲突。
|
||||||
|
|
||||||
### 步骤 1:构建镜像
|
### 步骤 1:构建镜像
|
||||||
确保在 `sim2real_ros2` 目录中(包含 `Dockerfile`):
|
确保在 `sim2real_ros2_v2` 目录中(包含 `Dockerfile`):
|
||||||
```bash
|
```bash
|
||||||
# 使用标准 docker build:
|
# 使用标准 docker build:
|
||||||
docker build -t sim2real_ros2:latest .
|
docker build -t sim2real_ros2:latest .
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# ROS 2 Sim2Real v2:Odin、TensorRT 与站姿调参
|
# ROS 2 Sim2Real v2:里程计导航联调
|
||||||
|
|
||||||
本目录在 `v0.11.0` 导航原型基础上归档 `real/sim2real_ros2_v2(z=0.380 hip=0.670 knee=-1.390)`,对应重排主线的 `v0.11.1`。虽然源目录以站姿参数命名,但该阶段同时首次完整加入 Odin 驱动、TensorRT、多策略切换、事件日志和更完整的硬件诊断。
|
本目录归档原始 `real/sim2real_ros2_v2(odom)`,对应 `v0.12.0`。该阶段在 `v0.11.1` 的 Odin/TensorRT 与站姿调参基础上,固定纯里程计模式,增加 odom fallback 的 TF 冲突保护、A_min 路线和地图工具。
|
||||||
|
|
||||||
本工程保留当前 `sim2real` 已验证的部署契约,同时将运行时热路径迁移到 C++:
|
本工程保留当前 `sim2real` 已验证的部署契约,同时将运行时热路径迁移到 C++:
|
||||||
|
|
||||||
@@ -70,8 +70,7 @@ Nav2 / cmd_vel ------------------------------> sim2real_runtime
|
|||||||
- Windows 仅作为编辑环境使用。
|
- Windows 仅作为编辑环境使用。
|
||||||
- 观测顺序、动作缩放、默认站姿、电机映射不得独立修改,
|
- 观测顺序、动作缩放、默认站姿、电机映射不得独立修改,
|
||||||
除非训练与部署同步更新。
|
除非训练与部署同步更新。
|
||||||
- Rough 默认策略为 `NEWmodel_1900`,优先使用比赛机生成的 TensorRT engine;Crawl 保留 ONNX,但运行配置使用 IK 后端。
|
- 默认 Rough 策略为 `model_9600`,默认站姿回到比赛站姿髋俯仰 `0.550`、膝关节 `-1.125`。
|
||||||
- 默认 Rough 站姿为髋俯仰 `0.670`、膝关节 `-1.390`,源目录名中的 `z=0.380` 记录该阶段的机身高度配置意图。
|
- Odin `custom_map_mode` 固定为 `0`(纯里程计),避免没有 `map_a.bin` 时产生 map/odom TF 冲突。
|
||||||
- `map_b.pcd` 已确定性抽样到 10 MB 以下,点数和哈希见 [`map/README.md`](map/README.md)。
|
- `A_min.pcd`、`C.pcd` 和 `map_b.pcd` 均为确定性抽样预览,点数和哈希见 [`map/README.md`](map/README.md)。
|
||||||
- TensorRT engine 与 JetPack、TensorRT 版本及 GPU 架构有关,其他机器应从 ONNX 重新生成。
|
- TensorRT engine 与 JetPack、TensorRT 版本及 GPU 架构有关,其他机器应从 ONNX 重新生成。
|
||||||
- 源配置引用的 Odin `map_a.bin` 不在该备份中;使用 Relocalization 前必须从设备或建图备份补回真实文件并填写绝对路径,缺失时只能验证软件链路或使用后续 odom 配置。
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# sim2real_ros2 架构说明
|
# sim2real_ros2_v2 架构说明
|
||||||
|
|
||||||
## 设计目标
|
## 设计目标
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
# 迁移计划
|
# 迁移计划
|
||||||
|
|
||||||
|
> 版本范围:ROS 2 v2 里程计联调快照(`v0.12.0`)。完成标记表示该快照中的代码迁移状态,不等于已在任意新硬件环境复现。
|
||||||
|
|
||||||
## Phase 1: 硬件核心迁移 ✅ 已完成
|
## Phase 1: 硬件核心迁移 ✅ 已完成
|
||||||
|
|
||||||
将当前高频热路径从 Python 迁出。
|
将当前高频热路径从 Python 迁出。
|
||||||
@@ -39,11 +41,7 @@
|
|||||||
|
|
||||||
## Phase 3: ROS 2 系统集成 ✅ 已完成
|
## Phase 3: ROS 2 系统集成 ✅ 已完成
|
||||||
|
|
||||||
参考的源项目:
|
参考过的外部项目包括 Odin ROS 驱动、EDULITE A3 ROS 工程和 RL-SAR;外部参考目录不属于本仓库公开内容。
|
||||||
|
|
||||||
- `00_ reference/odin_ros_driver`
|
|
||||||
- `00_ reference/EDULITE_A3/el_a3_ros`
|
|
||||||
- `00_ reference/rl_sar`
|
|
||||||
|
|
||||||
交付物:
|
交付物:
|
||||||
|
|
||||||
@@ -77,4 +75,4 @@
|
|||||||
| 里程计中继 | `odom_relay_node` | /odin1/odometry → /odom + odom→base_link TF |
|
| 里程计中继 | `odom_relay_node` | /odin1/odometry → /odom + odom→base_link TF |
|
||||||
| 导航栈 | Nav2 全套节点 | AMCL + costmap + DWB + Navfn + BT + lifecycle |
|
| 导航栈 | Nav2 全套节点 | AMCL + costmap + DWB + Navfn + BT + lifecycle |
|
||||||
| 传感器驱动 | `odin_ros_driver` | IMU + 点云 + 里程计原始发布 |
|
| 传感器驱动 | `odin_ros_driver` | IMU + 点云 + 里程计原始发布 |
|
||||||
| 点云转换 | `pointcloud_to_laserscan` | /odin1/cloud_slam → /scan (供 AMCL 使用) |
|
| 点云转换 | `pointcloud_to_laserscan` | 外部 ROS 包;/odin1/cloud_slam → /scan(供 AMCL 使用) |
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# sim2real_ros2 遥控器调用说明
|
# sim2real_ros2_v2 遥控器调用说明
|
||||||
|
|
||||||
本文档说明如何在 `sim2real_ros2` 中调用已接入的 SBUS UART 遥控器节点,以及执行后系统会产生什么效果。
|
本文档说明如何在 `sim2real_ros2_v2` 中调用已接入的 SBUS UART 遥控器节点,以及执行后系统会产生什么效果。
|
||||||
|
|
||||||
## 1. 当前接入关系
|
## 1. 当前接入关系
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# sim2real_ros2 Web UDP 调试说明
|
# sim2real_ros2_v2 Web UDP 调试说明
|
||||||
|
|
||||||
本文档说明本次新增的最小 Web 调试链路。
|
本文档说明本次新增的最小 Web 调试链路。
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,11 @@
|
|||||||
# `v0.11.1` 导航点云
|
# `v0.12.0` 里程计导航点云
|
||||||
|
|
||||||
原始 `map_b.pcd` 为 ASCII PCD,共 1,080,047 点、34,720,771 字节。为避免大文件进入 Git 历史,使用 `tools/nav_tools/downsample_ascii_pcd.py` 以步长 4 做确定性抽样。
|
本阶段使用三份 ASCII PCD 进行路线和里程计导航联调。原始文件均使用 `tools/nav_tools/downsample_ascii_pcd.py` 确定性等步长抽样,抽样文件仅用于可视化、路线编辑和软件回归,不等价于原始高密度地图。
|
||||||
|
|
||||||
- 抽样点数:270,012
|
| 文件 | 原始点数 | 步长 | 抽样点数 | 抽样大小 | 原始 SHA-256 | 抽样 SHA-256 |
|
||||||
- 抽样大小:8,680,283 字节
|
| --- | ---: | ---: | ---: | ---: | --- | --- |
|
||||||
- 原始 SHA-256:`F17FC7E188C772D48E8D3FE20E3A934AFCDF59357C27BCCDCAC3C7E9AD1D1CB7`
|
| `map_b.pcd` | 1,080,047 | 4 | 270,012 | 8,680,283 B | `F17FC7E188C772D48E8D3FE20E3A934AFCDF59357C27BCCDCAC3C7E9AD1D1CB7` | `F3052431F217DE8FFFE87726F8E547A59C65048B0285F02AF4803C5F4E4C1B42` |
|
||||||
- 抽样 SHA-256:`F3052431F217DE8FFFE87726F8E547A59C65048B0285F02AF4803C5F4E4C1B42`
|
| `A_min.pcd` | 683,908 | 3 | 227,969 | 7,300,173 B | `77C884B17D78C4D157F84093BFEA0729FA25382C70E706C4BA12913A3C90ED20` | `CC4556D472BE6E5B232B9BFEE43F5F337D710F88E88D9B90994368C580327DC1` |
|
||||||
|
| `C.pcd` | 3,186,653 | 11 | 289,696 | 9,040,786 B | `C5C7E60B06A0FFEA15E55C14B8CFAFBC8525371C8C3AC9C72821AB736AED8A6C` | `1FC4124642D934460811DBF62EBE9C5C9CF30668BC42E4782B18F3C002ED1A25` |
|
||||||
|
|
||||||
抽样文件适合路线编辑和代码演示,不等价于原始高密度点云;需要复现实机导航精度时应恢复原始 PCD 并核对哈希。
|
大小和 SHA-256 均按 Git 中保存的字节计算;根目录 `.gitattributes` 禁止对 `*.pcd` 做跨平台换行转换。
|
||||||
|
|||||||
@@ -0,0 +1,276 @@
|
|||||||
|
{
|
||||||
|
"name": "A_min_route",
|
||||||
|
"map": "A_min",
|
||||||
|
"frame_id": "map",
|
||||||
|
"createdAt": "2026-07-04T00:40:56",
|
||||||
|
"segments": [
|
||||||
|
{
|
||||||
|
"name": "segment_1",
|
||||||
|
"obstacle": "slalom",
|
||||||
|
"waypoints": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"x": 9.3549,
|
||||||
|
"y": 0.9079,
|
||||||
|
"yawDeg": 0.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"x": 11.1136,
|
||||||
|
"y": 0.8621,
|
||||||
|
"yawDeg": 0.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"x": 13.0,
|
||||||
|
"y": 0.75,
|
||||||
|
"yawDeg": 88.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"x": 12.9102,
|
||||||
|
"y": 2.611,
|
||||||
|
"yawDeg": 90.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"x": 12.9102,
|
||||||
|
"y": 4.88,
|
||||||
|
"yawDeg": 190.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"x": 11.94,
|
||||||
|
"y": 4.6203,
|
||||||
|
"yawDeg": 178.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 7,
|
||||||
|
"x": 10.65,
|
||||||
|
"y": 4.65,
|
||||||
|
"yawDeg": 178.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 8,
|
||||||
|
"x": 9.3997,
|
||||||
|
"y": 4.649,
|
||||||
|
"yawDeg": -95.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 9,
|
||||||
|
"x": 9.3092,
|
||||||
|
"y": 3.8864,
|
||||||
|
"yawDeg": 180.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 10,
|
||||||
|
"x": 7.9263,
|
||||||
|
"y": 4.0028,
|
||||||
|
"yawDeg": 150.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 11,
|
||||||
|
"x": 6.8148,
|
||||||
|
"y": 4.6619,
|
||||||
|
"yawDeg": 170.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 12,
|
||||||
|
"x": 5.0054,
|
||||||
|
"y": 5.0,
|
||||||
|
"yawDeg": 180.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 13,
|
||||||
|
"x": 3.2994,
|
||||||
|
"y": 5.04,
|
||||||
|
"yawDeg": 185.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "crawl",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 14,
|
||||||
|
"x": 1.8838,
|
||||||
|
"y": 4.8455,
|
||||||
|
"yawDeg": 190.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 15,
|
||||||
|
"x": 1.06,
|
||||||
|
"y": 4.45,
|
||||||
|
"yawDeg": 270.0,
|
||||||
|
"speed": 0.35,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 16,
|
||||||
|
"x": 1.0561,
|
||||||
|
"y": 3.9,
|
||||||
|
"yawDeg": -90.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 17,
|
||||||
|
"x": 1.04,
|
||||||
|
"y": 2.79,
|
||||||
|
"yawDeg": 0.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 18,
|
||||||
|
"x": 1.552,
|
||||||
|
"y": 2.77,
|
||||||
|
"yawDeg": -90.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 19,
|
||||||
|
"x": 1.519,
|
||||||
|
"y": 1.6677,
|
||||||
|
"yawDeg": 180.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 20,
|
||||||
|
"x": 0.4708,
|
||||||
|
"y": 1.6677,
|
||||||
|
"yawDeg": -90.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 21,
|
||||||
|
"x": 0.4552,
|
||||||
|
"y": 0.5,
|
||||||
|
"yawDeg": 0.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 22,
|
||||||
|
"x": 1.2783,
|
||||||
|
"y": 0.5,
|
||||||
|
"yawDeg": 90.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 23,
|
||||||
|
"x": 1.2628,
|
||||||
|
"y": 1.6211,
|
||||||
|
"yawDeg": 0.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 24,
|
||||||
|
"x": 2.3576,
|
||||||
|
"y": 1.5978,
|
||||||
|
"yawDeg": -90.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 25,
|
||||||
|
"x": 2.3265,
|
||||||
|
"y": 0.5,
|
||||||
|
"yawDeg": 0.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 26,
|
||||||
|
"x": 3.12,
|
||||||
|
"y": 0.5,
|
||||||
|
"yawDeg": 45.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 27,
|
||||||
|
"x": 3.8639,
|
||||||
|
"y": 0.9844,
|
||||||
|
"yawDeg": 0.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 28,
|
||||||
|
"x": 6.8222,
|
||||||
|
"y": 0.9145,
|
||||||
|
"yawDeg": 0.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 29,
|
||||||
|
"x": 9.5321,
|
||||||
|
"y": 0.9223,
|
||||||
|
"yawDeg": 0.0,
|
||||||
|
"speed": 0.7,
|
||||||
|
"policy": "rough",
|
||||||
|
"tolerance": 0.15
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"yawToleranceDegDefault": 30.0
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,12 +1,12 @@
|
|||||||
# `v0.11.1` 策略文件
|
# `v0.12.0` 策略文件
|
||||||
|
|
||||||
本阶段只归档运行配置引用或作为部署契约基线的策略,未纳入其余候选 checkpoint 和 engine。
|
本阶段运行配置使用 `model_9600` 作为 Rough 策略,并保留 Crawl ONNX 和部署契约参考模型。
|
||||||
|
|
||||||
| 文件 | 用途 | SHA-256 |
|
| 文件 | 用途 |
|
||||||
| --- | --- | --- |
|
| --- | --- |
|
||||||
| `NEWmodel_1900.onnx` | Rough 默认 ONNX | `A9E2F0D117225874C8B4F986787C3E6C8E7EA45D1CDA3AED58AC38F581442B00` |
|
| `model_9600.onnx` | 里程计版本 Rough ONNX |
|
||||||
| `NEWmodel_1900_fp16.engine` | Rough 比赛机 TensorRT | `DBC73AC9B3780029EC08BE19B9972B9840A067EBD146DEB860698F4F7066CC03` |
|
| `model_9600_fp16.engine` | 里程计版本 Rough TensorRT |
|
||||||
| `model_crawl.onnx` | Crawl 策略候选;当前配置使用 IK 后端 | `633AB2F3C3737FDDFD657F4A006A414BFA3950DD60D708B101E6744DF9E6DF67` |
|
| `model_crawl.onnx` | Crawl 候选;当前配置使用 IK 后端 |
|
||||||
| `model_rough.onnx` | 原部署契约参考基线 | `4149BE180A197E70495A7A6D186C62BE43271A4CE9035A8EEE56CD293D869A27` |
|
| `model_rough.onnx` | 原部署契约参考基线 |
|
||||||
|
|
||||||
TensorRT engine 不保证跨 JetPack、TensorRT 版本或 GPU 架构兼容。
|
其余 `model_6800`、`model_8400`、`model_10200` 等候选策略属于相邻实验或后续比赛版本,不在本 Tag 重复归档。
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -90,9 +90,9 @@ register_keys:
|
|||||||
showpath: 0 # 0: off; 1: on
|
showpath: 0 # 0: off; 1: on
|
||||||
showcamerapose: 0 # 0: off; 1: on
|
showcamerapose: 0 # 0: off; 1: on
|
||||||
|
|
||||||
custom_map_mode: 2 # 0: Odometry mode 1: SLAM mode 2: Relocalization mode
|
custom_map_mode: 0 # 0: Odometry mode 1: SLAM mode 2: Relocalization mode. Keep 0 for pure odom fallback to avoid Odin map/odom TF conflicts.
|
||||||
custom_init_pos: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
|
custom_init_pos: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
|
||||||
relocalization_map_abs_path: "/absolute/path/to/map_a.bin" # supply the external Odin map before using Relocalization mode
|
relocalization_map_abs_path: "/absolute/path/to/map_a.bin" # unused in pure odometry mode; edit before Relocalization
|
||||||
|
|
||||||
# To get the mapping result file, please use the set_param.sh script provided: "./set_param.sh save_map 1"
|
# To get the mapping result file, please use the set_param.sh script provided: "./set_param.sh save_map 1"
|
||||||
mapping_result_dest_dir: "" # "": if not specified, save to default location of {ws}/src/odin_ros_driver/map/{driver_start_time}/
|
mapping_result_dest_dir: "" # "": if not specified, save to default location of {ws}/src/odin_ros_driver/map/{driver_start_time}/
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@ action:
|
|||||||
- rr_wheel
|
- rr_wheel
|
||||||
wheel_indices: [12, 13, 14, 15]
|
wheel_indices: [12, 13, 14, 15]
|
||||||
scale: [0.125, 0.25, 0.25, 0.125, 0.25, 0.25, 0.125, 0.25, 0.25, 0.125, 0.25, 0.25, 5.0, 5.0, 5.0, 5.0]
|
scale: [0.125, 0.25, 0.25, 0.125, 0.25, 0.25, 0.125, 0.25, 0.25, 0.125, 0.25, 0.25, 5.0, 5.0, 5.0, 5.0]
|
||||||
default_dof_pos: [0.0, 0.670, -1.390, 0.0, 0.670, -1.390, 0.0, 0.670, -1.390, 0.0, 0.670, -1.390, 0.0, 0.0, 0.0, 0.0]
|
default_dof_pos: [0.0, 0.550, -1.125, 0.0, 0.550, -1.125, 0.0, 0.550, -1.125, 0.0, 0.550, -1.125, 0.0, 0.0, 0.0, 0.0]
|
||||||
|
|
||||||
motor_mapping:
|
motor_mapping:
|
||||||
can_id_map:
|
can_id_map:
|
||||||
|
|||||||
@@ -5,13 +5,13 @@
|
|||||||
status_hz: 10.0
|
status_hz: 10.0
|
||||||
target_timeout_ms: 150.0
|
target_timeout_ms: 150.0
|
||||||
event_log_dir: "logs_v2_web"
|
event_log_dir: "logs_v2_web"
|
||||||
model_engine_path: policies/NEWmodel_1900_fp16.engine
|
model_engine_path: policies/model_9600_fp16.engine
|
||||||
prefer_tensorrt: true
|
prefer_tensorrt: true
|
||||||
model_path: policies/NEWmodel_1900.onnx
|
model_path: policies/model_9600.onnx
|
||||||
rough_model_engine_path: policies/NEWmodel_1900_fp16.engine
|
rough_model_engine_path: policies/model_9600_fp16.engine
|
||||||
crawl_model_path: policies/model_crawl.onnx
|
crawl_model_path: policies/model_crawl.onnx
|
||||||
crawl_model_engine_path: ""
|
crawl_model_engine_path: ""
|
||||||
rough_default_dof_pos: [0.0, 0.670, -1.390, 0.0, 0.670, -1.390, 0.0, 0.670, -1.390, 0.0, 0.670, -1.390, 0.0, 0.0, 0.0, 0.0]
|
rough_default_dof_pos: [0.0, 0.550, -1.125, 0.0, 0.550, -1.125, 0.0, 0.550, -1.125, 0.0, 0.550, -1.125, 0.0, 0.0, 0.0, 0.0]
|
||||||
crawl_backend: "ik"
|
crawl_backend: "ik"
|
||||||
crawl_default_dof_pos: [0.2, 1.697, -2.650, -0.2, 1.697, -2.650, 0.2, 1.697, -2.650, -0.2, 1.697, -2.650, 0.0, 0.0, 0.0, 0.0]
|
crawl_default_dof_pos: [0.2, 1.697, -2.650, -0.2, 1.697, -2.650, 0.2, 1.697, -2.650, -0.2, 1.697, -2.650, 0.0, 0.0, 0.0, 0.0]
|
||||||
crawl_ik_wheel_linear_gain: 6.25
|
crawl_ik_wheel_linear_gain: 6.25
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
remote_axis_deadzone: 40
|
remote_axis_deadzone: 40
|
||||||
remote_active_threshold: 40
|
remote_active_threshold: 40
|
||||||
remote_axis_full_scale: 660.0
|
remote_axis_full_scale: 660.0
|
||||||
remote_max_vx: 0.8
|
remote_max_vx: 0.85
|
||||||
remote_max_vy: 0.3
|
remote_max_vy: 0.3
|
||||||
remote_max_yaw_rate: 0.5
|
remote_max_yaw_rate: 0.5
|
||||||
remote_invert_vx: true
|
remote_invert_vx: true
|
||||||
@@ -136,6 +136,7 @@
|
|||||||
|
|
||||||
# Simple navigation parameters
|
# Simple navigation parameters
|
||||||
nav_map_frame: "map"
|
nav_map_frame: "map"
|
||||||
|
nav_odom_frame: "odom"
|
||||||
nav_base_frame: "base_link"
|
nav_base_frame: "base_link"
|
||||||
nav_control_hz: 20.0
|
nav_control_hz: 20.0
|
||||||
nav_goal_tolerance: 0.20
|
nav_goal_tolerance: 0.20
|
||||||
@@ -173,13 +174,22 @@
|
|||||||
# Keep the legacy YAML route for reference; active task is selected by nav_route_task_file below.
|
# Keep the legacy YAML route for reference; active task is selected by nav_route_task_file below.
|
||||||
nav_route_file: src/sim2real_nav2/config/maps/a_min/test_route.yaml
|
nav_route_file: src/sim2real_nav2/config/maps/a_min/test_route.yaml
|
||||||
# Task switch entry: change this path to another .json/.yaml route file, then relaunch or reload the nav nodes.
|
# Task switch entry: change this path to another .json/.yaml route file, then relaunch or reload the nav nodes.
|
||||||
nav_route_task_file: tools/test_route.json
|
# The web "odom" button uses the first waypoint of this route as the fixed odom fallback start pose.
|
||||||
|
nav_route_task_file: map/routes/A_min/A_min_route.json
|
||||||
nav_route_auto_align_enabled: false
|
nav_route_auto_align_enabled: false
|
||||||
nav_route_rotation_offset_deg: 0.0
|
nav_route_rotation_offset_deg: 0.0
|
||||||
nav_route_align_max_angle_deg: 6.0
|
nav_route_align_max_angle_deg: 6.0
|
||||||
nav_route_align_angle_step_deg: 0.5
|
nav_route_align_angle_step_deg: 0.5
|
||||||
nav_route_align_search_radius: 0.35
|
nav_route_align_search_radius: 0.35
|
||||||
pcd_nav_file: map/map_b.pcd
|
odom_fallback_require_odom_fresh: true
|
||||||
|
odom_fallback_max_odom_age_ms: 500.0
|
||||||
|
odom_fallback_block_existing_map_odom_tf: true
|
||||||
|
odom_fallback_tf_conflict_window_s: 1.0
|
||||||
|
odom_fallback_tf_conflict_xy_tolerance: 0.05
|
||||||
|
odom_fallback_tf_conflict_yaw_tolerance_deg: 2.0
|
||||||
|
# Keep odom fallback running if Odin relocalizes mid-task; hand off after mission end or Exit odom.
|
||||||
|
odom_fallback_stop_on_external_tf: false
|
||||||
|
pcd_nav_file: map/A_min.pcd
|
||||||
pcd_floor_z_min: -1.6
|
pcd_floor_z_min: -1.6
|
||||||
pcd_floor_z_max: 0.4
|
pcd_floor_z_max: 0.4
|
||||||
pcd_sample_step: 25
|
pcd_sample_step: 25
|
||||||
|
|||||||
+4
-4
@@ -64,10 +64,10 @@ struct DeploymentContract
|
|||||||
};
|
};
|
||||||
|
|
||||||
static constexpr std::array<float, 16> kDefaultDofPos = {
|
static constexpr std::array<float, 16> kDefaultDofPos = {
|
||||||
0.0f, 0.670f, -1.390f,
|
0.0f, 0.550f, -1.125f,
|
||||||
0.0f, 0.670f, -1.390f,
|
0.0f, 0.550f, -1.125f,
|
||||||
0.0f, 0.670f, -1.390f,
|
0.0f, 0.550f, -1.125f,
|
||||||
0.0f, 0.670f, -1.390f,
|
0.0f, 0.550f, -1.125f,
|
||||||
0.0f, 0.0f, 0.0f, 0.0f
|
0.0f, 0.0f, 0.0f, 0.0f
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
+2
-1
@@ -124,7 +124,8 @@ private:
|
|||||||
bool readCanFrame(int fd, void* frame, int timeout_us);
|
bool readCanFrame(int fd, void* frame, int timeout_us);
|
||||||
|
|
||||||
bool enableMotor(int fd, int motor_id);
|
bool enableMotor(int fd, int motor_id);
|
||||||
bool disableMotor(int fd, int motor_id);
|
bool disableMotor(int fd, int motor_id, bool clear_fault = false);
|
||||||
|
bool writeParameterInt(int fd, int motor_id, std::uint16_t param_id, std::uint32_t value);
|
||||||
bool setModeRaw(int fd, int motor_id, std::int8_t mode);
|
bool setModeRaw(int fd, int motor_id, std::int8_t mode);
|
||||||
bool readParameter(int fd, int motor_id, std::uint16_t param_id);
|
bool readParameter(int fd, int motor_id, std::uint16_t param_id);
|
||||||
bool writeLimit(int fd, int motor_id, std::uint16_t param_id, float limit);
|
bool writeLimit(int fd, int motor_id, std::uint16_t param_id, float limit);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const std::uint32_t COMM_SET_ZERO_POSITION = 6;
|
|||||||
const std::uint16_t PARAM_MODE = 0x7005;
|
const std::uint16_t PARAM_MODE = 0x7005;
|
||||||
const std::uint16_t PARAM_VELOCITY_LIMIT = 0x7017;
|
const std::uint16_t PARAM_VELOCITY_LIMIT = 0x7017;
|
||||||
const std::uint16_t PARAM_TORQUE_LIMIT = 0x700B;
|
const std::uint16_t PARAM_TORQUE_LIMIT = 0x700B;
|
||||||
const std::uint16_t PARAM_CAN_TIMEOUT = 0x200C;
|
const std::uint16_t PARAM_CAN_TIMEOUT = 0x7028;
|
||||||
const std::uint16_t PARAM_VBUS = 0x3007;
|
const std::uint16_t PARAM_VBUS = 0x3007;
|
||||||
const std::uint16_t PARAM_DRV_FAULT = 0x3022;
|
const std::uint16_t PARAM_DRV_FAULT = 0x3022;
|
||||||
const std::uint16_t PARAM_DRV_FAULT_DETAIL_1 = 0x3024;
|
const std::uint16_t PARAM_DRV_FAULT_DETAIL_1 = 0x3024;
|
||||||
@@ -852,10 +852,21 @@ bool HardwareBridgeNode::startMotorRecoverySequence(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool step_ok = true;
|
bool step_ok = true;
|
||||||
step_ok = enableMotor(fd, motors_[index].id) && step_ok;
|
logMotorPowerEvent(index, "reset_before_enable",
|
||||||
|
"trigger=" + trigger + ", recovery_attempt=" + std::to_string(attempt_number));
|
||||||
|
step_ok = disableMotor(fd, motors_[index].id, true) && step_ok;
|
||||||
|
state.fault_code = 0;
|
||||||
|
state.fault_detail_1 = 0;
|
||||||
|
state.fault_detail_2 = 0;
|
||||||
|
state.fault_code_reported = false;
|
||||||
|
std::this_thread::sleep_for(30ms);
|
||||||
step_ok = setModeRaw(fd, motors_[index].id, 0) && step_ok;
|
step_ok = setModeRaw(fd, motors_[index].id, 0) && step_ok;
|
||||||
|
std::this_thread::sleep_for(30ms);
|
||||||
|
step_ok = enableMotor(fd, motors_[index].id) && step_ok;
|
||||||
|
std::this_thread::sleep_for(20ms);
|
||||||
step_ok = writeLimit(fd, motors_[index].id, PARAM_VELOCITY_LIMIT, 20.0f) && step_ok;
|
step_ok = writeLimit(fd, motors_[index].id, PARAM_VELOCITY_LIMIT, 20.0f) && step_ok;
|
||||||
step_ok = writeLimit(fd, motors_[index].id, PARAM_TORQUE_LIMIT, 17.0f) && step_ok;
|
step_ok = writeLimit(fd, motors_[index].id, PARAM_TORQUE_LIMIT, 17.0f) && step_ok;
|
||||||
|
step_ok = writeParameterInt(fd, motors_[index].id, PARAM_CAN_TIMEOUT, 0) && step_ok;
|
||||||
|
|
||||||
if (!step_ok) {
|
if (!step_ok) {
|
||||||
logMotorDiagnosticEvent(index, "motor_init_retry",
|
logMotorDiagnosticEvent(index, "motor_init_retry",
|
||||||
@@ -979,10 +990,21 @@ bool HardwareBridgeNode::initializeMotor(std::size_t index, const std::string &
|
|||||||
for (int attempt = 1; attempt <= max_attempts; ++attempt) {
|
for (int attempt = 1; attempt <= max_attempts; ++attempt) {
|
||||||
state.init_attempt_count++;
|
state.init_attempt_count++;
|
||||||
bool step_ok = true;
|
bool step_ok = true;
|
||||||
step_ok = enableMotor(fd, motors_[index].id) && step_ok;
|
logMotorPowerEvent(index, "reset_before_enable",
|
||||||
|
"reason=" + reason + ", attempt=" + std::to_string(attempt));
|
||||||
|
step_ok = disableMotor(fd, motors_[index].id, true) && step_ok;
|
||||||
|
state.fault_code = 0;
|
||||||
|
state.fault_detail_1 = 0;
|
||||||
|
state.fault_detail_2 = 0;
|
||||||
|
state.fault_code_reported = false;
|
||||||
|
std::this_thread::sleep_for(30ms);
|
||||||
step_ok = setModeRaw(fd, motors_[index].id, 0) && step_ok;
|
step_ok = setModeRaw(fd, motors_[index].id, 0) && step_ok;
|
||||||
|
std::this_thread::sleep_for(30ms);
|
||||||
|
step_ok = enableMotor(fd, motors_[index].id) && step_ok;
|
||||||
|
std::this_thread::sleep_for(20ms);
|
||||||
step_ok = writeLimit(fd, motors_[index].id, PARAM_VELOCITY_LIMIT, 20.0f) && step_ok;
|
step_ok = writeLimit(fd, motors_[index].id, PARAM_VELOCITY_LIMIT, 20.0f) && step_ok;
|
||||||
step_ok = writeLimit(fd, motors_[index].id, PARAM_TORQUE_LIMIT, 17.0f) && step_ok;
|
step_ok = writeLimit(fd, motors_[index].id, PARAM_TORQUE_LIMIT, 17.0f) && step_ok;
|
||||||
|
step_ok = writeParameterInt(fd, motors_[index].id, PARAM_CAN_TIMEOUT, 0) && step_ok;
|
||||||
|
|
||||||
if (step_ok) {
|
if (step_ok) {
|
||||||
success = waitForMotorFeedback(index, std::chrono::milliseconds(kMotorInitConfirmTimeoutMs));
|
success = waitForMotorFeedback(index, std::chrono::milliseconds(kMotorInitConfirmTimeoutMs));
|
||||||
@@ -1766,13 +1788,15 @@ void HardwareBridgeNode::onWriteLoop()
|
|||||||
bool HardwareBridgeNode::enableMotor(int fd, int motor_id)
|
bool HardwareBridgeNode::enableMotor(int fd, int motor_id)
|
||||||
{
|
{
|
||||||
std::uint32_t ext_id = (COMM_ENABLE << 24) | (HOST_ID << 8) | motor_id;
|
std::uint32_t ext_id = (COMM_ENABLE << 24) | (HOST_ID << 8) | motor_id;
|
||||||
return sendCanFrame(fd, ext_id, nullptr, 0);
|
std::uint8_t data[8] = {0};
|
||||||
|
return sendCanFrame(fd, ext_id, data, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HardwareBridgeNode::disableMotor(int fd, int motor_id)
|
bool HardwareBridgeNode::disableMotor(int fd, int motor_id, bool clear_fault)
|
||||||
{
|
{
|
||||||
std::uint32_t ext_id = (COMM_DISABLE << 24) | (HOST_ID << 8) | motor_id;
|
std::uint32_t ext_id = (COMM_DISABLE << 24) | (HOST_ID << 8) | motor_id;
|
||||||
std::uint8_t data[8] = {0};
|
std::uint8_t data[8] = {0};
|
||||||
|
data[0] = clear_fault ? 1 : 0;
|
||||||
return sendCanFrame(fd, ext_id, data, 8);
|
return sendCanFrame(fd, ext_id, data, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1787,12 +1811,7 @@ bool HardwareBridgeNode::readParameter(int fd, int motor_id, std::uint16_t param
|
|||||||
|
|
||||||
bool HardwareBridgeNode::setModeRaw(int fd, int motor_id, std::int8_t mode)
|
bool HardwareBridgeNode::setModeRaw(int fd, int motor_id, std::int8_t mode)
|
||||||
{
|
{
|
||||||
std::uint32_t ext_id = (COMM_WRITE_PARAMETER << 24) | (HOST_ID << 8) | motor_id;
|
return writeParameterInt(fd, motor_id, PARAM_MODE, static_cast<std::uint8_t>(mode));
|
||||||
std::uint8_t data[8] = {0};
|
|
||||||
data[0] = PARAM_MODE & 0xFF;
|
|
||||||
data[1] = (PARAM_MODE >> 8) & 0xFF;
|
|
||||||
data[4] = static_cast<std::uint8_t>(mode);
|
|
||||||
return sendCanFrame(fd, ext_id, data, 8);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool HardwareBridgeNode::writeLimit(int fd, int motor_id, std::uint16_t param_id, float limit)
|
bool HardwareBridgeNode::writeLimit(int fd, int motor_id, std::uint16_t param_id, float limit)
|
||||||
@@ -1805,6 +1824,16 @@ bool HardwareBridgeNode::writeLimit(int fd, int motor_id, std::uint16_t param_id
|
|||||||
return sendCanFrame(fd, ext_id, data, 8);
|
return sendCanFrame(fd, ext_id, data, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool HardwareBridgeNode::writeParameterInt(int fd, int motor_id, std::uint16_t param_id, std::uint32_t value)
|
||||||
|
{
|
||||||
|
std::uint32_t ext_id = (COMM_WRITE_PARAMETER << 24) | (HOST_ID << 8) | motor_id;
|
||||||
|
std::uint8_t data[8] = {0};
|
||||||
|
data[0] = param_id & 0xFF;
|
||||||
|
data[1] = (param_id >> 8) & 0xFF;
|
||||||
|
std::memcpy(&data[4], &value, sizeof(std::uint32_t));
|
||||||
|
return sendCanFrame(fd, ext_id, data, 8);
|
||||||
|
}
|
||||||
|
|
||||||
bool HardwareBridgeNode::writeOperationFrame(int fd, int motor_id, double pos, double vel, double kp_val, double kd_val, double torque)
|
bool HardwareBridgeNode::writeOperationFrame(int fd, int motor_id, double pos, double vel, double kp_val, double kd_val, double torque)
|
||||||
{
|
{
|
||||||
const double P_LIMIT = 4.0 * M_PI;
|
const double P_LIMIT = 4.0 * M_PI;
|
||||||
@@ -1839,8 +1868,6 @@ bool HardwareBridgeNode::initCan(const std::string& ifname, int& fd)
|
|||||||
{
|
{
|
||||||
struct sockaddr_can addr;
|
struct sockaddr_can addr;
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
std::memset(&addr, 0, sizeof(addr));
|
|
||||||
std::memset(&ifr, 0, sizeof(ifr));
|
|
||||||
|
|
||||||
if ((fd = ::socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
|
if ((fd = ::socket(PF_CAN, SOCK_RAW, CAN_RAW)) < 0) {
|
||||||
RCLCPP_ERROR(get_logger(), "Failed to create SocketCAN socket for %s", ifname.c_str());
|
RCLCPP_ERROR(get_logger(), "Failed to create SocketCAN socket for %s", ifname.c_str());
|
||||||
@@ -1857,7 +1884,6 @@ bool HardwareBridgeNode::initCan(const std::string& ifname, int& fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::strncpy(ifr.ifr_name, ifname.c_str(), IFNAMSIZ - 1);
|
std::strncpy(ifr.ifr_name, ifname.c_str(), IFNAMSIZ - 1);
|
||||||
ifr.ifr_name[IFNAMSIZ - 1] = '\0';
|
|
||||||
if (::ioctl(fd, SIOCGIFINDEX, &ifr) < 0) {
|
if (::ioctl(fd, SIOCGIFINDEX, &ifr) < 0) {
|
||||||
RCLCPP_ERROR(get_logger(), "Failed to ioctl SIOCGIFINDEX for %s", ifname.c_str());
|
RCLCPP_ERROR(get_logger(), "Failed to ioctl SIOCGIFINDEX for %s", ifname.c_str());
|
||||||
::close(fd);
|
::close(fd);
|
||||||
@@ -1868,7 +1894,7 @@ bool HardwareBridgeNode::initCan(const std::string& ifname, int& fd)
|
|||||||
addr.can_family = AF_CAN;
|
addr.can_family = AF_CAN;
|
||||||
addr.can_ifindex = ifr.ifr_ifindex;
|
addr.can_ifindex = ifr.ifr_ifindex;
|
||||||
|
|
||||||
if (::bind(fd, reinterpret_cast<struct sockaddr *>(&addr), sizeof(addr)) < 0) {
|
if (::bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
|
||||||
RCLCPP_ERROR(get_logger(), "Failed to bind SocketCAN socket for %s", ifname.c_str());
|
RCLCPP_ERROR(get_logger(), "Failed to bind SocketCAN socket for %s", ifname.c_str());
|
||||||
::close(fd);
|
::close(fd);
|
||||||
fd = -1;
|
fd = -1;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
<depend>nav_msgs</depend>
|
<depend>nav_msgs</depend>
|
||||||
<depend>rclcpp</depend>
|
<depend>rclcpp</depend>
|
||||||
<depend>std_msgs</depend>
|
<depend>std_msgs</depend>
|
||||||
|
<depend>tf2_msgs</depend>
|
||||||
<depend>tf2_ros</depend>
|
<depend>tf2_ros</depend>
|
||||||
<depend>sim2real_common</depend>
|
<depend>sim2real_common</depend>
|
||||||
<depend>sim2real_interfaces</depend>
|
<depend>sim2real_interfaces</depend>
|
||||||
|
|||||||
@@ -235,7 +235,6 @@ PolicyRuntimeNode::PolicyRuntimeNode()
|
|||||||
run_log_dir_.c_str());
|
run_log_dir_.c_str());
|
||||||
logEvent("INFO", "node_start", "Policy runtime node started.");
|
logEvent("INFO", "node_start", "Policy runtime node started.");
|
||||||
initializeDebugTrace();
|
initializeDebugTrace();
|
||||||
|
|
||||||
// Initialize StandBalanceController
|
// Initialize StandBalanceController
|
||||||
stand_balance_ = std::make_unique<sim2real_common::StandBalanceController>(0.02);
|
stand_balance_ = std::make_unique<sim2real_common::StandBalanceController>(0.02);
|
||||||
const float rough_hip_mean =
|
const float rough_hip_mean =
|
||||||
|
|||||||
+311
-14
@@ -13,12 +13,13 @@ from urllib.parse import urlparse
|
|||||||
|
|
||||||
import rclpy
|
import rclpy
|
||||||
import yaml
|
import yaml
|
||||||
from geometry_msgs.msg import Twist
|
from geometry_msgs.msg import TransformStamped, Twist
|
||||||
from rclpy.executors import ExternalShutdownException
|
from rclpy.executors import ExternalShutdownException
|
||||||
from rclpy.node import Node
|
from rclpy.node import Node
|
||||||
from sim2real_interfaces.msg import RuntimeState, RuntimeTarget
|
from sim2real_interfaces.msg import RuntimeState, RuntimeTarget
|
||||||
from std_msgs.msg import Bool, String
|
from std_msgs.msg import Bool, String
|
||||||
from tf2_ros import Buffer, TransformException, TransformListener
|
from tf2_msgs.msg import TFMessage
|
||||||
|
from tf2_ros import Buffer, TransformBroadcaster, TransformException, TransformListener
|
||||||
|
|
||||||
|
|
||||||
class WebUdpBridgeNode(Node):
|
class WebUdpBridgeNode(Node):
|
||||||
@@ -42,6 +43,7 @@ class WebUdpBridgeNode(Node):
|
|||||||
self.http_port = int(self.declare_parameter("web_http_port", 18080).value)
|
self.http_port = int(self.declare_parameter("web_http_port", 18080).value)
|
||||||
self.web_static_dir = str(self.declare_parameter("web_static_dir", "").value)
|
self.web_static_dir = str(self.declare_parameter("web_static_dir", "").value)
|
||||||
self.nav_map_frame = str(self.declare_parameter("nav_map_frame", "map").value)
|
self.nav_map_frame = str(self.declare_parameter("nav_map_frame", "map").value)
|
||||||
|
self.nav_odom_frame = str(self.declare_parameter("nav_odom_frame", "odom").value)
|
||||||
self.nav_base_frame = str(self.declare_parameter("nav_base_frame", "base_link").value)
|
self.nav_base_frame = str(self.declare_parameter("nav_base_frame", "base_link").value)
|
||||||
self.nav_goals_file = str(self.declare_parameter("nav_goals_file", "").value)
|
self.nav_goals_file = str(self.declare_parameter("nav_goals_file", "").value)
|
||||||
self.nav_missions_file = str(self.declare_parameter("nav_missions_file", "").value)
|
self.nav_missions_file = str(self.declare_parameter("nav_missions_file", "").value)
|
||||||
@@ -68,9 +70,40 @@ class WebUdpBridgeNode(Node):
|
|||||||
0.05,
|
0.05,
|
||||||
float(self.declare_parameter("nav_route_align_search_radius", 0.35).value),
|
float(self.declare_parameter("nav_route_align_search_radius", 0.35).value),
|
||||||
)
|
)
|
||||||
|
self.odom_fallback_require_odom_fresh = bool(
|
||||||
|
self.declare_parameter("odom_fallback_require_odom_fresh", True).value
|
||||||
|
)
|
||||||
|
self.odom_fallback_max_odom_age_ms = max(
|
||||||
|
0.0,
|
||||||
|
float(self.declare_parameter("odom_fallback_max_odom_age_ms", 500.0).value),
|
||||||
|
)
|
||||||
|
self.odom_fallback_block_existing_map_odom_tf = bool(
|
||||||
|
self.declare_parameter("odom_fallback_block_existing_map_odom_tf", True).value
|
||||||
|
)
|
||||||
|
self.odom_fallback_tf_conflict_window_s = max(
|
||||||
|
0.0,
|
||||||
|
float(self.declare_parameter("odom_fallback_tf_conflict_window_s", 1.0).value),
|
||||||
|
)
|
||||||
|
self.odom_fallback_tf_conflict_xy_tolerance = max(
|
||||||
|
0.0,
|
||||||
|
float(self.declare_parameter("odom_fallback_tf_conflict_xy_tolerance", 0.05).value),
|
||||||
|
)
|
||||||
|
self.odom_fallback_tf_conflict_yaw_tolerance = math.radians(
|
||||||
|
max(0.0, float(self.declare_parameter("odom_fallback_tf_conflict_yaw_tolerance_deg", 2.0).value))
|
||||||
|
)
|
||||||
|
self.odom_fallback_stop_on_external_tf = bool(
|
||||||
|
self.declare_parameter("odom_fallback_stop_on_external_tf", False).value
|
||||||
|
)
|
||||||
|
|
||||||
self.tf_buffer = Buffer()
|
self.tf_buffer = Buffer()
|
||||||
self.tf_listener = TransformListener(self.tf_buffer, self)
|
self.tf_listener = TransformListener(self.tf_buffer, self)
|
||||||
|
self.tf_broadcaster = TransformBroadcaster(self)
|
||||||
|
self.odom_fallback_active = False
|
||||||
|
self.odom_fallback_transform: Optional[TransformStamped] = None
|
||||||
|
self.odom_fallback_anchor: dict[str, Any] = {}
|
||||||
|
self.odom_fallback_handoff_pending = False
|
||||||
|
self.odom_fallback_handoff_info: dict[str, Any] = {}
|
||||||
|
self.last_external_map_odom_tf: Optional[dict[str, Any]] = None
|
||||||
|
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
self.sock.setblocking(False)
|
self.sock.setblocking(False)
|
||||||
@@ -122,6 +155,7 @@ class WebUdpBridgeNode(Node):
|
|||||||
self.create_subscription(String, "control/mux_status", self.on_mux_status, 10)
|
self.create_subscription(String, "control/mux_status", self.on_mux_status, 10)
|
||||||
self.create_subscription(String, "simple_nav/status", self.on_nav_status, 10)
|
self.create_subscription(String, "simple_nav/status", self.on_nav_status, 10)
|
||||||
self.create_subscription(String, "simple_nav/path", self.on_nav_path, 10)
|
self.create_subscription(String, "simple_nav/path", self.on_nav_path, 10)
|
||||||
|
self.create_subscription(TFMessage, "/tf", self.on_tf, 50)
|
||||||
|
|
||||||
self.map_points = self.load_filtered_pcd(Path(self.pcd_nav_file)) if self.pcd_nav_file else []
|
self.map_points = self.load_filtered_pcd(Path(self.pcd_nav_file)) if self.pcd_nav_file else []
|
||||||
self.goal_specs: list[dict[str, Any]] = []
|
self.goal_specs: list[dict[str, Any]] = []
|
||||||
@@ -145,6 +179,7 @@ class WebUdpBridgeNode(Node):
|
|||||||
self.on_state_timer,
|
self.on_state_timer,
|
||||||
)
|
)
|
||||||
self.guard_timer = self.create_timer(0.05, self.on_guard_timer)
|
self.guard_timer = self.create_timer(0.05, self.on_guard_timer)
|
||||||
|
self.odom_fallback_timer = self.create_timer(0.05, self.on_odom_fallback_timer)
|
||||||
|
|
||||||
self.get_logger().info(f"Web UDP bridge listening on {self.listen_host}:{self.listen_port}")
|
self.get_logger().info(f"Web UDP bridge listening on {self.listen_host}:{self.listen_port}")
|
||||||
self.get_logger().info(f"Web HTTP UI serving on http://{self.http_host}:{self.http_port}")
|
self.get_logger().info(f"Web HTTP UI serving on http://{self.http_host}:{self.http_port}")
|
||||||
@@ -673,22 +708,12 @@ class WebUdpBridgeNode(Node):
|
|||||||
self.http_thread.start()
|
self.http_thread.start()
|
||||||
|
|
||||||
def build_map_packet(self) -> dict[str, Any]:
|
def build_map_packet(self) -> dict[str, Any]:
|
||||||
goal_lookup = {goal["name"]: goal for goal in self.goal_specs if goal.get("name")}
|
default_goals = self.get_default_mission_goals()
|
||||||
default_goals: list[dict[str, Any]] = []
|
|
||||||
if self.default_mission_name:
|
|
||||||
for mission in self.mission_specs:
|
|
||||||
if mission["name"] != self.default_mission_name:
|
|
||||||
continue
|
|
||||||
default_goals = [
|
|
||||||
goal_lookup[goal_name]
|
|
||||||
for goal_name in mission.get("goals", [])
|
|
||||||
if goal_name in goal_lookup
|
|
||||||
]
|
|
||||||
break
|
|
||||||
return {
|
return {
|
||||||
"points": self.map_points,
|
"points": self.map_points,
|
||||||
"map_frame": self.nav_map_frame,
|
"map_frame": self.nav_map_frame,
|
||||||
"base_frame": self.nav_base_frame,
|
"base_frame": self.nav_base_frame,
|
||||||
|
"odom_frame": self.nav_odom_frame,
|
||||||
"pose": self.lookup_pose(),
|
"pose": self.lookup_pose(),
|
||||||
"route_source_file": self.get_route_source_file(),
|
"route_source_file": self.get_route_source_file(),
|
||||||
"goal_specs": self.goal_specs,
|
"goal_specs": self.goal_specs,
|
||||||
@@ -696,6 +721,12 @@ class WebUdpBridgeNode(Node):
|
|||||||
"default_mission_name": self.default_mission_name,
|
"default_mission_name": self.default_mission_name,
|
||||||
"default_mission_goals": default_goals,
|
"default_mission_goals": default_goals,
|
||||||
"route_alignment": self.route_alignment_info,
|
"route_alignment": self.route_alignment_info,
|
||||||
|
"odom_fallback": {
|
||||||
|
"active": self.odom_fallback_active,
|
||||||
|
"handoff_pending": self.odom_fallback_handoff_pending,
|
||||||
|
"handoff": dict(self.odom_fallback_handoff_info),
|
||||||
|
**self.odom_fallback_anchor,
|
||||||
|
},
|
||||||
"nav_path": dict(self.latest_nav_path),
|
"nav_path": dict(self.latest_nav_path),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -713,6 +744,8 @@ class WebUdpBridgeNode(Node):
|
|||||||
"nav_cmd",
|
"nav_cmd",
|
||||||
"go_to",
|
"go_to",
|
||||||
"go_rel",
|
"go_rel",
|
||||||
|
"odom_task",
|
||||||
|
"odom_stop",
|
||||||
"model_toggle",
|
"model_toggle",
|
||||||
"model_cmd",
|
"model_cmd",
|
||||||
}:
|
}:
|
||||||
@@ -758,6 +791,61 @@ class WebUdpBridgeNode(Node):
|
|||||||
self.latest_nav_status = msg.data
|
self.latest_nav_status = msg.data
|
||||||
if msg.data.startswith("reloaded goals="):
|
if msg.data.startswith("reloaded goals="):
|
||||||
self.reload_nav_task_config()
|
self.reload_nav_task_config()
|
||||||
|
elif msg.data.startswith("navigation stopped:") and self.odom_fallback_active:
|
||||||
|
self.stop_odom_fallback(msg.data.removeprefix("navigation stopped:").strip(), stop_nav=False)
|
||||||
|
|
||||||
|
def on_tf(self, msg: TFMessage) -> None:
|
||||||
|
for transform in msg.transforms:
|
||||||
|
parent = transform.header.frame_id.strip("/")
|
||||||
|
child = transform.child_frame_id.strip("/")
|
||||||
|
map_frame = self.nav_map_frame.strip("/")
|
||||||
|
odom_frame = self.nav_odom_frame.strip("/")
|
||||||
|
if parent == map_frame and child == odom_frame:
|
||||||
|
self.handle_map_odom_tf(transform, "map_to_odom")
|
||||||
|
elif parent == odom_frame and child == map_frame:
|
||||||
|
self.handle_map_odom_tf(transform, "odom_to_map")
|
||||||
|
|
||||||
|
def handle_map_odom_tf(self, transform: TransformStamped, direction: str) -> None:
|
||||||
|
if not self.odom_fallback_active:
|
||||||
|
self.last_external_map_odom_tf = {
|
||||||
|
"direction": direction,
|
||||||
|
"stamp": self.stamp_to_sec(transform.header.stamp),
|
||||||
|
}
|
||||||
|
return
|
||||||
|
|
||||||
|
if direction == "odom_to_map":
|
||||||
|
self.on_external_tf_during_odom_fallback(
|
||||||
|
direction,
|
||||||
|
"external odom->map TF detected, likely Odin relocalization recovered",
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
|
if not self.is_own_odom_fallback_tf(transform):
|
||||||
|
self.on_external_tf_during_odom_fallback(
|
||||||
|
direction,
|
||||||
|
"external map->odom TF conflict detected",
|
||||||
|
)
|
||||||
|
|
||||||
|
def on_external_tf_during_odom_fallback(self, direction: str, reason: str) -> None:
|
||||||
|
if self.odom_fallback_stop_on_external_tf:
|
||||||
|
self.stop_odom_fallback(reason, stop_nav=True)
|
||||||
|
return
|
||||||
|
self.mark_odom_fallback_handoff_pending(direction, reason)
|
||||||
|
|
||||||
|
def mark_odom_fallback_handoff_pending(self, direction: str, reason: str) -> None:
|
||||||
|
first_notice = not self.odom_fallback_handoff_pending
|
||||||
|
self.odom_fallback_handoff_pending = True
|
||||||
|
self.odom_fallback_handoff_info = {
|
||||||
|
"pending": True,
|
||||||
|
"direction": direction,
|
||||||
|
"reason": reason,
|
||||||
|
"stamp": round(self.now_sec(), 3),
|
||||||
|
}
|
||||||
|
if first_notice:
|
||||||
|
self.latest_nav_status = f"odom fallback handoff pending: {reason}"
|
||||||
|
self.get_logger().warn(
|
||||||
|
f"{self.latest_nav_status}; keeping pure odom task active until mission ends or Exit odom"
|
||||||
|
)
|
||||||
|
|
||||||
def on_nav_path(self, msg: String) -> None:
|
def on_nav_path(self, msg: String) -> None:
|
||||||
try:
|
try:
|
||||||
@@ -842,6 +930,8 @@ class WebUdpBridgeNode(Node):
|
|||||||
command = str(payload.get("command", "")).strip()
|
command = str(payload.get("command", "")).strip()
|
||||||
if command:
|
if command:
|
||||||
self.set_control_mode("NAV")
|
self.set_control_mode("NAV")
|
||||||
|
if command.lower() == "stop" and self.odom_fallback_active:
|
||||||
|
self.stop_odom_fallback("nav stop requested", stop_nav=False)
|
||||||
self.nav_cmd_pub.publish(String(data=command))
|
self.nav_cmd_pub.publish(String(data=command))
|
||||||
elif msg_type == "go_to":
|
elif msg_type == "go_to":
|
||||||
x = float(payload.get("x", 0.0))
|
x = float(payload.get("x", 0.0))
|
||||||
@@ -853,6 +943,10 @@ class WebUdpBridgeNode(Node):
|
|||||||
dy = float(payload.get("dy", 0.0))
|
dy = float(payload.get("dy", 0.0))
|
||||||
self.set_control_mode("NAV")
|
self.set_control_mode("NAV")
|
||||||
self.nav_cmd_pub.publish(String(data=f"go_rel {dx:.3f} {dy:.3f}"))
|
self.nav_cmd_pub.publish(String(data=f"go_rel {dx:.3f} {dy:.3f}"))
|
||||||
|
elif msg_type == "odom_task":
|
||||||
|
self.start_odom_fallback_task()
|
||||||
|
elif msg_type == "odom_stop":
|
||||||
|
self.stop_odom_fallback("manual stop", stop_nav=True)
|
||||||
elif msg_type == "model_toggle":
|
elif msg_type == "model_toggle":
|
||||||
self.model_cmd_pub.publish(String(data="toggle"))
|
self.model_cmd_pub.publish(String(data="toggle"))
|
||||||
elif msg_type == "model_cmd":
|
elif msg_type == "model_cmd":
|
||||||
@@ -876,6 +970,195 @@ class WebUdpBridgeNode(Node):
|
|||||||
self.remote_enabled_pub.publish(Bool(data=mode == "REMOTE"))
|
self.remote_enabled_pub.publish(Bool(data=mode == "REMOTE"))
|
||||||
self.nav_enabled_pub.publish(Bool(data=mode == "NAV"))
|
self.nav_enabled_pub.publish(Bool(data=mode == "NAV"))
|
||||||
|
|
||||||
|
def get_default_mission_goals(self) -> list[dict[str, Any]]:
|
||||||
|
goal_lookup = {goal["name"]: goal for goal in self.goal_specs if goal.get("name")}
|
||||||
|
if not self.default_mission_name:
|
||||||
|
return []
|
||||||
|
for mission in self.mission_specs:
|
||||||
|
if mission["name"] != self.default_mission_name:
|
||||||
|
continue
|
||||||
|
return [
|
||||||
|
goal_lookup[goal_name]
|
||||||
|
for goal_name in mission.get("goals", [])
|
||||||
|
if goal_name in goal_lookup
|
||||||
|
]
|
||||||
|
return []
|
||||||
|
|
||||||
|
def start_odom_fallback_task(self) -> None:
|
||||||
|
self.reload_nav_task_config()
|
||||||
|
default_goals = self.get_default_mission_goals()
|
||||||
|
if not self.default_mission_name or not default_goals:
|
||||||
|
raise ValueError("odom task unavailable: no default mission loaded")
|
||||||
|
|
||||||
|
anchor_goal = default_goals[0]
|
||||||
|
yaw_deg = anchor_goal.get("yaw_deg")
|
||||||
|
if yaw_deg is None:
|
||||||
|
yaw_deg = 0.0
|
||||||
|
self.activate_odom_fallback(
|
||||||
|
float(anchor_goal["x"]),
|
||||||
|
float(anchor_goal["y"]),
|
||||||
|
math.radians(float(yaw_deg)),
|
||||||
|
str(anchor_goal.get("name", "route_p01")),
|
||||||
|
)
|
||||||
|
self.set_control_mode("NAV")
|
||||||
|
self.nav_cmd_pub.publish(String(data="reload"))
|
||||||
|
self.nav_cmd_pub.publish(String(data=f"run {self.default_mission_name}"))
|
||||||
|
|
||||||
|
def activate_odom_fallback(self, map_x: float, map_y: float, map_yaw: float, anchor_name: str) -> None:
|
||||||
|
self.validate_odom_fallback_preconditions()
|
||||||
|
try:
|
||||||
|
odom_to_base = self.tf_buffer.lookup_transform(
|
||||||
|
self.nav_odom_frame,
|
||||||
|
self.nav_base_frame,
|
||||||
|
rclpy.time.Time(),
|
||||||
|
)
|
||||||
|
except TransformException as exc:
|
||||||
|
raise ValueError(
|
||||||
|
f"odom fallback failed: missing TF {self.nav_odom_frame}->{self.nav_base_frame}: {exc}"
|
||||||
|
) from exc
|
||||||
|
|
||||||
|
t = odom_to_base.transform.translation
|
||||||
|
q = odom_to_base.transform.rotation
|
||||||
|
odom_x = float(t.x)
|
||||||
|
odom_y = float(t.y)
|
||||||
|
odom_yaw = self.quaternion_to_yaw(q.x, q.y, q.z, q.w)
|
||||||
|
|
||||||
|
map_to_odom_yaw = self.normalize_angle(map_yaw - odom_yaw)
|
||||||
|
cos_yaw = math.cos(map_to_odom_yaw)
|
||||||
|
sin_yaw = math.sin(map_to_odom_yaw)
|
||||||
|
map_to_odom_x = map_x - (cos_yaw * odom_x - sin_yaw * odom_y)
|
||||||
|
map_to_odom_y = map_y - (sin_yaw * odom_x + cos_yaw * odom_y)
|
||||||
|
|
||||||
|
transform = TransformStamped()
|
||||||
|
transform.header.frame_id = self.nav_map_frame
|
||||||
|
transform.child_frame_id = self.nav_odom_frame
|
||||||
|
transform.transform.translation.x = map_to_odom_x
|
||||||
|
transform.transform.translation.y = map_to_odom_y
|
||||||
|
transform.transform.translation.z = 0.0
|
||||||
|
transform.transform.rotation.z = math.sin(map_to_odom_yaw * 0.5)
|
||||||
|
transform.transform.rotation.w = math.cos(map_to_odom_yaw * 0.5)
|
||||||
|
|
||||||
|
self.odom_fallback_transform = transform
|
||||||
|
self.odom_fallback_active = True
|
||||||
|
self.odom_fallback_handoff_pending = False
|
||||||
|
self.odom_fallback_handoff_info = {}
|
||||||
|
self.odom_fallback_anchor = {
|
||||||
|
"anchor": anchor_name,
|
||||||
|
"map_pose": {
|
||||||
|
"x": round(map_x, 3),
|
||||||
|
"y": round(map_y, 3),
|
||||||
|
"yaw_deg": round(math.degrees(map_yaw), 3),
|
||||||
|
},
|
||||||
|
"odom_pose_at_init": {
|
||||||
|
"x": round(odom_x, 3),
|
||||||
|
"y": round(odom_y, 3),
|
||||||
|
"yaw_deg": round(math.degrees(odom_yaw), 3),
|
||||||
|
},
|
||||||
|
"map_to_odom": {
|
||||||
|
"x": round(map_to_odom_x, 3),
|
||||||
|
"y": round(map_to_odom_y, 3),
|
||||||
|
"yaw_deg": round(math.degrees(map_to_odom_yaw), 3),
|
||||||
|
},
|
||||||
|
}
|
||||||
|
self.broadcast_odom_fallback()
|
||||||
|
self.latest_nav_status = (
|
||||||
|
f"odom fallback active: {anchor_name} -> "
|
||||||
|
f"map({map_x:.2f},{map_y:.2f},{math.degrees(map_yaw):.1f}deg)"
|
||||||
|
)
|
||||||
|
self.get_logger().info(self.latest_nav_status)
|
||||||
|
|
||||||
|
def validate_odom_fallback_preconditions(self) -> None:
|
||||||
|
if self.odom_fallback_require_odom_fresh:
|
||||||
|
state = self.latest_state
|
||||||
|
if state is None:
|
||||||
|
raise ValueError("odom fallback failed: runtime/state unavailable, cannot verify odom freshness")
|
||||||
|
odom_age_ms = float(state.odom_age_ms)
|
||||||
|
if not bool(state.odom_fresh):
|
||||||
|
raise ValueError(f"odom fallback failed: odom is not fresh (age={odom_age_ms:.1f}ms)")
|
||||||
|
if self.odom_fallback_max_odom_age_ms > 0.0 and odom_age_ms > self.odom_fallback_max_odom_age_ms:
|
||||||
|
raise ValueError(
|
||||||
|
"odom fallback failed: "
|
||||||
|
f"odom age {odom_age_ms:.1f}ms > {self.odom_fallback_max_odom_age_ms:.1f}ms"
|
||||||
|
)
|
||||||
|
|
||||||
|
if self.odom_fallback_block_existing_map_odom_tf and not self.odom_fallback_active:
|
||||||
|
if self.recent_external_map_odom_tf_exists():
|
||||||
|
direction = str(self.last_external_map_odom_tf.get("direction", "map<->odom"))
|
||||||
|
raise ValueError(
|
||||||
|
f"odom fallback failed: recent external {direction} TF detected. "
|
||||||
|
"Disable Odin relocalization/map TF before starting pure odom fallback."
|
||||||
|
)
|
||||||
|
try:
|
||||||
|
existing = self.tf_buffer.lookup_transform(
|
||||||
|
self.nav_map_frame,
|
||||||
|
self.nav_odom_frame,
|
||||||
|
rclpy.time.Time(),
|
||||||
|
)
|
||||||
|
except TransformException:
|
||||||
|
return
|
||||||
|
age_s = self.transform_age_s(existing)
|
||||||
|
if age_s is not None and age_s > self.odom_fallback_tf_conflict_window_s:
|
||||||
|
return
|
||||||
|
raise ValueError(
|
||||||
|
"odom fallback failed: existing map<->odom TF detected. "
|
||||||
|
"Disable Odin relocalization/map TF before starting pure odom fallback."
|
||||||
|
)
|
||||||
|
|
||||||
|
def recent_external_map_odom_tf_exists(self) -> bool:
|
||||||
|
if not self.last_external_map_odom_tf:
|
||||||
|
return False
|
||||||
|
stamp = self.last_external_map_odom_tf.get("stamp")
|
||||||
|
if not isinstance(stamp, (int, float)):
|
||||||
|
return False
|
||||||
|
return self.now_sec() - float(stamp) <= self.odom_fallback_tf_conflict_window_s
|
||||||
|
|
||||||
|
def transform_age_s(self, transform: TransformStamped) -> Optional[float]:
|
||||||
|
stamp = self.stamp_to_sec(transform.header.stamp)
|
||||||
|
if stamp <= 0.0:
|
||||||
|
return None
|
||||||
|
return max(0.0, self.now_sec() - stamp)
|
||||||
|
|
||||||
|
def is_own_odom_fallback_tf(self, transform: TransformStamped) -> bool:
|
||||||
|
expected = self.odom_fallback_transform
|
||||||
|
if expected is None:
|
||||||
|
return False
|
||||||
|
t = transform.transform.translation
|
||||||
|
e = expected.transform.translation
|
||||||
|
xy_error = math.hypot(float(t.x) - float(e.x), float(t.y) - float(e.y))
|
||||||
|
q = transform.transform.rotation
|
||||||
|
eq = expected.transform.rotation
|
||||||
|
yaw = self.quaternion_to_yaw(q.x, q.y, q.z, q.w)
|
||||||
|
expected_yaw = self.quaternion_to_yaw(eq.x, eq.y, eq.z, eq.w)
|
||||||
|
yaw_error = abs(self.normalize_angle(yaw - expected_yaw))
|
||||||
|
return (
|
||||||
|
xy_error <= self.odom_fallback_tf_conflict_xy_tolerance
|
||||||
|
and yaw_error <= self.odom_fallback_tf_conflict_yaw_tolerance
|
||||||
|
)
|
||||||
|
|
||||||
|
def stop_odom_fallback(self, reason: str, stop_nav: bool = True) -> None:
|
||||||
|
was_active = self.odom_fallback_active
|
||||||
|
self.odom_fallback_active = False
|
||||||
|
self.odom_fallback_transform = None
|
||||||
|
self.odom_fallback_anchor = {}
|
||||||
|
self.odom_fallback_handoff_pending = False
|
||||||
|
self.odom_fallback_handoff_info = {}
|
||||||
|
if stop_nav:
|
||||||
|
self.nav_cmd_pub.publish(String(data="stop"))
|
||||||
|
status = f"odom fallback stopped: {reason}" if was_active else f"odom fallback already inactive: {reason}"
|
||||||
|
self.latest_nav_status = status
|
||||||
|
self.get_logger().info(status)
|
||||||
|
|
||||||
|
def on_odom_fallback_timer(self) -> None:
|
||||||
|
if self.odom_fallback_active:
|
||||||
|
self.broadcast_odom_fallback()
|
||||||
|
|
||||||
|
def broadcast_odom_fallback(self) -> None:
|
||||||
|
if self.odom_fallback_transform is None:
|
||||||
|
return
|
||||||
|
transform = self.odom_fallback_transform
|
||||||
|
transform.header.stamp = self.get_clock().now().to_msg()
|
||||||
|
self.tf_broadcaster.sendTransform(transform)
|
||||||
|
|
||||||
def parse_twist(self, payload: dict[str, Any]) -> Twist:
|
def parse_twist(self, payload: dict[str, Any]) -> Twist:
|
||||||
cmd = Twist()
|
cmd = Twist()
|
||||||
linear = payload.get("linear", {}) or {}
|
linear = payload.get("linear", {}) or {}
|
||||||
@@ -918,7 +1201,14 @@ class WebUdpBridgeNode(Node):
|
|||||||
"pose": self.lookup_pose(),
|
"pose": self.lookup_pose(),
|
||||||
"map_frame": self.nav_map_frame,
|
"map_frame": self.nav_map_frame,
|
||||||
"base_frame": self.nav_base_frame,
|
"base_frame": self.nav_base_frame,
|
||||||
|
"odom_frame": self.nav_odom_frame,
|
||||||
"path": dict(self.latest_nav_path),
|
"path": dict(self.latest_nav_path),
|
||||||
|
"odom_fallback": {
|
||||||
|
"active": self.odom_fallback_active,
|
||||||
|
"handoff_pending": self.odom_fallback_handoff_pending,
|
||||||
|
"handoff": dict(self.odom_fallback_handoff_info),
|
||||||
|
**self.odom_fallback_anchor,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
"model": dict(self.latest_model_status),
|
"model": dict(self.latest_model_status),
|
||||||
}
|
}
|
||||||
@@ -975,6 +1265,13 @@ class WebUdpBridgeNode(Node):
|
|||||||
def now_sec(self) -> float:
|
def now_sec(self) -> float:
|
||||||
return self.get_clock().now().nanoseconds / 1.0e9
|
return self.get_clock().now().nanoseconds / 1.0e9
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def stamp_to_sec(stamp: Any) -> float:
|
||||||
|
try:
|
||||||
|
return float(stamp.sec) + float(stamp.nanosec) / 1.0e9
|
||||||
|
except Exception:
|
||||||
|
return 0.0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def twist_to_dict(msg: Twist) -> dict[str, Any]:
|
def twist_to_dict(msg: Twist) -> dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ This is not the Nano runtime Web UI. Use it before a run to inspect the map and
|
|||||||
From the repository root:
|
From the repository root:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
python .\tools\pcd_map_viewer\server.py --http-port 8090
|
python .\05_software\real\sim2real_ros2_v2\tools\pcd_map_viewer\server.py --http-port 8090
|
||||||
```
|
```
|
||||||
|
|
||||||
Open:
|
Open:
|
||||||
@@ -84,21 +84,15 @@ waypoints:
|
|||||||
obstacle_name: wall_1
|
obstacle_name: wall_1
|
||||||
```
|
```
|
||||||
|
|
||||||
Default runtime route:
|
The current `v0.12.0` runtime route is configured separately in `src/sim2real_bringup/config/runtime.yaml`:
|
||||||
|
|
||||||
```text
|
```text
|
||||||
map/routes/map1/test_route.yaml
|
map/routes/A_min/A_min_route.json
|
||||||
```
|
```
|
||||||
|
|
||||||
## Runtime Test
|
The editor can also save YAML, but the archived runtime does not provide the `/route_runner/cmd` interface described by an earlier draft. Use the current JSON task file and Web/navigation controls documented by this snapshot.
|
||||||
|
|
||||||
```bash
|
|
||||||
ros2 topic pub --once /route_runner/cmd std_msgs/msg/String "{data: reload}"
|
|
||||||
ros2 topic pub --once /route_runner/cmd std_msgs/msg/String "{data: start}"
|
|
||||||
ros2 topic pub --once /route_runner/cmd std_msgs/msg/String "{data: stop}"
|
|
||||||
```
|
|
||||||
|
|
||||||
See also:
|
See also:
|
||||||
|
|
||||||
- [Maps And Routes](../../docs/ROUTES_AND_MAPS.md)
|
- [Archived map data](../../map/README.md)
|
||||||
- [Common Commands](../../docs/COMMANDS.md)
|
- [ROS 2 v2 snapshot](../../README.md)
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
在仓库根目录:
|
在仓库根目录:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
python .\tools\pcd_map_viewer\server.py --http-port 8090
|
python .\05_software\real\sim2real_ros2_v2\tools\pcd_map_viewer\server.py --http-port 8090
|
||||||
```
|
```
|
||||||
|
|
||||||
打开:
|
打开:
|
||||||
@@ -26,3 +26,7 @@ http://127.0.0.1:8090
|
|||||||
- `tolerance`
|
- `tolerance`
|
||||||
|
|
||||||
不保存 `z` 和 `action`。
|
不保存 `z` 和 `action`。
|
||||||
|
|
||||||
|
当前 `v0.12.0` 运行配置使用 `map/routes/A_min/A_min_route.json`。编辑器也能保存 YAML,但本快照没有旧文档曾描述的 `/route_runner/cmd` 控制接口。
|
||||||
|
|
||||||
|
地图抽样边界见 [`../../map/README.md`](../../map/README.md),版本说明见 [`../../README.md`](../../README.md)。
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,7 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
cd /d "%~dp0\.."
|
||||||
|
|
||||||
|
python .\tools\pcd_nav_pygame.py --pcd .\map\A_min.pcd --route-name A_min_route --route-map A_min --route-obstacle slalom --save-route .\map\routes\A_min\A_min_route.json --default-speed 0.35 --default-policy rough --default-tolerance 0.15
|
||||||
|
|
||||||
|
endlocal
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
@echo off
|
||||||
|
setlocal
|
||||||
|
cd /d "%~dp0\.."
|
||||||
|
|
||||||
|
python .\tools\pcd_nav_pygame.py --pcd .\map\map_b.pcd --overlay-json .\tools\semantic_overlay_example.json
|
||||||
|
|
||||||
|
endlocal
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
{
|
||||||
|
"elements": [
|
||||||
|
{
|
||||||
|
"name": "wall_01",
|
||||||
|
"label": "wall",
|
||||||
|
"type": "rect",
|
||||||
|
"x": 1.8,
|
||||||
|
"y": -7.0,
|
||||||
|
"length": 1.0,
|
||||||
|
"width": 0.05,
|
||||||
|
"yawDeg": 90.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "low_bar_01",
|
||||||
|
"label": "low_bar",
|
||||||
|
"type": "rect",
|
||||||
|
"x": 5.7,
|
||||||
|
"y": -9.0,
|
||||||
|
"length": 1.0,
|
||||||
|
"width": 0.03,
|
||||||
|
"yawDeg": 0.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "slalom_pole_01",
|
||||||
|
"label": "slalom_pole",
|
||||||
|
"type": "circle",
|
||||||
|
"x": 1.8,
|
||||||
|
"y": -10.5,
|
||||||
|
"radius": 0.05
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "stairs_area",
|
||||||
|
"label": "stairs",
|
||||||
|
"type": "rect",
|
||||||
|
"x": 2.4,
|
||||||
|
"y": -3.5,
|
||||||
|
"length": 2.4,
|
||||||
|
"width": 1.2,
|
||||||
|
"yawDeg": 0.0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "ramp_area",
|
||||||
|
"label": "ramp",
|
||||||
|
"type": "rect",
|
||||||
|
"x": 5.2,
|
||||||
|
"y": -5.2,
|
||||||
|
"length": 2.0,
|
||||||
|
"width": 3.0,
|
||||||
|
"yawDeg": 0.0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ Use this tool only when you want the browser and HTTP server to run on Windows w
|
|||||||
From the repository root:
|
From the repository root:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
python .\tools\win_web_debug\server.py --nano-host <nano-ip> --http-port 8088
|
python .\05_software\real\sim2real_ros2_v2\tools\win_web_debug\server.py --nano-host <nano-ip> --http-port 8088
|
||||||
```
|
```
|
||||||
|
|
||||||
Or from this folder:
|
Or from this folder:
|
||||||
@@ -40,5 +40,5 @@ src/sim2real_runtime/src/web_udp_bridge_node.py
|
|||||||
|
|
||||||
See:
|
See:
|
||||||
|
|
||||||
- [Runtime Web](../../docs/RUNTIME_WEB.md)
|
- [Runtime Web and UDP bridge](../../docs/WEB_DEBUG_USAGE.md)
|
||||||
- [Common Commands](../../docs/COMMANDS.md)
|
- [ROS 2 v2 snapshot](../../README.md)
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ http://<nano-ip>:18080
|
|||||||
在仓库根目录:
|
在仓库根目录:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
python .\tools\win_web_debug\server.py --nano-host <nano-ip> --http-port 8088
|
python .\05_software\real\sim2real_ros2_v2\tools\win_web_debug\server.py --nano-host <nano-ip> --http-port 8088
|
||||||
```
|
```
|
||||||
|
|
||||||
打开:
|
打开:
|
||||||
@@ -21,3 +21,5 @@ python .\tools\win_web_debug\server.py --nano-host <nano-ip> --http-port 8088
|
|||||||
```text
|
```text
|
||||||
http://127.0.0.1:8088
|
http://127.0.0.1:8088
|
||||||
```
|
```
|
||||||
|
|
||||||
|
运行时 Web 与 UDP 配置见 [`../../docs/WEB_DEBUG_USAGE.md`](../../docs/WEB_DEBUG_USAGE.md)。
|
||||||
|
|||||||
@@ -25,6 +25,9 @@ class Handler(SimpleHTTPRequestHandler):
|
|||||||
self._json(200, data)
|
self._json(200, data)
|
||||||
return
|
return
|
||||||
if self.path == "/api/map":
|
if self.path == "/api/map":
|
||||||
|
global LATEST_MAP
|
||||||
|
with STATE_LOCK:
|
||||||
|
LATEST_MAP = None
|
||||||
send_udp({"type": "map_request", "stamp": time.time()})
|
send_udp({"type": "map_request", "stamp": time.time()})
|
||||||
deadline = time.time() + 1.0
|
deadline = time.time() + 1.0
|
||||||
while time.time() < deadline:
|
while time.time() < deadline:
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ let goalPointsByName = {};
|
|||||||
let defaultMissionName = '';
|
let defaultMissionName = '';
|
||||||
let defaultMissionGoals = [];
|
let defaultMissionGoals = [];
|
||||||
let routeAlignmentInfo = {};
|
let routeAlignmentInfo = {};
|
||||||
|
let odomFallbackInfo = { active: false };
|
||||||
let activeNavPath = { goal_name: '', stage: 'idle', path_index: 0, points: [] };
|
let activeNavPath = { goal_name: '', stage: 'idle', path_index: 0, points: [] };
|
||||||
|
|
||||||
const mapCanvas = $('map-canvas');
|
const mapCanvas = $('map-canvas');
|
||||||
@@ -89,18 +90,37 @@ function highlightMode(mode) {
|
|||||||
|
|
||||||
function updateTaskButtonState() {
|
function updateTaskButtonState() {
|
||||||
const btn = $('btn-run-task');
|
const btn = $('btn-run-task');
|
||||||
if (!btn) return;
|
const odomBtn = $('btn-odom-task');
|
||||||
|
const odomStopBtn = $('btn-odom-stop');
|
||||||
const hasMission = Boolean(defaultMissionName);
|
const hasMission = Boolean(defaultMissionName);
|
||||||
const enabled = latestConnected && currentMode === 'NAV' && hasMission;
|
const runEnabled = latestConnected && currentMode === 'NAV' && hasMission;
|
||||||
btn.disabled = !enabled;
|
const odomEnabled = latestConnected && hasMission;
|
||||||
btn.textContent = hasMission ? `Run ${defaultMissionName}` : 'Run Mission';
|
|
||||||
if (!hasMission) {
|
if (btn) {
|
||||||
btn.title = 'No default mission loaded from backend';
|
btn.disabled = !runEnabled;
|
||||||
return;
|
btn.textContent = hasMission ? `Run ${defaultMissionName}` : 'Run Mission';
|
||||||
|
if (!hasMission) {
|
||||||
|
btn.title = 'No default mission loaded from backend';
|
||||||
|
} else {
|
||||||
|
btn.title = runEnabled
|
||||||
|
? `Run default mission ${defaultMissionName}`
|
||||||
|
: 'Available only in NAV mode while connected';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (odomBtn) {
|
||||||
|
odomBtn.disabled = !odomEnabled;
|
||||||
|
odomBtn.title = hasMission
|
||||||
|
? 'Initialize map->odom from waypoint id1, switch to NAV, then run the current route'
|
||||||
|
: 'No default mission loaded from backend';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (odomStopBtn) {
|
||||||
|
odomStopBtn.disabled = !(latestConnected && odomFallbackInfo.active);
|
||||||
|
odomStopBtn.title = odomFallbackInfo.active
|
||||||
|
? 'Stop pure odom fallback and stop simple_nav'
|
||||||
|
: 'Odom fallback is not active';
|
||||||
}
|
}
|
||||||
btn.title = enabled
|
|
||||||
? `Run default mission ${defaultMissionName}`
|
|
||||||
: 'Available only in NAV mode while connected';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setText(id, text, cls) {
|
function setText(id, text, cls) {
|
||||||
@@ -355,6 +375,17 @@ function formatRouteAlignment(info) {
|
|||||||
return `${applied} hits=${hits} ${reason}`;
|
return `${applied} hits=${hits} ${reason}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatOdomFallback(info) {
|
||||||
|
if (!info || !info.active) return 'inactive';
|
||||||
|
const anchor = info.anchor || 'id1';
|
||||||
|
const pose = info.map_pose || {};
|
||||||
|
const x = Number.isFinite(pose.x) ? Number(pose.x).toFixed(2) : '--';
|
||||||
|
const y = Number.isFinite(pose.y) ? Number(pose.y).toFixed(2) : '--';
|
||||||
|
const yaw = Number.isFinite(pose.yaw_deg) ? Number(pose.yaw_deg).toFixed(1) : '--';
|
||||||
|
const handoff = info.handoff_pending ? ' handoff pending' : '';
|
||||||
|
return `${anchor} x=${x} y=${y} yaw=${yaw}deg${handoff}`;
|
||||||
|
}
|
||||||
|
|
||||||
function renderTaskGoals() {
|
function renderTaskGoals() {
|
||||||
const list = $('task-goals-list');
|
const list = $('task-goals-list');
|
||||||
if (!list) return;
|
if (!list) return;
|
||||||
@@ -392,6 +423,7 @@ function applyMapMetadata(data) {
|
|||||||
defaultMissionName = data.default_mission_name || '';
|
defaultMissionName = data.default_mission_name || '';
|
||||||
defaultMissionGoals = Array.isArray(data.default_mission_goals) ? data.default_mission_goals : [];
|
defaultMissionGoals = Array.isArray(data.default_mission_goals) ? data.default_mission_goals : [];
|
||||||
routeAlignmentInfo = data.route_alignment || {};
|
routeAlignmentInfo = data.route_alignment || {};
|
||||||
|
odomFallbackInfo = data.odom_fallback || odomFallbackInfo;
|
||||||
activeNavPath = data.nav_path || activeNavPath;
|
activeNavPath = data.nav_path || activeNavPath;
|
||||||
currentGoalIndex = currentGoalName
|
currentGoalIndex = currentGoalName
|
||||||
? defaultMissionGoals.findIndex(goal => goal.name === currentGoalName)
|
? defaultMissionGoals.findIndex(goal => goal.name === currentGoalName)
|
||||||
@@ -401,6 +433,11 @@ function applyMapMetadata(data) {
|
|||||||
setText('d-task-mission', defaultMissionName || '--', defaultMissionName ? 'ok' : '');
|
setText('d-task-mission', defaultMissionName || '--', defaultMissionName ? 'ok' : '');
|
||||||
setText('d-task-goals', String(defaultMissionGoals.length || 0), defaultMissionGoals.length ? 'ok' : '');
|
setText('d-task-goals', String(defaultMissionGoals.length || 0), defaultMissionGoals.length ? 'ok' : '');
|
||||||
setText('d-route-align', formatRouteAlignment(routeAlignmentInfo), routeAlignmentInfo.enabled ? 'ok' : 'warn');
|
setText('d-route-align', formatRouteAlignment(routeAlignmentInfo), routeAlignmentInfo.enabled ? 'ok' : 'warn');
|
||||||
|
setText(
|
||||||
|
'd-odom-fallback',
|
||||||
|
formatOdomFallback(odomFallbackInfo),
|
||||||
|
odomFallbackInfo.handoff_pending ? 'warn' : odomFallbackInfo.active ? 'active' : '',
|
||||||
|
);
|
||||||
updateTaskButtonState();
|
updateTaskButtonState();
|
||||||
renderTaskGoals();
|
renderTaskGoals();
|
||||||
}
|
}
|
||||||
@@ -527,6 +564,14 @@ function applyState(data) {
|
|||||||
syncGoalMarkerFromNavStatus(data.nav_status || '');
|
syncGoalMarkerFromNavStatus(data.nav_status || '');
|
||||||
|
|
||||||
const nav = data.nav || {};
|
const nav = data.nav || {};
|
||||||
|
if (nav.odom_fallback) {
|
||||||
|
odomFallbackInfo = nav.odom_fallback;
|
||||||
|
setText(
|
||||||
|
'd-odom-fallback',
|
||||||
|
formatOdomFallback(odomFallbackInfo),
|
||||||
|
odomFallbackInfo.handoff_pending ? 'warn' : odomFallbackInfo.active ? 'active' : '',
|
||||||
|
);
|
||||||
|
}
|
||||||
if (nav.pose) {
|
if (nav.pose) {
|
||||||
latestPose = nav.pose;
|
latestPose = nav.pose;
|
||||||
setText('d-nav-pose', `x=${nav.pose.x.toFixed(2)} y=${nav.pose.y.toFixed(2)} yaw=${(nav.pose.yaw * 57.2958).toFixed(1)}deg`);
|
setText('d-nav-pose', `x=${nav.pose.x.toFixed(2)} y=${nav.pose.y.toFixed(2)} yaw=${(nav.pose.yaw * 57.2958).toFixed(1)}deg`);
|
||||||
@@ -605,6 +650,47 @@ $('btn-estop').onclick = async () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
$('btn-refresh-map').onclick = fetchMap;
|
$('btn-refresh-map').onclick = fetchMap;
|
||||||
|
$('btn-odom-task').onclick = async () => {
|
||||||
|
if (!latestConnected) {
|
||||||
|
appendEvent('ODOM', 'bridge not connected', 'warn');
|
||||||
|
updateTaskButtonState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!defaultMissionName || !defaultMissionGoals.length) {
|
||||||
|
appendEvent('ODOM', 'no route mission loaded', 'warn');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const start = defaultMissionGoals[0];
|
||||||
|
const ok = confirm(
|
||||||
|
`Run odom fallback mission ${defaultMissionName}?\n\n` +
|
||||||
|
`Place the robot at waypoint id1 before confirming:\n` +
|
||||||
|
`x=${Number(start.x).toFixed(3)} y=${Number(start.y).toFixed(3)} yaw=${Number(start.yaw_deg || 0).toFixed(1)}deg`
|
||||||
|
);
|
||||||
|
if (!ok) return;
|
||||||
|
setLastGoalByName(start.name);
|
||||||
|
drawMap();
|
||||||
|
const result = await post({ type: 'odom_task' });
|
||||||
|
if (result.ok) {
|
||||||
|
highlightMode('NAV');
|
||||||
|
appendEvent('ODOM', `init at ${start.name}, run ${defaultMissionName}`, 'ok');
|
||||||
|
setTimeout(fetchMap, 400);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
$('btn-odom-stop').onclick = async () => {
|
||||||
|
if (!latestConnected) {
|
||||||
|
appendEvent('ODOM', 'bridge not connected', 'warn');
|
||||||
|
updateTaskButtonState();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const result = await post({ type: 'odom_stop' });
|
||||||
|
if (result.ok) {
|
||||||
|
odomFallbackInfo = { active: false };
|
||||||
|
setText('d-odom-fallback', formatOdomFallback(odomFallbackInfo), '');
|
||||||
|
updateTaskButtonState();
|
||||||
|
appendEvent('ODOM', 'fallback stopped', 'ok');
|
||||||
|
setTimeout(fetchMap, 400);
|
||||||
|
}
|
||||||
|
};
|
||||||
$('btn-run-task').onclick = async () => {
|
$('btn-run-task').onclick = async () => {
|
||||||
if (!latestConnected) {
|
if (!latestConnected) {
|
||||||
appendEvent('TASK', 'bridge not connected', 'warn');
|
appendEvent('TASK', 'bridge not connected', 'warn');
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||||
<title>sim2real ROS2 Console</title>
|
<title>sim2real ROS2 Console</title>
|
||||||
<link rel="stylesheet" href="style.css?v=mission-sync-2">
|
<link rel="stylesheet" href="style.css?v=odom-fallback-1">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<header class="glass-panel top-bar">
|
<header class="glass-panel top-bar">
|
||||||
@@ -56,6 +56,7 @@
|
|||||||
<div class="diag-row"><span class="diag-label">active goal</span><span class="diag-value" id="d-active-goal">--</span></div>
|
<div class="diag-row"><span class="diag-label">active goal</span><span class="diag-value" id="d-active-goal">--</span></div>
|
||||||
<div class="diag-row"><span class="diag-label">goal count</span><span class="diag-value" id="d-task-goals">--</span></div>
|
<div class="diag-row"><span class="diag-label">goal count</span><span class="diag-value" id="d-task-goals">--</span></div>
|
||||||
<div class="diag-row"><span class="diag-label">route align</span><span class="diag-value" id="d-route-align">--</span></div>
|
<div class="diag-row"><span class="diag-label">route align</span><span class="diag-value" id="d-route-align">--</span></div>
|
||||||
|
<div class="diag-row"><span class="diag-label">odom fallback</span><span class="diag-value" id="d-odom-fallback">--</span></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="panel-section flex-1">
|
<div class="panel-section flex-1">
|
||||||
@@ -70,6 +71,8 @@
|
|||||||
<h2 class="panel-title">PCD 2D Nav</h2>
|
<h2 class="panel-title">PCD 2D Nav</h2>
|
||||||
<div class="map-actions">
|
<div class="map-actions">
|
||||||
<button class="btn" id="btn-refresh-map">Refresh Map</button>
|
<button class="btn" id="btn-refresh-map">Refresh Map</button>
|
||||||
|
<button class="btn btn-odom" id="btn-odom-task" disabled>odom</button>
|
||||||
|
<button class="btn" id="btn-odom-stop" disabled>Exit odom</button>
|
||||||
<button class="btn btn-nav" id="btn-run-task" disabled>Run Mission</button>
|
<button class="btn btn-nav" id="btn-run-task" disabled>Run Mission</button>
|
||||||
<button class="btn" id="btn-record">Record Pose</button>
|
<button class="btn" id="btn-record">Record Pose</button>
|
||||||
<button class="btn" id="btn-stop-nav">Stop Nav</button>
|
<button class="btn" id="btn-stop-nav">Stop Nav</button>
|
||||||
@@ -121,6 +124,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script src="app.js?v=mission-sync-2"></script>
|
<script src="app.js?v=odom-fallback-1"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ body {
|
|||||||
.btn-remote { background: rgba(48,209,88,0.2); border-color: rgba(48,209,88,0.4); color: #8deda7; }
|
.btn-remote { background: rgba(48,209,88,0.2); border-color: rgba(48,209,88,0.4); color: #8deda7; }
|
||||||
.btn-web { background: rgba(10,132,255,0.2); border-color: rgba(10,132,255,0.4); color: #82c4ff; }
|
.btn-web { background: rgba(10,132,255,0.2); border-color: rgba(10,132,255,0.4); color: #82c4ff; }
|
||||||
.btn-nav { background: rgba(255,214,10,0.2); border-color: rgba(255,214,10,0.4); color: #ffe680; }
|
.btn-nav { background: rgba(255,214,10,0.2); border-color: rgba(255,214,10,0.4); color: #ffe680; }
|
||||||
|
.btn-odom { background: rgba(255,159,10,0.22); border-color: rgba(255,159,10,0.45); color: #ffd199; }
|
||||||
.btn.active-mode { box-shadow: 0 0 0 2px white; }
|
.btn.active-mode { box-shadow: 0 0 0 2px white; }
|
||||||
|
|
||||||
.route-select {
|
.route-select {
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
build/
|
||||||
|
install/
|
||||||
|
log/
|
||||||
|
logs_v2_web/
|
||||||
|
map/load/
|
||||||
|
src/odin_ros_driver/log/
|
||||||
|
src/odin_ros_driver/recorddata/
|
||||||
|
src/odin_ros_driver/image/
|
||||||
|
*.bak_*
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
.colcon/
|
||||||
|
.vscode/
|
||||||
|
compile_commands.json
|
||||||
@@ -0,0 +1,177 @@
|
|||||||
|
# ROS 2/C++ Sim2Real v3 比赛部署指南
|
||||||
|
|
||||||
|
本工作区保存最终比赛 ROS 2 Humble/C++ 部署主体。比赛使用的 Odin `1hao.bin` 未随备份归档,TensorRT engine 也与比赛机环境绑定,因此默认 `relocal` 闭环不是开箱即用;缺少真实地图时应按主 README 使用纯里程计模式。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. 前提条件与环境
|
||||||
|
|
||||||
|
### 硬件
|
||||||
|
* **目标计算机**:运行 Ubuntu 22.04 LTS 的 Jetson Orin Nano / Orin NX / AGX Orin。
|
||||||
|
* **IMU 传感器**:Odin 集成 IMU,发布至 `/odin1/imu`。
|
||||||
|
* **CAN 总线适配器**:Peak CAN、USB-to-CAN 或板载 SocketCAN 接口,使用 CAN0 和 CAN1。
|
||||||
|
|
||||||
|
### 主机依赖
|
||||||
|
* **操作系统**:Ubuntu 22.04 LTS (Jammy Jellyfish)。
|
||||||
|
* **ROS 2 发行版**:ROS 2 Humble(Desktop-Base 或 ROS-Base)。
|
||||||
|
* **C++ 编译器**:支持 C++17 的 GCC/G++ 9.0+。
|
||||||
|
* **库与 ROS2 包**:
|
||||||
|
* `libyaml-cpp-dev`
|
||||||
|
* `libeigen3-dev`
|
||||||
|
* `libusb-1.0-0-dev`(Odin USB 传感器通信)
|
||||||
|
* `libpcl-dev` 和 `libopencv-dev`(3D 点云与相机处理)
|
||||||
|
* `ros-humble-navigation2` 和 `ros-humble-nav2-bringup`(Nav2 规划器/控制器服务器)
|
||||||
|
* `ros-humble-pointcloud-to-laserscan`(点云转激光扫描,供 AMCL 使用)
|
||||||
|
* `ros-humble-cv-bridge` 和 `ros-humble-pcl-conversions`(Odin 传感器驱动图像与点云处理)
|
||||||
|
* `can-utils`(SocketCAN 验证工具)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. 本地编译与部署
|
||||||
|
|
||||||
|
按以下步骤在主机系统上编译运行整个栈:
|
||||||
|
|
||||||
|
### 步骤 1:安装系统依赖
|
||||||
|
```bash
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y build-essential cmake can-utils libyaml-cpp-dev libeigen3-dev \
|
||||||
|
libusb-1.0-0-dev libpcl-dev libopencv-dev ros-humble-navigation2 \
|
||||||
|
ros-humble-nav2-bringup ros-humble-pointcloud-to-laserscan \
|
||||||
|
ros-humble-cv-bridge ros-humble-pcl-conversions
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 2:下载 ONNXRuntime C++ SDK
|
||||||
|
策略需要 ONNXRuntime 库来运行推理。必须下载并解压到已知目录:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 创建目录
|
||||||
|
sudo mkdir -p /opt/onnxruntime
|
||||||
|
cd /opt
|
||||||
|
|
||||||
|
# 针对 Jetson Orin (ARM64 / aarch64):
|
||||||
|
sudo wget https://github.com/microsoft/onnxruntime/releases/download/v1.16.3/onnxruntime-linux-aarch64-1.16.3.tgz
|
||||||
|
sudo tar -zxvf onnxruntime-linux-aarch64-1.16.3.tgz --strip-components=1 -C /opt/onnxruntime
|
||||||
|
|
||||||
|
# 或标准桌面仿真 (x86_64 / amd64):
|
||||||
|
# sudo wget https://github.com/microsoft/onnxruntime/releases/download/v1.16.3/onnxruntime-linux-x64-1.16.3.tgz
|
||||||
|
# sudo tar -zxvf onnxruntime-linux-x64-1.16.3.tgz --strip-components=1 -C /opt/onnxruntime
|
||||||
|
```
|
||||||
|
|
||||||
|
导出 CMake 辅助变量:
|
||||||
|
```bash
|
||||||
|
export ONNXRUNTIME_DIR=/opt/onnxruntime
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 3:构建工作区
|
||||||
|
进入包含 `src/` 的本包根目录,运行 `colcon`:
|
||||||
|
```bash
|
||||||
|
colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 4:配置 SocketCAN 接口
|
||||||
|
启动前,以 1 Mbps 波特率激活 CAN 接口:
|
||||||
|
```bash
|
||||||
|
sudo ip link set can0 up type can bitrate 1000000
|
||||||
|
sudo ip link set can1 up type can bitrate 1000000
|
||||||
|
```
|
||||||
|
使用 `ifconfig` 或 `ip link` 验证接口已启动。
|
||||||
|
|
||||||
|
### 步骤 5:启动节点
|
||||||
|
使启动脚本可执行并运行:
|
||||||
|
```bash
|
||||||
|
chmod +x start_sim2real.sh
|
||||||
|
./start_sim2real.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Docker 部署(推荐)
|
||||||
|
|
||||||
|
强烈推荐使用 Docker 隔离依赖,避免 Jetson Orin 上的库版本冲突。
|
||||||
|
|
||||||
|
### 步骤 1:构建镜像
|
||||||
|
确保在 `sim2real_ros2_v3` 目录中(包含 `Dockerfile`):
|
||||||
|
```bash
|
||||||
|
# 使用标准 docker build:
|
||||||
|
docker build -t sim2real_ros2:latest .
|
||||||
|
|
||||||
|
# 或使用 Docker Compose:
|
||||||
|
docker compose build
|
||||||
|
```
|
||||||
|
|
||||||
|
### 步骤 2:运行容器
|
||||||
|
对于真实硬件部署,容器**必须**共享主机网络栈(用于 ROS2 DDS 和 SocketCAN)并具备线程优先级能力以实现实时调度:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 选项 A:手动运行
|
||||||
|
docker run -it \
|
||||||
|
--network host \
|
||||||
|
--privileged \
|
||||||
|
--cap-add=sys_nice \
|
||||||
|
--volume=/dev:/dev \
|
||||||
|
--shm-size=2g \
|
||||||
|
--name sim2real_ros2_run \
|
||||||
|
sim2real_ros2:latest
|
||||||
|
|
||||||
|
# 选项 B:通过 Docker Compose 运行(最简单)
|
||||||
|
docker compose up -d
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. 系统拓扑与话题
|
||||||
|
|
||||||
|
控制节点通过标准 ROS 2 DDS 消息与传感器驱动和导航栈交互:
|
||||||
|
|
||||||
|
* **IMU 输入**:订阅 `/odin1/imu`(`sensor_msgs/msg/Imu`)。硬件节点自动执行逆轴旋转(`x_raw = -y_ros`,`y_raw = x_ros`)以重建 RL 策略期望的原始坐标系。
|
||||||
|
* **控制命令**:订阅 `/cmd_vel` 和 `/cmd_vel_stamped`(`geometry_msgs/msg/Twist` / `TwistStamped`),由导航栈或手动键盘节点发布。
|
||||||
|
* **里程计输入**:订阅 `/odom`(`nav_msgs/msg/Odometry`),由 `odom_relay_node` 从 `/odin1/odometry` 中继并重映射帧名后提供。
|
||||||
|
* **急停**:订阅 `/safety/estop`(`std_msgs/msg/Bool`)。发布 `true` 触发软件急停,机器人进入低刚度阻尼刹车。
|
||||||
|
* **状态遥测**:发布 `runtime/state`(`sim2real_interfaces/msg/RuntimeState`),包含当前关节速度、温度、IMU 输出和诊断信息。
|
||||||
|
* **策略目标**:发布 `runtime/target`(`sim2real_interfaces/msg/RuntimeTarget`),包含策略推理输出的目标关节位置。
|
||||||
|
|
||||||
|
### TF 树
|
||||||
|
```
|
||||||
|
odom ──→ base_link (由 odom_relay_node 广播)
|
||||||
|
map ──→ odom (由 AMCL / Odin SLAM 发布,取决于运行模式)
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. 集成 ROS 2 导航与传感器驱动
|
||||||
|
|
||||||
|
### USB 设备权限(Odin 传感器)
|
||||||
|
要运行物理 Odin 传感器驱动(`odin_ros_driver`),目标计算机必须具有传感器 USB 接口的读写权限。在主机系统上添加以下 udev 规则:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. 添加 udev 规则
|
||||||
|
echo 'SUBSYSTEM=="usb", ATTR{idVendor}=="2207", ATTR{idProduct}=="0019", MODE="0666", GROUP="plugdev"' | sudo tee /etc/udev/rules.d/99-odin-usb.rules
|
||||||
|
|
||||||
|
# 2. 重新加载 udev 规则并重新插拔传感器
|
||||||
|
sudo udevadm control --reload
|
||||||
|
sudo udevadm trigger
|
||||||
|
```
|
||||||
|
|
||||||
|
### 集成启动参数
|
||||||
|
统一启动文件 `sim2real_system.launch.py` 支持模块化激活传感器驱动和 Nav2 导航栈:
|
||||||
|
|
||||||
|
* `launch_driver`(默认:`true`):启动 `odin_ros_driver` 节点以获取 IMU 和点云遥测。
|
||||||
|
* `launch_nav2`(默认:`false`):按需启动 ROS2 Navigation2;比赛默认使用 `simple_nav_node.py` 的路线跟踪。
|
||||||
|
|
||||||
|
#### 1. 完整真实硬件闭环(默认)
|
||||||
|
启动运动控制运行时、物理 CAN 桥接、Odin 传感器驱动和 Nav2 导航:
|
||||||
|
```bash
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py dry_run:=false launch_driver:=true launch_nav2:=true
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2. Dry-Run / 仿真航点测试
|
||||||
|
在 dry-run 模式下运行策略运行时和 Nav2 导航(不访问 CAN 总线或物理 USB 传感器,适合测试导航话题路由):
|
||||||
|
```bash
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py dry_run:=true launch_driver:=false launch_nav2:=true
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3. 仅运动控制(无导航)
|
||||||
|
禁用传感器驱动和 Nav2,让运动策略等待 `/cmd_vel` 上的手动速度输入(如键盘遥操作):
|
||||||
|
```bash
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py launch_driver:=false launch_nav2:=false
|
||||||
|
```
|
||||||
@@ -0,0 +1,79 @@
|
|||||||
|
# 使用 ROS2 官方 Humble 基础镜像
|
||||||
|
FROM ros:humble-ros-base-jammy
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
|
# 安装 C++ 编译依赖、SocketCAN 调试工具及 Eigen 等核心库
|
||||||
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
||||||
|
build-essential \
|
||||||
|
cmake \
|
||||||
|
git \
|
||||||
|
can-utils \
|
||||||
|
libyaml-cpp-dev \
|
||||||
|
libeigen3-dev \
|
||||||
|
libusb-1.0-0-dev \
|
||||||
|
libpcl-dev \
|
||||||
|
libopencv-dev \
|
||||||
|
ros-humble-navigation2 \
|
||||||
|
ros-humble-nav2-bringup \
|
||||||
|
ros-humble-pointcloud-to-laserscan \
|
||||||
|
ros-humble-cv-bridge \
|
||||||
|
ros-humble-pcl-conversions \
|
||||||
|
wget \
|
||||||
|
tar \
|
||||||
|
python3-pip \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
# ============================================================================
|
||||||
|
# ONNX Runtime — 架构自适应,aarch64 启用 CUDA GPU 加速
|
||||||
|
# ============================================================================
|
||||||
|
# - Orin Nano (aarch64): pip 安装 onnxruntime-gpu(含 CUDA EP)
|
||||||
|
# - x86_64 开发机: 下载 CPU-only 预编译包(GPU 不可用)
|
||||||
|
WORKDIR /opt
|
||||||
|
RUN ARCH=$(uname -m) && \
|
||||||
|
if [ "$ARCH" = "aarch64" ]; then \
|
||||||
|
echo "[ONNX] Installing CUDA-enabled ONNX Runtime for Jetson Orin..." && \
|
||||||
|
pip3 install --no-cache-dir onnxruntime-gpu && \
|
||||||
|
SITE_PKGS=$(python3 -c "import site; print(site.getsitepackages()[0])") && \
|
||||||
|
mkdir -p onnxruntime/include onnxruntime/lib && \
|
||||||
|
cp -r "$SITE_PKGS/onnxruntime/include/"* onnxruntime/include/ && \
|
||||||
|
cp "$SITE_PKGS/onnxruntime/capi/libonnxruntime.so"* onnxruntime/lib/ && \
|
||||||
|
echo "[ONNX] CUDA ONNX Runtime installed."; \
|
||||||
|
else \
|
||||||
|
echo "[ONNX] Installing CPU-only ONNX Runtime for x86_64 dev..." && \
|
||||||
|
wget -q https://github.com/microsoft/onnxruntime/releases/download/v1.16.3/onnxruntime-linux-x64-1.16.3.tgz && \
|
||||||
|
tar -zxf onnxruntime-linux-x64-1.16.3.tgz && \
|
||||||
|
mv onnxruntime-linux-x64-1.16.3 onnxruntime && \
|
||||||
|
rm onnxruntime-linux-x64-1.16.3.tgz; \
|
||||||
|
fi
|
||||||
|
|
||||||
|
ENV ONNXRUNTIME_DIR=/opt/onnxruntime
|
||||||
|
|
||||||
|
# 创建工作空间,将所有 C++ 源码包拷入
|
||||||
|
WORKDIR /sim2real_ws/src
|
||||||
|
COPY src/sim2real_bringup sim2real_bringup
|
||||||
|
COPY src/sim2real_common sim2real_common
|
||||||
|
COPY src/sim2real_hw sim2real_hw
|
||||||
|
COPY src/sim2real_interfaces sim2real_interfaces
|
||||||
|
COPY src/sim2real_runtime sim2real_runtime
|
||||||
|
COPY src/odin_ros_driver odin_ros_driver
|
||||||
|
COPY src/sim2real_nav2 sim2real_nav2
|
||||||
|
|
||||||
|
# 拷贝策略文件与运行脚本
|
||||||
|
WORKDIR /sim2real_ws
|
||||||
|
COPY policies policies
|
||||||
|
COPY map map
|
||||||
|
COPY start_sim2real.sh start_sim2real.sh
|
||||||
|
RUN chmod +x start_sim2real.sh
|
||||||
|
|
||||||
|
# 编译 ROS2 工作空间
|
||||||
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
RUN source /opt/ros/humble/setup.bash && \
|
||||||
|
colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release
|
||||||
|
|
||||||
|
# 拷贝 Docker 入口脚本并设置
|
||||||
|
COPY docker_entrypoint.sh /docker_entrypoint.sh
|
||||||
|
RUN chmod +x /docker_entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/docker_entrypoint.sh"]
|
||||||
|
CMD ["./start_sim2real.sh"]
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
# ROS 2 Sim2Real v3:最终比赛版
|
||||||
|
|
||||||
|
本目录由原始 `sim2real_ros2_v2(last_not_slalom_1050)` 整理而来,正式作为 ROS 2/C++ 第三版(v3),对应 RC_WheelLeg 在 RoboCon 仿生足式障碍赛使用的最终部署栈。`1050` 是比赛得分,不是模型编号;比赛 Rough 策略为 `model_6800.onnx`。
|
||||||
|
|
||||||
|
比赛代码快照首次归档于 `v1.0.0`,当时暂存于无后缀目录;`v1.1.0` 恢复无后缀初版并将本工程规范为 v3。训练架构和策略来源见 `v0.6.0`,比赛 Rough 模型首次归档见 `v0.8.0`,导航打点与路线演进见 `v0.8.1`,ROS 2 迁移过程见 `v0.10.0`~`v0.12.0`。
|
||||||
|
|
||||||
|
`v1.0.1` 只在比赛代码快照基础上补充机器人图片和比赛视频,没有改变本目录运行逻辑。
|
||||||
|
|
||||||
|
## 系统闭环
|
||||||
|
|
||||||
|
```text
|
||||||
|
Odin IMU / Odom ──> hardware bridge ──> RuntimeState
|
||||||
|
|
|
||||||
|
导航 / 遥控 / 屏幕 ──> cmd mux ──> policy runtime (50 Hz)
|
||||||
|
|
|
||||||
|
RuntimeTarget
|
||||||
|
|
|
||||||
|
hardware bridge / CAN (200 Hz)
|
||||||
|
```
|
||||||
|
|
||||||
|
核心约束:
|
||||||
|
|
||||||
|
- 53 维策略观测、16 维动作输出。
|
||||||
|
- Rough:`model_6800`,优先 TensorRT,失败时回退 ONNX Runtime。
|
||||||
|
- Wall:`model_84`,同样保留 TensorRT 与 ONNX 两种文件。
|
||||||
|
- Crawl:比赛配置使用解析 IK,不加载 Crawl RL 权重。
|
||||||
|
- 默认站姿:髋俯仰 `0.550`、膝关节 `-1.125`。
|
||||||
|
- 默认命令源:`NAV`;默认定位模式:`relocal`。
|
||||||
|
|
||||||
|
## 目录
|
||||||
|
|
||||||
|
```text
|
||||||
|
sim2real_ros2_v3/
|
||||||
|
├─ src/
|
||||||
|
│ ├─ sim2real_interfaces/ # RuntimeState / RuntimeTarget 消息
|
||||||
|
│ ├─ sim2real_common/ # 部署契约、滤波、平衡和安全监控
|
||||||
|
│ ├─ sim2real_hw/ # SocketCAN、IMU 和 200 Hz 电机热路径
|
||||||
|
│ ├─ sim2real_runtime/ # 策略、命令仲裁、导航、Web API
|
||||||
|
│ ├─ sim2real_nav2/ # Nav2 配置入口
|
||||||
|
│ ├─ sim2real_bringup/ # 统一参数和启动文件
|
||||||
|
│ └─ odin_ros_driver/ # Odin ROS 驱动(Apache-2.0)
|
||||||
|
├─ policies/ # 比赛实际使用的 Rough / Wall 模型
|
||||||
|
├─ map/ # 比赛路线和抽样 PCD
|
||||||
|
├─ screen/ # Orin 800×600 触控面板
|
||||||
|
├─ docs/ # 架构、遥控、Web 和迁移说明
|
||||||
|
├─ Dockerfile
|
||||||
|
└─ start_sim2real.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
## 构建与运行
|
||||||
|
|
||||||
|
目标环境是 Ubuntu 22.04、ROS 2 Humble 和 Jetson Orin。系统依赖和 Docker 流程见 [`DEPLOYMENT_GUIDE.md`](DEPLOYMENT_GUIDE.md)。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd 05_software/real/sim2real_ros2_v3
|
||||||
|
colcon build --merge-install --cmake-args -DCMAKE_BUILD_TYPE=Release
|
||||||
|
./start_sim2real.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
运行参数和模型/路线均使用工作区根目录相对路径,因此应从本目录启动。常用启动覆盖:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 纯里程计模式,不等待 Odin 重定位地图
|
||||||
|
./start_sim2real.sh localization_mode:=odom \
|
||||||
|
odin_config_file:=src/odin_ros_driver/config/control_command_odom.yaml
|
||||||
|
|
||||||
|
# 禁止驱动,仅做软件链路检查
|
||||||
|
./start_sim2real.sh launch_driver:=false launch_remote:=false
|
||||||
|
```
|
||||||
|
|
||||||
|
## 必须补充的部署资产
|
||||||
|
|
||||||
|
最终源目录配置引用了 Odin `map/1hao.bin`,但工作区备份中不存在这个文件;全盘检索也未找到同名文件。为避免用来源不明的 `.bin` 冒充比赛地图,本仓库不伪造该资产。
|
||||||
|
|
||||||
|
使用 `relocal` 前必须:
|
||||||
|
|
||||||
|
1. 从比赛 Orin 或 Odin 建图备份取得真实 `1hao.bin`。
|
||||||
|
2. 修改 `src/odin_ros_driver/config/control_command_relocal.yaml` 中的 `relocalization_map_abs_path` 为目标机绝对路径。
|
||||||
|
3. 核对文件哈希并在发布说明中补充来源。
|
||||||
|
|
||||||
|
缺少该文件时请使用 `localization_mode:=odom`,不要宣称重定位闭环已复现。地图和路线边界见 [`map/README.md`](map/README.md)。
|
||||||
|
|
||||||
|
## 归档边界
|
||||||
|
|
||||||
|
已保留:
|
||||||
|
|
||||||
|
- 最终六个 ROS 2 包、Odin 驱动源码、比赛设备标定参数和预编译 SDK 静态库。
|
||||||
|
- 最终 Rough/Wall ONNX 与比赛机 TensorRT engine。
|
||||||
|
- 五份最终工程路线、1 号场地抽样 PCD、屏幕 UI 和启动脚本。
|
||||||
|
- Odin 驱动 Apache-2.0 许可证。
|
||||||
|
|
||||||
|
未保留:
|
||||||
|
|
||||||
|
- 嵌套 `.git`、`__pycache__`、日志、备份、构建/安装目录。
|
||||||
|
- 未被比赛配置引用的候选模型与候选 TensorRT engine。
|
||||||
|
- 开发计划、任务草稿、重复地图工具和运行时轨迹。
|
||||||
|
- 原备份中大小为 0 的浏览器静态页面;HTTP JSON API 和屏幕 UI 源码仍保留。
|
||||||
|
|
||||||
|
TensorRT engine 与 JetPack、TensorRT 版本及 GPU 架构有关;其他机器应从同名 ONNX 重新生成,不应默认复用比赛 engine。模型哈希见 [`policies/README.md`](policies/README.md)。
|
||||||
|
|
||||||
|
## 安全与开源状态
|
||||||
|
|
||||||
|
- 真机运行前必须架空轮组验证 CAN 映射、方向、零位、急停和限幅。
|
||||||
|
- `deployment_contract.hpp` 是电机映射和动作缩放真值源;参考 YAML 不会自动修改 C++ 契约。
|
||||||
|
- 自研 ROS 包的 `package.xml` 仍保留原工程的 `Proprietary` 字段。迁移到 GitHub 公共开源前,需要由项目负责人选择许可证并统一修改;本次整理不代替权利人作许可证决定。
|
||||||
|
- 当前 Windows 环境只能做静态检查,不能证明 ROS 2、SocketCAN、Odin SDK 或 TensorRT 真机运行成功。
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
version: '3.8'
|
||||||
|
|
||||||
|
services:
|
||||||
|
sim2real_ros2:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
container_name: sim2real_ros2_node
|
||||||
|
runtime: nvidia
|
||||||
|
network_mode: host
|
||||||
|
privileged: true
|
||||||
|
stdin_open: true
|
||||||
|
tty: true
|
||||||
|
environment:
|
||||||
|
- NVIDIA_VISIBLE_DEVICES=all
|
||||||
|
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
|
||||||
|
cap_add:
|
||||||
|
- SYS_NICE
|
||||||
|
shm_size: '2gb'
|
||||||
|
volumes:
|
||||||
|
- /dev:/dev
|
||||||
|
restart: unless-stopped
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Source ROS2 Humble environment
|
||||||
|
source /opt/ros/humble/setup.bash
|
||||||
|
|
||||||
|
# Source workspace install setup if compiled
|
||||||
|
if [ -f "/sim2real_ws/install/setup.bash" ]; then
|
||||||
|
source /sim2real_ws/install/setup.bash
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
@@ -0,0 +1,102 @@
|
|||||||
|
# sim2real_ros2_v3 架构说明
|
||||||
|
|
||||||
|
## 设计目标
|
||||||
|
|
||||||
|
- 保留已验证的 RL 部署契约不变
|
||||||
|
- 将低延迟循环从 Python 迁移至 C++
|
||||||
|
- 暴露标准 ROS 2 接口用于导航和系统集成
|
||||||
|
- 保持安全边界独立于策略正确性
|
||||||
|
|
||||||
|
## 各包职责
|
||||||
|
|
||||||
|
### `sim2real_interfaces`(接口消息)
|
||||||
|
|
||||||
|
定义最小化的运行时消息:
|
||||||
|
|
||||||
|
- `RuntimeState`
|
||||||
|
硬件桥接发布的归一化运行时状态快照
|
||||||
|
- `RuntimeTarget`
|
||||||
|
策略运行时发送至硬件桥接的最新策略目标
|
||||||
|
|
||||||
|
### `sim2real_common`(共享常量)
|
||||||
|
|
||||||
|
存储编译期常量和部署契约辅助:
|
||||||
|
|
||||||
|
- 观测维度和字段布局
|
||||||
|
- 动作维度和轮子索引
|
||||||
|
- 关节顺序和默认站姿
|
||||||
|
- 动作缩放因子和默认循环频率
|
||||||
|
- Mahony 姿态滤波器
|
||||||
|
- 站立平衡控制器
|
||||||
|
- 安全监控器(SafetyMonitor / RuntimeGuard)
|
||||||
|
|
||||||
|
### `sim2real_hw`(硬件桥接)
|
||||||
|
|
||||||
|
拥有硬件侧执行循环和安全边界:
|
||||||
|
|
||||||
|
- RobStride CAN 收发
|
||||||
|
- IMU 与 Odin 状态采集
|
||||||
|
- 电机丢帧检测与保活逻辑(holdover)
|
||||||
|
- 看门狗与阻尼刹车
|
||||||
|
- 发布 `RuntimeState`
|
||||||
|
- 订阅 `RuntimeTarget`
|
||||||
|
- 订阅 `/odom` 里程计数据
|
||||||
|
|
||||||
|
目标热路径:
|
||||||
|
|
||||||
|
- 以 `200Hz` 频率读取状态
|
||||||
|
- 应用最新安全目标
|
||||||
|
- 超时或安全违规时立即停机
|
||||||
|
|
||||||
|
### `sim2real_runtime`(策略运行时)
|
||||||
|
|
||||||
|
拥有策略侧执行:
|
||||||
|
|
||||||
|
- 订阅 `RuntimeState`
|
||||||
|
- 按当前部署契约精确构建 `53D` 观测
|
||||||
|
- 以 `50Hz` 运行 ONNXRuntime 推理
|
||||||
|
- 对 raw_action 做 `[-10, 10]` 安全裁剪
|
||||||
|
- 发布 `RuntimeTarget`
|
||||||
|
- 仲裁命令来源:estop > safety_hold > startup > navigation > web
|
||||||
|
|
||||||
|
同时包含:
|
||||||
|
- `odom_relay_node`:将 `/odin1/odometry` 中继为 `/odom`,帧名 `odin1_base_link` → `base_link`,并广播 TF
|
||||||
|
|
||||||
|
### `sim2real_nav2`(导航配置)
|
||||||
|
|
||||||
|
拥有:
|
||||||
|
|
||||||
|
- Nav2 参数文件(planner、controller、costmap、AMCL、behavior)
|
||||||
|
- Nav2 启动文件(含 AMCL、costmap 生命周期节点、pointcloud_to_laserscan)
|
||||||
|
|
||||||
|
### `sim2real_bringup`(启动管理)
|
||||||
|
|
||||||
|
拥有:
|
||||||
|
|
||||||
|
- 参数文件
|
||||||
|
- 启动组合
|
||||||
|
- 运行时模式选择
|
||||||
|
- 集成 odin_ros_driver、sim2real_nav2 的条件启动
|
||||||
|
|
||||||
|
## 迁移规则
|
||||||
|
|
||||||
|
1. 优化之前先冻结当前契约
|
||||||
|
2. 先迁移传输和循环结构,再调整控制算法
|
||||||
|
3. C++ 运行时未达到影子模式一致性前,保留 Python 运行时可用
|
||||||
|
4. 按段测量延迟:
|
||||||
|
- 观测延迟
|
||||||
|
- 策略推理延迟
|
||||||
|
- 目标传输延迟
|
||||||
|
- 执行器响应延迟
|
||||||
|
|
||||||
|
## 首个里程碑
|
||||||
|
|
||||||
|
首个里程碑不是"机器人在 ROS 2 下行走",而是:
|
||||||
|
|
||||||
|
1. `sim2real_hw` 发布稳定的 `RuntimeState`
|
||||||
|
2. `sim2real_runtime` 从该状态构建正确的 `53D` 观测
|
||||||
|
3. `sim2real_runtime` 以 `50Hz` 发布 `RuntimeTarget`
|
||||||
|
4. `sim2real_hw` 消费最新目标并执行超时刹车
|
||||||
|
5. `cmd_vel` 可通过 ROS 2 注入而不改变策略契约
|
||||||
|
|
||||||
|
> ✅ 以上里程碑已全部完成。
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
# 迁移计划
|
||||||
|
|
||||||
|
> 版本范围:最终比赛 ROS 2 v3。本文继承自迁移阶段,用于解释架构来源,不是比赛部署资产完整性或新环境复现证明。
|
||||||
|
|
||||||
|
## Phase 1: 硬件核心迁移 ✅ 已完成
|
||||||
|
|
||||||
|
将当前高频热路径从 Python 迁出。
|
||||||
|
|
||||||
|
吸收的源文件:
|
||||||
|
|
||||||
|
- `sim2real/interface/motor_driver.py`
|
||||||
|
- `sim2real/interface/motor_mapping.py`
|
||||||
|
- `sim2real/interface/imu_client.py`
|
||||||
|
- `sim2real/safety/runtime_guard.py`
|
||||||
|
- `sim2real/web/session.py`
|
||||||
|
|
||||||
|
交付物:
|
||||||
|
|
||||||
|
- C++ SocketCAN 电机总线封装
|
||||||
|
- C++ 状态缓存
|
||||||
|
- target 超时保活(timeout hold)
|
||||||
|
- 阻尼刹车 / 急停通路
|
||||||
|
- 发布 `RuntimeState`
|
||||||
|
|
||||||
|
## Phase 2: 策略运行时迁移 ✅ 已完成
|
||||||
|
|
||||||
|
吸收的源文件:
|
||||||
|
|
||||||
|
- `sim2real/policy/policy_runner.py`
|
||||||
|
- `sim2real/interface/real_io.py`
|
||||||
|
- `sim2real/web/session.py`
|
||||||
|
|
||||||
|
交付物:
|
||||||
|
|
||||||
|
- 精确的 `53D` 观测构造器
|
||||||
|
- ONNXRuntime C++ 推理封装
|
||||||
|
- `50Hz` 策略定时器
|
||||||
|
- 命令平滑与来源仲裁
|
||||||
|
- raw_action `[-10, 10]` 安全裁剪
|
||||||
|
- 发布 `RuntimeTarget`
|
||||||
|
|
||||||
|
## Phase 3: ROS 2 系统集成 ✅ 已完成
|
||||||
|
|
||||||
|
参考过的外部项目包括 Odin ROS 驱动、EDULITE A3 ROS 工程和 RL-SAR;外部参考目录不属于本仓库公开内容。
|
||||||
|
|
||||||
|
交付物:
|
||||||
|
|
||||||
|
- `cmd_vel` / `cmd_vel_stamped` 输入(支持 Twist 和 TwistStamped)
|
||||||
|
- `odom_relay_node`:里程计中继 + TF 广播(odom → base_link)
|
||||||
|
- 诊断话题
|
||||||
|
- rosbag/foxglove 可观测性
|
||||||
|
|
||||||
|
## Phase 4: 导航集成 ✅ 已完成
|
||||||
|
|
||||||
|
目标:
|
||||||
|
|
||||||
|
- 导航通过 ROS 2 发送身体速度指令
|
||||||
|
- RL 运行时保持为 locomotion 控制器
|
||||||
|
- 看门狗和安全边界始终在导航之下
|
||||||
|
|
||||||
|
规则:
|
||||||
|
|
||||||
|
- 导航绝不直接写电机指令
|
||||||
|
- 策略契约在重新训练前保持不变
|
||||||
|
- 任何新增历史项或里程计项必须版本化
|
||||||
|
|
||||||
|
## 当前状态
|
||||||
|
|
||||||
|
所有 4 个 Phase 已全部完成。以下为已实现的关键组件:
|
||||||
|
|
||||||
|
| 组件 | 节点 | 说明 |
|
||||||
|
|------|------|------|
|
||||||
|
| 硬件桥接 | `sim2real_hw_node` | 200Hz CAN 收发 + IMU + Mahony + 安全 |
|
||||||
|
| 策略运行时 | `sim2real_runtime_node` | 50Hz ONNX 推理 + 53D 观测 + raw_action clip |
|
||||||
|
| 里程计中继 | `odom_relay_node` | /odin1/odometry → /odom + odom→base_link TF |
|
||||||
|
| 导航栈 | Nav2 全套节点 | AMCL + costmap + DWB + Navfn + BT + lifecycle |
|
||||||
|
| 传感器驱动 | `odin_ros_driver` | IMU + 点云 + 里程计原始发布 |
|
||||||
|
| 点云转换 | `pointcloud_to_laserscan` | 外部 ROS 包;/odin1/cloud_slam → /scan(供 AMCL 使用) |
|
||||||
@@ -0,0 +1,499 @@
|
|||||||
|
# sim2real_ros2_v3 遥控器调用说明
|
||||||
|
|
||||||
|
本文档说明如何在 `sim2real_ros2_v3` 中调用已接入的 SBUS UART 遥控器节点,以及执行后系统会产生什么效果。
|
||||||
|
|
||||||
|
## 1. 当前接入关系
|
||||||
|
|
||||||
|
遥控器节点位于:
|
||||||
|
|
||||||
|
```text
|
||||||
|
src/sim2real_runtime/src/remote_uart_node.py
|
||||||
|
```
|
||||||
|
|
||||||
|
该节点读取 SBUS 串口数据,并发布标准 ROS 2 控制话题:
|
||||||
|
|
||||||
|
| 输入 | 输出 | 作用 |
|
||||||
|
|---|---|---|
|
||||||
|
| SBUS UART 遥控器 | `/cmd_vel` | 给策略运行时发送速度命令 |
|
||||||
|
| SBUS CH7 高位 | `/safety/estop` | 触发软件急停 |
|
||||||
|
|
||||||
|
策略节点 `sim2real_runtime_node` 已经订阅 `/cmd_vel` 和 `/safety/estop`,所以遥控器不直接控制电机,而是通过 ROS 2 标准速度接口进入策略控制链路。
|
||||||
|
|
||||||
|
## 2. 通道映射
|
||||||
|
|
||||||
|
通道映射与本仓库第一代 Python Sim2Real 实现中的遥控器配置保持一致。
|
||||||
|
|
||||||
|
| 遥控器通道 | ROS 2 输出 | 含义 | 默认最大值 |
|
||||||
|
|---|---|---|---:|
|
||||||
|
| `CH2` | `cmd_vel.linear.x` | 前后速度 `vx` | `0.8 m/s` |
|
||||||
|
| `CH4` | `cmd_vel.linear.y` | 左右速度 `vy` | `0.3 m/s` |
|
||||||
|
| `CH1` | `cmd_vel.angular.z` | 转向角速度 `yaw` | `0.5 rad/s` |
|
||||||
|
| `CH7 HIGH` | `/safety/estop = true` | 软件急停 | - |
|
||||||
|
|
||||||
|
默认方向反转配置:
|
||||||
|
|
||||||
|
| 参数 | 默认值 | 含义 |
|
||||||
|
|---|---:|---|
|
||||||
|
| `remote_invert_vx` | `true` | 反转前后方向 |
|
||||||
|
| `remote_invert_vy` | `false` | 不反转横移方向 |
|
||||||
|
| `remote_invert_yaw` | `true` | 反转转向方向 |
|
||||||
|
|
||||||
|
## 3. 参数位置
|
||||||
|
|
||||||
|
遥控器参数在:
|
||||||
|
|
||||||
|
```text
|
||||||
|
src/sim2real_bringup/config/runtime.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
当前默认参数:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
remote_enabled: true
|
||||||
|
remote_port: "/dev/ttyACM0"
|
||||||
|
remote_baudrate: 100000
|
||||||
|
remote_timeout: 0.02
|
||||||
|
remote_axis_deadzone: 50
|
||||||
|
remote_active_threshold: 50
|
||||||
|
remote_axis_full_scale: 660.0
|
||||||
|
remote_max_vx: 0.8
|
||||||
|
remote_max_vy: 0.3
|
||||||
|
remote_max_yaw_rate: 0.5
|
||||||
|
remote_invert_vx: true
|
||||||
|
remote_invert_vy: false
|
||||||
|
remote_invert_yaw: true
|
||||||
|
remote_publish_inactive_zero: true
|
||||||
|
remote_estop_latch: true
|
||||||
|
remote_estop_channel: 7
|
||||||
|
remote_estop_level: "high"
|
||||||
|
remote_estop_debounce_frames: 3
|
||||||
|
remote_estop_require_remote_mode: true
|
||||||
|
remote_poll_hz: 50.0
|
||||||
|
```
|
||||||
|
|
||||||
|
如果遥控器串口不是 `/dev/ttyACM0`,需要修改:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
remote_port: "/dev/ttyUSB0"
|
||||||
|
```
|
||||||
|
|
||||||
|
或改成实际设备路径。
|
||||||
|
|
||||||
|
## 4. 启动前检查
|
||||||
|
|
||||||
|
### 4.1 确认串口存在
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ls /dev/ttyACM* /dev/ttyUSB*
|
||||||
|
```
|
||||||
|
|
||||||
|
如果使用默认配置,应能看到:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
/dev/ttyACM0
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4.2 确认串口权限
|
||||||
|
|
||||||
|
如果节点提示串口权限不足,可以临时执行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo chmod 666 /dev/ttyACM0
|
||||||
|
```
|
||||||
|
|
||||||
|
更推荐的长期方式是把当前用户加入 `dialout` 组:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo usermod -aG dialout $USER
|
||||||
|
```
|
||||||
|
|
||||||
|
然后重新登录。
|
||||||
|
|
||||||
|
### 4.3 确认 Python serial 依赖
|
||||||
|
|
||||||
|
节点依赖 `pyserial`。如果系统没有安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y python3-serial
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. 构建
|
||||||
|
|
||||||
|
如果刚修改过代码或参数,建议重新构建相关包:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /path/to/sim2real_ros2_v3
|
||||||
|
source /opt/ros/humble/setup.bash
|
||||||
|
colcon build --packages-select sim2real_runtime sim2real_bringup --symlink-install --merge-install
|
||||||
|
```
|
||||||
|
|
||||||
|
构建完成后 source 环境:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
source install/setup.bash
|
||||||
|
```
|
||||||
|
|
||||||
|
确认可执行节点存在:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 pkg executables sim2real_runtime
|
||||||
|
```
|
||||||
|
|
||||||
|
应包含:
|
||||||
|
|
||||||
|
```text
|
||||||
|
sim2real_runtime remote_uart_node.py
|
||||||
|
```
|
||||||
|
|
||||||
|
## 6. 推荐启动方式
|
||||||
|
|
||||||
|
### 6.1 启动完整系统,不启动 Nav2
|
||||||
|
|
||||||
|
这是你当前常用方式:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /path/to/sim2real_ros2_v3
|
||||||
|
source /opt/ros/humble/setup.bash
|
||||||
|
source install/setup.bash
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py launch_nav2:=false
|
||||||
|
```
|
||||||
|
|
||||||
|
默认情况下,`launch_remote:=true`,所以上面命令会同时启动遥控器节点。
|
||||||
|
|
||||||
|
等价完整写法:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py launch_nav2:=false launch_remote:=true
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6.2 不启动遥控器
|
||||||
|
|
||||||
|
如果只想用手动 `ros2 topic pub` 或其他上位机发 `/cmd_vel`,可以关闭遥控器节点:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py launch_nav2:=false launch_remote:=false
|
||||||
|
```
|
||||||
|
|
||||||
|
## 7. 单独启动遥控器节点
|
||||||
|
|
||||||
|
如果系统已经在运行,只想单独测试遥控器节点:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /path/to/sim2real_ros2_v3
|
||||||
|
source /opt/ros/humble/setup.bash
|
||||||
|
source install/setup.bash
|
||||||
|
ros2 run sim2real_runtime remote_uart_node.py --ros-args --params-file src/sim2real_bringup/config/runtime.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
如果要临时指定串口:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 run sim2real_runtime remote_uart_node.py --ros-args \
|
||||||
|
--params-file src/sim2real_bringup/config/runtime.yaml \
|
||||||
|
-p remote_port:=/dev/ttyUSB0
|
||||||
|
```
|
||||||
|
|
||||||
|
## 8. 执行后会产生什么效果
|
||||||
|
|
||||||
|
启动以下命令后:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py launch_nav2:=false
|
||||||
|
```
|
||||||
|
|
||||||
|
系统会产生以下效果。
|
||||||
|
|
||||||
|
### 8.1 启动硬件桥接节点
|
||||||
|
|
||||||
|
节点:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/sim2real_hw_node
|
||||||
|
```
|
||||||
|
|
||||||
|
效果:
|
||||||
|
|
||||||
|
1. 打开 `can0` 和 `can1`。
|
||||||
|
2. 如果 `dry_run: false` 且 CAN 初始化成功,会使能 16 个 RobStride 电机。
|
||||||
|
3. 设置电机 MIT 模式。
|
||||||
|
4. 设置电机速度限制和力矩限制。
|
||||||
|
5. 以 `200Hz` 运行硬件读写循环。
|
||||||
|
6. 发布 `/runtime/state`。
|
||||||
|
7. 订阅 `/runtime/target` 执行策略目标。
|
||||||
|
|
||||||
|
### 8.2 启动策略运行节点
|
||||||
|
|
||||||
|
节点:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/sim2real_runtime_node
|
||||||
|
```
|
||||||
|
|
||||||
|
效果:
|
||||||
|
|
||||||
|
1. 加载 ONNX 策略模型。
|
||||||
|
2. 订阅 `/runtime/state`。
|
||||||
|
3. 订阅 `/cmd_vel`。
|
||||||
|
4. 订阅 `/safety/estop`。
|
||||||
|
5. 执行启动站立流程:
|
||||||
|
- `boot_hold`
|
||||||
|
- `startup_soft_hold`
|
||||||
|
- `startup_hold`
|
||||||
|
- `runtime_zero_hold`
|
||||||
|
- `runtime_policy`
|
||||||
|
6. 以 `50Hz` 发布 `/runtime/target`。
|
||||||
|
|
||||||
|
### 8.3 启动遥控器节点
|
||||||
|
|
||||||
|
节点:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/sim2real_remote_uart_node
|
||||||
|
```
|
||||||
|
|
||||||
|
效果:
|
||||||
|
|
||||||
|
1. 打开默认串口 `/dev/ttyACM0`。
|
||||||
|
2. 以 `50Hz` 轮询 SBUS 数据。
|
||||||
|
3. 遥控器摇杆居中时持续发布零速度:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/cmd_vel:
|
||||||
|
linear.x = 0.0
|
||||||
|
linear.y = 0.0
|
||||||
|
angular.z = 0.0
|
||||||
|
```
|
||||||
|
|
||||||
|
4. 推动遥控器时发布非零速度,例如:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/cmd_vel:
|
||||||
|
linear.x = vx
|
||||||
|
linear.y = vy
|
||||||
|
angular.z = yaw
|
||||||
|
```
|
||||||
|
|
||||||
|
5. 当 CH7 打到高位时发布:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/safety/estop: true
|
||||||
|
```
|
||||||
|
|
||||||
|
由于当前 `remote_estop_latch: true`,急停是锁存式行为:在 `REMOTE` 模式下,CH7 连续 3 帧有效高位后,节点会发布急停,并保持内部急停已触发状态。恢复运行通常需要重启系统或手动发布复位信号,并确认机器人安全。
|
||||||
|
|
||||||
|
### 8.4 机器人行为效果
|
||||||
|
|
||||||
|
正常启动后,机器人不会立即按策略行走,而是按阶段执行:
|
||||||
|
|
||||||
|
1. 电机使能。
|
||||||
|
2. 读取当前关节位置。
|
||||||
|
3. 软保持当前姿态。
|
||||||
|
4. 平滑过渡到默认站立姿态。
|
||||||
|
5. 稳定后进入 runtime。
|
||||||
|
6. 遥控器无输入时保持站立平衡,即 `runtime_zero_hold`。
|
||||||
|
7. 遥控器有输入时进入策略控制,即 `runtime_policy`。
|
||||||
|
|
||||||
|
也就是说:
|
||||||
|
|
||||||
|
| 遥控器状态 | 机器人效果 |
|
||||||
|
|---|---|
|
||||||
|
| 摇杆居中 | 站立保持,不主动行走 |
|
||||||
|
| CH2 前后推动 | 前进/后退 |
|
||||||
|
| CH4 左右推动 | 横向移动 |
|
||||||
|
| CH1 左右推动 | 原地转向 |
|
||||||
|
| CH7 高位 | 软件急停,进入安全刹车 |
|
||||||
|
|
||||||
|
## 9. 如何确认遥控器已经生效
|
||||||
|
|
||||||
|
### 9.1 查看节点是否存在
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 node list
|
||||||
|
```
|
||||||
|
|
||||||
|
应看到:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/sim2real_remote_uart_node
|
||||||
|
/sim2real_runtime_node
|
||||||
|
/sim2real_hw_node
|
||||||
|
```
|
||||||
|
|
||||||
|
### 9.2 查看 `/cmd_vel`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 topic echo /cmd_vel
|
||||||
|
```
|
||||||
|
|
||||||
|
摇动遥控器时应看到 `linear.x`、`linear.y` 或 `angular.z` 变化。
|
||||||
|
|
||||||
|
### 9.3 查看 `/safety/estop`
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 topic echo /safety/estop
|
||||||
|
```
|
||||||
|
|
||||||
|
CH7 高位时应看到:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
data: true
|
||||||
|
```
|
||||||
|
|
||||||
|
### 9.4 查看策略目标阶段
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 topic echo /runtime/target --field target_source
|
||||||
|
```
|
||||||
|
|
||||||
|
常见输出含义:
|
||||||
|
|
||||||
|
| `target_source` | 含义 |
|
||||||
|
|---|---|
|
||||||
|
| `boot_hold` | 刚启动,保持初始姿态 |
|
||||||
|
| `startup_soft_hold` | 启动软保持 |
|
||||||
|
| `startup_hold` | 正在站立或站立后保持 |
|
||||||
|
| `runtime_zero_hold` | 已进入 runtime,遥控器无有效输入 |
|
||||||
|
| `runtime_policy` | 遥控器有输入,策略已经介入 |
|
||||||
|
| `safety_brake` | 安全刹车 |
|
||||||
|
| `timeout_hold` | 目标超时,硬件保持默认姿态 |
|
||||||
|
|
||||||
|
### 9.5 查看完整目标状态
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 topic echo --once /runtime/target
|
||||||
|
```
|
||||||
|
|
||||||
|
重点关注字段:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
target_source:
|
||||||
|
zero_command:
|
||||||
|
runtime_released:
|
||||||
|
release_alpha:
|
||||||
|
command:
|
||||||
|
raw_command:
|
||||||
|
```
|
||||||
|
|
||||||
|
如果遥控器摇杆有输入,通常会看到:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
target_source: runtime_policy
|
||||||
|
zero_command: false
|
||||||
|
runtime_released: true
|
||||||
|
release_alpha: 1.0
|
||||||
|
```
|
||||||
|
|
||||||
|
## 10. 常见问题
|
||||||
|
|
||||||
|
### 10.1 启动后提示无法打开串口
|
||||||
|
|
||||||
|
可能原因:
|
||||||
|
|
||||||
|
1. 串口路径不对。
|
||||||
|
2. 权限不足。
|
||||||
|
3. 设备没有插好。
|
||||||
|
4. 设备被其他程序占用。
|
||||||
|
|
||||||
|
检查:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ls /dev/ttyACM* /dev/ttyUSB*
|
||||||
|
```
|
||||||
|
|
||||||
|
修改 `runtime.yaml`:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
remote_port: "/dev/ttyUSB0"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 10.2 `/cmd_vel` 没有变化
|
||||||
|
|
||||||
|
检查:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 node list
|
||||||
|
ros2 topic echo /cmd_vel
|
||||||
|
```
|
||||||
|
|
||||||
|
如果节点存在但无变化,可能是:
|
||||||
|
|
||||||
|
1. 遥控器没有输出 SBUS。
|
||||||
|
2. 串口波特率不对。
|
||||||
|
3. SBUS 接线错误。
|
||||||
|
4. 遥控器通道未校准。
|
||||||
|
5. 死区 `remote_axis_deadzone` 或 `remote_active_threshold` 太大。
|
||||||
|
|
||||||
|
### 10.3 摇杆方向反了
|
||||||
|
|
||||||
|
修改:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
remote_invert_vx: true
|
||||||
|
remote_invert_vy: false
|
||||||
|
remote_invert_yaw: true
|
||||||
|
```
|
||||||
|
|
||||||
|
例如前后方向反了,就切换:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
remote_invert_vx: false
|
||||||
|
```
|
||||||
|
|
||||||
|
### 10.4 急停后不恢复
|
||||||
|
|
||||||
|
当前配置:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
remote_estop_latch: true
|
||||||
|
```
|
||||||
|
|
||||||
|
这表示急停锁存。触发后建议:
|
||||||
|
|
||||||
|
1. 先确认机器人物理安全。
|
||||||
|
2. 停止 launch。
|
||||||
|
3. 将 CH7 打回安全位置。
|
||||||
|
4. 重新启动系统。
|
||||||
|
|
||||||
|
如果需要非锁存模式,可以改为:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
remote_estop_latch: false
|
||||||
|
```
|
||||||
|
|
||||||
|
但实机调试时更建议使用锁存模式。
|
||||||
|
|
||||||
|
## 11. 快速验证命令清单
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /path/to/sim2real_ros2_v3
|
||||||
|
source /opt/ros/humble/setup.bash
|
||||||
|
source install/setup.bash
|
||||||
|
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py launch_nav2:=false
|
||||||
|
```
|
||||||
|
|
||||||
|
另开终端:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /path/to/sim2real_ros2_v3
|
||||||
|
source /opt/ros/humble/setup.bash
|
||||||
|
source install/setup.bash
|
||||||
|
|
||||||
|
ros2 node list
|
||||||
|
ros2 topic echo /cmd_vel
|
||||||
|
ros2 topic echo /runtime/target --field target_source
|
||||||
|
```
|
||||||
|
|
||||||
|
如果只测遥控器,不启动电机系统:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 run sim2real_runtime remote_uart_node.py --ros-args --params-file src/sim2real_bringup/config/runtime.yaml
|
||||||
|
```
|
||||||
|
|
||||||
|
另开终端:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 topic echo /cmd_vel
|
||||||
|
ros2 topic echo /safety/estop
|
||||||
|
```
|
||||||
@@ -0,0 +1,246 @@
|
|||||||
|
# sim2real_ros2_v3 Web UDP 调试说明
|
||||||
|
|
||||||
|
本文档说明本次新增的最小 Web 调试链路。
|
||||||
|
|
||||||
|
## 1. 架构
|
||||||
|
|
||||||
|
```text
|
||||||
|
Windows 本地浏览器/HTTP 服务
|
||||||
|
|
|
||||||
|
| UDP JSON
|
||||||
|
v
|
||||||
|
Nano: sim2real_web_udp_bridge_node.py
|
||||||
|
|
|
||||||
|
| ROS 2 topics
|
||||||
|
v
|
||||||
|
sim2real_cmd_mux_node.py -> /cmd_vel -> sim2real_runtime_node
|
||||||
|
```
|
||||||
|
|
||||||
|
Web 页面在 Windows 本地渲染,Nano 只运行轻量 UDP bridge 和 ROS2 节点。
|
||||||
|
|
||||||
|
## 2. 新增 ROS2 节点
|
||||||
|
|
||||||
|
### `remote_uart_node.py`
|
||||||
|
|
||||||
|
遥控器节点现在发布:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/cmd_vel_remote
|
||||||
|
```
|
||||||
|
|
||||||
|
不再直接发布 `/cmd_vel`。
|
||||||
|
|
||||||
|
通道触发阈值改为:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
remote_axis_deadzone: 40
|
||||||
|
remote_active_threshold: 40
|
||||||
|
```
|
||||||
|
|
||||||
|
只有通道归一化值绝对值大于 `40` 才认为是有效输入。
|
||||||
|
|
||||||
|
### `cmd_mux_node.py`
|
||||||
|
|
||||||
|
输入:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/cmd_vel_remote
|
||||||
|
/cmd_vel_web
|
||||||
|
/cmd_vel_nav
|
||||||
|
/control/mode
|
||||||
|
/remote/enabled
|
||||||
|
/web/enabled
|
||||||
|
/nav/enabled
|
||||||
|
/safety/estop
|
||||||
|
```
|
||||||
|
|
||||||
|
输出:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/cmd_vel
|
||||||
|
/control/mode_state
|
||||||
|
/control/mux_status
|
||||||
|
```
|
||||||
|
|
||||||
|
控制模式:
|
||||||
|
|
||||||
|
```text
|
||||||
|
DISABLED
|
||||||
|
REMOTE
|
||||||
|
WEB
|
||||||
|
NAV
|
||||||
|
```
|
||||||
|
|
||||||
|
急停 `/safety/estop=true` 会强制进入 `DISABLED`,并输出零速度。
|
||||||
|
|
||||||
|
### `web_udp_bridge_node.py`
|
||||||
|
|
||||||
|
Nano 端 UDP 监听:
|
||||||
|
|
||||||
|
```text
|
||||||
|
0.0.0.0:15000
|
||||||
|
```
|
||||||
|
|
||||||
|
发布:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/cmd_vel_web
|
||||||
|
/safety/estop
|
||||||
|
/control/mode
|
||||||
|
/web/enabled
|
||||||
|
/remote/enabled
|
||||||
|
/nav/enabled
|
||||||
|
```
|
||||||
|
|
||||||
|
订阅并回传状态:
|
||||||
|
|
||||||
|
```text
|
||||||
|
/runtime/state
|
||||||
|
/runtime/target
|
||||||
|
/cmd_vel
|
||||||
|
/safety/estop
|
||||||
|
/control/mode_state
|
||||||
|
/control/mux_status
|
||||||
|
```
|
||||||
|
|
||||||
|
## 3. Nano 启动
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /path/to/sim2real_ros2_v3
|
||||||
|
source /opt/ros/humble/setup.bash
|
||||||
|
source install/setup.bash
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py launch_nav2:=false
|
||||||
|
```
|
||||||
|
|
||||||
|
默认会启动:
|
||||||
|
|
||||||
|
```text
|
||||||
|
sim2real_remote_uart_node
|
||||||
|
sim2real_cmd_mux_node
|
||||||
|
sim2real_web_udp_bridge_node
|
||||||
|
```
|
||||||
|
|
||||||
|
如果不想启动 Web UDP bridge:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py launch_nav2:=false launch_web_bridge:=false
|
||||||
|
```
|
||||||
|
|
||||||
|
## 4. Windows 本地 Web 启动
|
||||||
|
|
||||||
|
把目录复制到 Windows 或通过共享目录访问:
|
||||||
|
|
||||||
|
```text
|
||||||
|
tools/win_web_debug
|
||||||
|
```
|
||||||
|
|
||||||
|
在 Windows 上安装 Python 3 后运行:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python server.py --nano-host <Nano_IP> --http-port 8088 --udp-port 15001
|
||||||
|
```
|
||||||
|
|
||||||
|
浏览器打开:
|
||||||
|
|
||||||
|
```text
|
||||||
|
http://127.0.0.1:8088
|
||||||
|
```
|
||||||
|
|
||||||
|
## 5. UDP 命令格式
|
||||||
|
|
||||||
|
### 切换模式
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"type":"mode","mode":"REMOTE"}
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"type":"mode","mode":"WEB"}
|
||||||
|
```
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"type":"mode","mode":"DISABLED"}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Web 速度控制
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"type": "cmd_vel",
|
||||||
|
"linear": {"x": 0.2, "y": 0.0, "z": 0.0},
|
||||||
|
"angular": {"x": 0.0, "y": 0.0, "z": 0.1}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Nano 端会再次限幅:
|
||||||
|
|
||||||
|
```text
|
||||||
|
vx <= ±0.8 m/s
|
||||||
|
vy <= ±0.3 m/s
|
||||||
|
yaw <= ±0.5 rad/s
|
||||||
|
```
|
||||||
|
|
||||||
|
### 零速度
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"type":"zero"}
|
||||||
|
```
|
||||||
|
|
||||||
|
### 软急停
|
||||||
|
|
||||||
|
```json
|
||||||
|
{"type":"estop","data":true}
|
||||||
|
```
|
||||||
|
|
||||||
|
## 6. 安全保护
|
||||||
|
|
||||||
|
当前最小版本已经包含:
|
||||||
|
|
||||||
|
1. 遥控器误触发阈值:`40`。
|
||||||
|
2. 遥控器/Web/Nav 互斥控制模式。
|
||||||
|
3. `cmd_mux` 二次限幅。
|
||||||
|
4. `cmd_mux` 加速度限制。
|
||||||
|
5. Web UDP 超时自动发布零速度。
|
||||||
|
6. 急停优先级最高。
|
||||||
|
7. Web 页面切换到 `WEB` 模式需要确认。
|
||||||
|
8. Web 松开虚拟摇杆会自动发送零速度。
|
||||||
|
|
||||||
|
建议实机调试流程:
|
||||||
|
|
||||||
|
1. 先点击 `DISABLED`。
|
||||||
|
2. 确认 `/cmd_vel` 为零。
|
||||||
|
3. 如果使用遥控器,点击 `REMOTE`。
|
||||||
|
4. 如果使用 Web,点击 `WEB` 并确认周围安全。
|
||||||
|
5. 一旦异常,立即点击 `软急停`。
|
||||||
|
|
||||||
|
## 7. 验证命令
|
||||||
|
|
||||||
|
查看最终输出速度:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 topic echo /cmd_vel
|
||||||
|
```
|
||||||
|
|
||||||
|
查看遥控器输入:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 topic echo /cmd_vel_remote
|
||||||
|
```
|
||||||
|
|
||||||
|
查看 Web 输入:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 topic echo /cmd_vel_web
|
||||||
|
```
|
||||||
|
|
||||||
|
查看当前仲裁模式:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 topic echo /control/mode_state
|
||||||
|
```
|
||||||
|
|
||||||
|
查看策略状态:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ros2 topic echo /runtime/target --field target_source
|
||||||
|
```
|
||||||
@@ -0,0 +1,164 @@
|
|||||||
|
# Pure Pursuit Yaw检查优化 - 最终配置
|
||||||
|
|
||||||
|
## 🎯 核心问题
|
||||||
|
|
||||||
|
**现象**: 机器人没转到位就开始前进 → 斜着撞杆子
|
||||||
|
|
||||||
|
**根本原因**: Pure Pursuit的yaw检查不够严格
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ✅ 已修改的参数
|
||||||
|
|
||||||
|
### runtime.yaml
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# 关键修改1: Script模式yaw门限
|
||||||
|
nav_slalom_script_yaw_gate_deg: 8.0 # 从12度 → 8度
|
||||||
|
|
||||||
|
# 关键修改2: 全局yaw容差
|
||||||
|
nav_goal_yaw_tolerance_deg: 8.0 # 从12度 → 8度
|
||||||
|
```
|
||||||
|
|
||||||
|
**作用**:
|
||||||
|
- yaw偏差 > 8度时:只转向,不前进
|
||||||
|
- yaw偏差 ≤ 8度时:才允许前进
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📊 完整配置总结
|
||||||
|
|
||||||
|
### 1. 禁用干扰的规划器
|
||||||
|
```yaml
|
||||||
|
nav_local_planner_enabled: false
|
||||||
|
nav_astar_enabled: false
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. 速度和精度
|
||||||
|
```yaml
|
||||||
|
nav_slalom_max_vx: 0.50
|
||||||
|
nav_slalom_lookahead: 0.15
|
||||||
|
nav_slalom_tolerance: 0.05
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. Yaw控制(新增)
|
||||||
|
```yaml
|
||||||
|
nav_goal_yaw_tolerance_deg: 8.0
|
||||||
|
nav_slalom_script_yaw_gate_deg: 8.0
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🔍 工作原理
|
||||||
|
|
||||||
|
### Pure Pursuit算法流程
|
||||||
|
```
|
||||||
|
1. 看前方lookahead距离的目标点
|
||||||
|
2. 计算到目标的方向和距离
|
||||||
|
3. 检查yaw偏差
|
||||||
|
- 如果 yaw偏差 > yaw_gate (8度):
|
||||||
|
只发wz转向,vx=0
|
||||||
|
- 如果 yaw偏差 ≤ yaw_gate (8度):
|
||||||
|
发vx前进 + wz微调
|
||||||
|
4. 到达目标点,推进下一个
|
||||||
|
```
|
||||||
|
|
||||||
|
### 之前的问题
|
||||||
|
```
|
||||||
|
yaw_gate = 12度(太宽松)
|
||||||
|
↓
|
||||||
|
yaw偏差11度时就开始前进
|
||||||
|
↓
|
||||||
|
还没对准就冲出去
|
||||||
|
↓
|
||||||
|
斜着撞杆子
|
||||||
|
```
|
||||||
|
|
||||||
|
### 修改后
|
||||||
|
```
|
||||||
|
yaw_gate = 8度(更严格)
|
||||||
|
↓
|
||||||
|
yaw偏差必须≤8度才前进
|
||||||
|
↓
|
||||||
|
基本对准后才移动
|
||||||
|
↓
|
||||||
|
不会斜着撞
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 📁 使用的文件
|
||||||
|
|
||||||
|
**路线**: `points_nav1007_optimized.json`
|
||||||
|
- 总航点: 47
|
||||||
|
- 绕杆航点: 21
|
||||||
|
- 参数: speed=0.50, lookahead=0.15, tolerance=0.05
|
||||||
|
|
||||||
|
**地形**: `tools/nav_tools/xml/A.xml`
|
||||||
|
|
||||||
|
**配置**: `runtime.yaml` (已修改)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🚀 下一步
|
||||||
|
|
||||||
|
### 实机测试
|
||||||
|
```bash
|
||||||
|
# 1. 重启系统加载新配置
|
||||||
|
ros2 launch sim2real_bringup sim2real_system.launch.py
|
||||||
|
|
||||||
|
# 2. 验证参数
|
||||||
|
ros2 param get /sim2real_simple_nav_node nav_slalom_script_yaw_gate_deg
|
||||||
|
# 应该显示: 8.0
|
||||||
|
|
||||||
|
ros2 param get /sim2real_simple_nav_node nav_goal_yaw_tolerance_deg
|
||||||
|
# 应该显示: 8.0
|
||||||
|
|
||||||
|
# 3. 加载路线
|
||||||
|
# 当前归档默认使用: sim2real_ros2_v3/map/routes/1hao_reall.json
|
||||||
|
|
||||||
|
# 4. 监控
|
||||||
|
ros2 topic echo /cmd_vel_nav
|
||||||
|
# 观察: 转向时vx应该接近0,对准后才有vx速度
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 💡 预期效果
|
||||||
|
|
||||||
|
**修改前**:
|
||||||
|
- 机器人边转边进
|
||||||
|
- yaw偏差大时仍有前进速度
|
||||||
|
- 导致斜着撞杆子
|
||||||
|
|
||||||
|
**修改后**:
|
||||||
|
- 转向时几乎不前进(vx≈0)
|
||||||
|
- 对准后才快速前进(vx=0.5)
|
||||||
|
- 动作分离:先转向,后前进
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## ⚠️ 如果还有问题
|
||||||
|
|
||||||
|
### 场景A: 还是斜着撞
|
||||||
|
可能需要进一步收紧:
|
||||||
|
```yaml
|
||||||
|
nav_slalom_script_yaw_gate_deg: 5.0 # 改为5度
|
||||||
|
```
|
||||||
|
|
||||||
|
### 场景B: 太慢,一直在转
|
||||||
|
说明yaw_gate太严格:
|
||||||
|
```yaml
|
||||||
|
nav_slalom_script_yaw_gate_deg: 10.0 # 放宽到10度
|
||||||
|
```
|
||||||
|
|
||||||
|
### 场景C: 卡顿
|
||||||
|
检查是否在等待yaw对准:
|
||||||
|
```bash
|
||||||
|
ros2 topic echo /simple_nav/status
|
||||||
|
# 看是否一直在"aligning"状态
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**配置已优化完成,ready for testing!** 🎯
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
|||||||
|
# 比赛地图与路线
|
||||||
|
|
||||||
|
`routes/` 保存 `last_not_slalom_1050` 工程中的五份路线快照,保留原文件名以维持运行时配置和版本演进关系。默认运行路线是 `routes/1hao_reall.json`。
|
||||||
|
|
||||||
|
`1hao.pcd` 是 `v0.8.1` 导航工具中同一份抽样点云,包含 199,215 点、大小 9,876,010 字节,SHA-256 为 `48B231C52BECA51316F352300C8B2046133E92359E0855227D93DEB0D927AD34`。它用于本地规划和路线显示,不替代原始高密度点云。
|
||||||
|
|
||||||
|
上述大小和 SHA-256 按 Git 中保存的 LF 字节计算;根目录 `.gitattributes` 禁止对 `*.pcd` 做跨平台换行转换。
|
||||||
|
|
||||||
|
## 缺失的 Odin 重定位地图
|
||||||
|
|
||||||
|
比赛配置需要 Odin 专用二进制地图 `1hao.bin`,但源备份没有该文件。源目录中另有两个名称和时间不同的 `.bin`,无法证明它们就是比赛使用地图,因此没有复制或重命名。
|
||||||
|
|
||||||
|
重定位部署时应从比赛设备取回真实文件,并把 `control_command_relocal.yaml` 中的占位绝对路径改为目标机实际位置。纯里程计模式不需要该文件。
|
||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
|||||||
|
# 比赛部署策略
|
||||||
|
|
||||||
|
这里只保留最终运行配置实际使用的 Rough 和 Wall 策略。Crawl 在比赛配置中使用 IK 后端,因此不归档未使用的 Crawl RL engine。
|
||||||
|
|
||||||
|
| 用途 | 文件 | SHA-256 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| Rough ONNX | `model_6800.onnx` | `3C994BDD3434AD15770A52AC0E8D229F502F00D6511CDD42C2E2C742301AEF13` |
|
||||||
|
| Rough TensorRT | `model_6800_fp16.engine` | `BDC6583AFD594E84D9A4AAA4BB2EEE279C7EBF207A57CF4802A2DF5309C5F663` |
|
||||||
|
| Wall ONNX | `model_84.onnx` | `E3A447782DF6C6E11E66C3ACBE41697FF88EBF5E75DCAB65EFCF9A2EB1CA639F` |
|
||||||
|
| Wall TensorRT | `model_84_fp16.engine` | `0FE2001113B7146B589D7A62A6E54BAD68574765EBA45782FB41A26F65A8721D` |
|
||||||
|
|
||||||
|
`model_6800.onnx` 与 `05_software/train/rc_mjlab/model_6800.onnx` 哈希一致。此处重复保留是为了让真机工作区可以独立部署。
|
||||||
|
|
||||||
|
TensorRT 文件只作为比赛机历史产物;更换 JetPack、TensorRT 或 GPU 后应从 ONNX 重新构建并重新核对数值误差。
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,22 @@
|
|||||||
|
# Orin 触控屏控制面板
|
||||||
|
|
||||||
|
`fullscreen_quit.py` 是比赛 Orin 外接 `800×600` 屏幕使用的控制面板,通过本机 `http://127.0.0.1:18080/api/*` 调用 ROS 2 Web bridge,不建立第二套控制协议。
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd <sim2real_ros2_v3工作区>
|
||||||
|
DISPLAY=:0 python3 screen/fullscreen_quit.py
|
||||||
|
```
|
||||||
|
|
||||||
|
程序默认从脚本父目录自动确定工作区,也可设置 `SIM2REAL_REPO_DIR` 覆盖。显示权限检查:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 screen/check_display.py
|
||||||
|
```
|
||||||
|
|
||||||
|
自启动脚本:
|
||||||
|
|
||||||
|
- `install_autostart.sh`:图形桌面登录后启动。
|
||||||
|
- `install_boot_service.sh <用户名>`:安装 systemd 服务。
|
||||||
|
- `uninstall_boot_service.sh`:卸载服务。
|
||||||
|
|
||||||
|
使用屏幕启动系统前,先完成工作区构建、Odin 配置、CAN 映射检查和急停验证。
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""
|
||||||
|
Print display-related diagnostics for launching the fullscreen quit screen.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import glob
|
||||||
|
import getpass
|
||||||
|
import os
|
||||||
|
import shlex
|
||||||
|
import subprocess
|
||||||
|
from typing import List, Optional
|
||||||
|
|
||||||
|
|
||||||
|
def run(command: List[str]) -> str:
|
||||||
|
try:
|
||||||
|
result = subprocess.run(
|
||||||
|
command,
|
||||||
|
check=False,
|
||||||
|
capture_output=True,
|
||||||
|
text=True,
|
||||||
|
)
|
||||||
|
except OSError as exc:
|
||||||
|
return f"<failed: {exc}>"
|
||||||
|
|
||||||
|
output = result.stdout.strip()
|
||||||
|
error = result.stderr.strip()
|
||||||
|
if error:
|
||||||
|
return f"{output}\n{error}".strip()
|
||||||
|
return output
|
||||||
|
|
||||||
|
|
||||||
|
def current_user() -> str:
|
||||||
|
try:
|
||||||
|
return getpass.getuser()
|
||||||
|
except OSError:
|
||||||
|
return os.environ.get("USER", "unknown")
|
||||||
|
|
||||||
|
|
||||||
|
def xauth_from_x_processes() -> List[str]:
|
||||||
|
output = run(["ps", "-eo", "args"])
|
||||||
|
candidates = []
|
||||||
|
for line in output.splitlines():
|
||||||
|
if "Xorg" not in line and "Xwayland" not in line:
|
||||||
|
continue
|
||||||
|
try:
|
||||||
|
parts = shlex.split(line)
|
||||||
|
except ValueError:
|
||||||
|
parts = line.split()
|
||||||
|
for index, part in enumerate(parts[:-1]):
|
||||||
|
if part == "-auth":
|
||||||
|
candidates.append(parts[index + 1])
|
||||||
|
return candidates
|
||||||
|
|
||||||
|
|
||||||
|
def print_path_status(label: str, path: Optional[str]) -> None:
|
||||||
|
if not path:
|
||||||
|
print(f"{label}: <unset>")
|
||||||
|
return
|
||||||
|
exists = os.path.exists(path)
|
||||||
|
readable = os.access(path, os.R_OK) if exists else False
|
||||||
|
print(f"{label}: {path} exists={exists} readable={readable}")
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
uid = os.getuid()
|
||||||
|
print(f"user: {run(['whoami'])}")
|
||||||
|
print(f"uid: {uid}")
|
||||||
|
print(f"DISPLAY: {os.environ.get('DISPLAY', '<unset>')}")
|
||||||
|
print(f"XAUTHORITY: {os.environ.get('XAUTHORITY', '<unset>')}")
|
||||||
|
print()
|
||||||
|
|
||||||
|
print("candidate XAUTHORITY files:")
|
||||||
|
candidates = [
|
||||||
|
os.environ.get("XAUTHORITY"),
|
||||||
|
*xauth_from_x_processes(),
|
||||||
|
os.path.expanduser("~/.Xauthority"),
|
||||||
|
f"/run/user/{uid}/gdm/Xauthority",
|
||||||
|
f"/run/user/{uid}/Xauthority",
|
||||||
|
*glob.glob(f"/run/user/{uid}/*Xauthority*"),
|
||||||
|
]
|
||||||
|
|
||||||
|
seen = set()
|
||||||
|
for candidate in candidates:
|
||||||
|
key = candidate or "<unset>"
|
||||||
|
if key in seen:
|
||||||
|
continue
|
||||||
|
seen.add(key)
|
||||||
|
print_path_status(" -", candidate)
|
||||||
|
|
||||||
|
print()
|
||||||
|
print("X server processes:")
|
||||||
|
x_lines = [
|
||||||
|
line
|
||||||
|
for line in run(["ps", "-eo", "user,args"]).splitlines()
|
||||||
|
if "Xorg" in line or "Xwayland" in line
|
||||||
|
]
|
||||||
|
if x_lines:
|
||||||
|
for line in x_lines:
|
||||||
|
print(f" {line}")
|
||||||
|
else:
|
||||||
|
print(" <none found>")
|
||||||
|
|
||||||
|
print()
|
||||||
|
print("recommended SSH launch:")
|
||||||
|
print(" cd <workspace>/screen")
|
||||||
|
print(" bash run_fullscreen_quit.sh")
|
||||||
|
print()
|
||||||
|
print("if authorization fails, run this on the Nano desktop terminal once:")
|
||||||
|
print(f" DISPLAY=:0 xhost +SI:localuser:{current_user()}")
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main())
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,27 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
AUTOSTART_DIR="$HOME/.config/autostart"
|
||||||
|
DESKTOP_FILE="$AUTOSTART_DIR/sim2real-screen.desktop"
|
||||||
|
|
||||||
|
mkdir -p "$AUTOSTART_DIR"
|
||||||
|
chmod +x "$SCRIPT_DIR/run_fullscreen_quit.sh"
|
||||||
|
|
||||||
|
cat > "$DESKTOP_FILE" <<EOF
|
||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=sim2real Screen
|
||||||
|
Comment=Start the sim2real touch control panel
|
||||||
|
Exec=$SCRIPT_DIR/run_fullscreen_quit.sh
|
||||||
|
Path=$SCRIPT_DIR
|
||||||
|
Terminal=false
|
||||||
|
X-GNOME-Autostart-enabled=true
|
||||||
|
StartupNotify=false
|
||||||
|
EOF
|
||||||
|
|
||||||
|
echo "Installed desktop autostart:"
|
||||||
|
echo " $DESKTOP_FILE"
|
||||||
|
echo
|
||||||
|
echo "It will start after this user logs into the graphical desktop."
|
||||||
|
echo "For boot-time use, enable automatic login for this user on the Orin desktop."
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if ! command -v systemctl >/dev/null 2>&1; then
|
||||||
|
echo "systemctl not found; this installer is for systemd-based Linux." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
SERVICE_NAME="sim2real-screen.service"
|
||||||
|
SERVICE_PATH="/etc/systemd/system/$SERVICE_NAME"
|
||||||
|
|
||||||
|
if [ "${EUID:-$(id -u)}" -eq 0 ]; then
|
||||||
|
RUN_USER="${1:-${SUDO_USER:-rc2}}"
|
||||||
|
else
|
||||||
|
RUN_USER="${1:-$(id -un)}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! id "$RUN_USER" >/dev/null 2>&1; then
|
||||||
|
echo "User '$RUN_USER' does not exist. Usage: bash install_boot_service.sh rc2" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
RUN_GROUP="$(id -gn "$RUN_USER")"
|
||||||
|
RUN_HOME="$(getent passwd "$RUN_USER" | cut -d: -f6)"
|
||||||
|
AUTOSTART_FILE="$RUN_HOME/.config/autostart/sim2real-screen.desktop"
|
||||||
|
|
||||||
|
chmod +x "$SCRIPT_DIR/run_fullscreen_quit.sh" "$SCRIPT_DIR/run_boot_screen_service.sh"
|
||||||
|
if [ -f "$AUTOSTART_FILE" ]; then
|
||||||
|
rm -f "$AUTOSTART_FILE"
|
||||||
|
echo "Removed desktop autostart to avoid duplicate screen instances:"
|
||||||
|
echo " $AUTOSTART_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
SERVICE_CONTENT="[Unit]
|
||||||
|
Description=sim2real touchscreen control panel
|
||||||
|
Wants=display-manager.service
|
||||||
|
After=systemd-user-sessions.service display-manager.service
|
||||||
|
StartLimitIntervalSec=0
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
User=$RUN_USER
|
||||||
|
Group=$RUN_GROUP
|
||||||
|
WorkingDirectory=$SCRIPT_DIR
|
||||||
|
Environment=HOME=$RUN_HOME
|
||||||
|
Environment=DISPLAY=:0
|
||||||
|
Environment=PYTHONUNBUFFERED=1
|
||||||
|
ExecStart=$SCRIPT_DIR/run_boot_screen_service.sh
|
||||||
|
Restart=always
|
||||||
|
RestartSec=2
|
||||||
|
KillSignal=SIGINT
|
||||||
|
TimeoutStopSec=20
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=graphical.target
|
||||||
|
"
|
||||||
|
|
||||||
|
printf "%s" "$SERVICE_CONTENT" | sudo tee "$SERVICE_PATH" >/dev/null
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable "$SERVICE_NAME"
|
||||||
|
|
||||||
|
echo "Installed and enabled:"
|
||||||
|
echo " $SERVICE_PATH"
|
||||||
|
echo
|
||||||
|
echo "Start now:"
|
||||||
|
echo " sudo systemctl restart $SERVICE_NAME"
|
||||||
|
echo
|
||||||
|
echo "Check status/logs:"
|
||||||
|
echo " systemctl status $SERVICE_NAME --no-pager"
|
||||||
|
echo " journalctl -u $SERVICE_NAME -f"
|
||||||
|
echo
|
||||||
|
echo "Important: the graphical desktop for user '$RUN_USER' must auto-login, otherwise Tk cannot open DISPLAY=:0."
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
export DISPLAY="${DISPLAY:-:0}"
|
||||||
|
export PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
|
echo "[sim2real-screen] service starting as $(id -un), DISPLAY=$DISPLAY"
|
||||||
|
|
||||||
|
for _ in $(seq 1 120); do
|
||||||
|
if [ -S "/tmp/.X11-unix/X${DISPLAY#:}" ]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -S "/tmp/.X11-unix/X${DISPLAY#:}" ]; then
|
||||||
|
echo "[sim2real-screen] X11 socket for DISPLAY=$DISPLAY not found" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$SCRIPT_DIR/run_fullscreen_quit.sh"
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -u
|
||||||
|
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
cd "$SCRIPT_DIR"
|
||||||
|
|
||||||
|
export DISPLAY="${DISPLAY:-:0}"
|
||||||
|
|
||||||
|
if [ -z "${XAUTHORITY:-}" ]; then
|
||||||
|
UID_VALUE="$(id -u)"
|
||||||
|
|
||||||
|
for candidate in \
|
||||||
|
"$HOME/.Xauthority" \
|
||||||
|
"/run/user/$UID_VALUE/gdm/Xauthority" \
|
||||||
|
"/run/user/$UID_VALUE/Xauthority"
|
||||||
|
do
|
||||||
|
if [ -f "$candidate" ]; then
|
||||||
|
export XAUTHORITY="$candidate"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
python3 fullscreen_quit.py
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 34 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
@@ -0,0 +1,11 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
SERVICE_NAME="sim2real-screen.service"
|
||||||
|
SERVICE_PATH="/etc/systemd/system/$SERVICE_NAME"
|
||||||
|
|
||||||
|
sudo systemctl disable --now "$SERVICE_NAME" 2>/dev/null || true
|
||||||
|
sudo rm -f "$SERVICE_PATH"
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
|
||||||
|
echo "Removed $SERVICE_NAME"
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
recorddata/
|
||||||
|
/config/calib.yaml
|
||||||
|
!/config/calib.yaml
|
||||||
|
/log
|
||||||
|
/map
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
v0.11.0 2026_0618
|
||||||
|
Required Minimum Firmware Version:0.12.0
|
||||||
|
1.Reduce cloud slam latency
|
||||||
|
2.Improve get mapping result
|
||||||
|
|
||||||
|
v0.10.5 2026_0525
|
||||||
|
1.modify recorddata format,add device_id、algorithm_version key
|
||||||
|
2.fix download map fail when in slam mode(USB2.0)
|
||||||
|
3.fix upload map fail when in relocalization mode(USB2.0)
|
||||||
|
|
||||||
|
v0.10.4 2026_0522
|
||||||
|
1.fix usb2.0 heartBeat timeout to cause soft detaching
|
||||||
|
2.add custom_init_pose_search_radius and custom_init_pose_max_rot_deg in control_command.yaml
|
||||||
@@ -0,0 +1,488 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
project(odin_ros_driver)
|
||||||
|
|
||||||
|
|
||||||
|
if(DEFINED BUILD_SYSTEM)
|
||||||
|
set(ROS_VERSION ${BUILD_SYSTEM})
|
||||||
|
message(STATUS "ROS_VERSION: ${ROS_VERSION}")
|
||||||
|
elseif(DEFINED ENV{ROS_DISTRO})
|
||||||
|
if("$ENV{ROS_DISTRO}" MATCHES "foxy|galactic|humble|iron|rolling")
|
||||||
|
set(ROS_VERSION "ROS2")
|
||||||
|
else()
|
||||||
|
set(ROS_VERSION "ROS1")
|
||||||
|
endif()
|
||||||
|
elseif(DEFINED ENV{ROS_VERSION})
|
||||||
|
if("$ENV{ROS_VERSION}" EQUAL "2")
|
||||||
|
set(ROS_VERSION "ROS2")
|
||||||
|
else()
|
||||||
|
set(ROS_VERSION "ROS1")
|
||||||
|
endif()
|
||||||
|
else()
|
||||||
|
# Attempt automatic detection
|
||||||
|
if(COMMAND catkin_package)
|
||||||
|
set(ROS_VERSION "ROS1")
|
||||||
|
elseif(COMMAND ament_package)
|
||||||
|
set(ROS_VERSION "ROS2")
|
||||||
|
else()
|
||||||
|
# Default to ROS2
|
||||||
|
set(ROS_VERSION "ROS2")
|
||||||
|
message(WARNING "Unable to determine ROS version, defaulting to ROS2")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add compile definitions after detecting ROS version
|
||||||
|
if(ROS_VERSION STREQUAL "ROS2")
|
||||||
|
add_definitions(-DROS2)
|
||||||
|
message(STATUS "Defining ROS2")
|
||||||
|
else()
|
||||||
|
add_definitions(-DROS1)
|
||||||
|
message(STATUS "Defining ROS1")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
message(STATUS "Build system: ${ROS_VERSION}")
|
||||||
|
|
||||||
|
# Platform detection
|
||||||
|
execute_process(
|
||||||
|
COMMAND uname -m
|
||||||
|
OUTPUT_VARIABLE ARCH
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
|
)
|
||||||
|
|
||||||
|
if(ARCH STREQUAL "x86_64")
|
||||||
|
set(TARGET_PLATFORM "x86")
|
||||||
|
message(STATUS "Detected x86_64 architecture")
|
||||||
|
elseif(ARCH MATCHES "arm|aarch64")
|
||||||
|
set(TARGET_PLATFORM "arm")
|
||||||
|
message(STATUS "Detected ARM architecture: ${ARCH}")
|
||||||
|
else()
|
||||||
|
message(WARNING "Unsupported architecture: ${ARCH}. Using default settings")
|
||||||
|
set(TARGET_PLATFORM "unknown")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set library path
|
||||||
|
set(LIB_DIR "${CMAKE_CURRENT_SOURCE_DIR}/lib")
|
||||||
|
message(STATUS "Library directory: ${LIB_DIR}")
|
||||||
|
|
||||||
|
# Set library name based on platform
|
||||||
|
if(TARGET_PLATFORM STREQUAL "arm")
|
||||||
|
set(LYD_HOST_API_LIB_NAME "lydHostApi_arm")
|
||||||
|
else()
|
||||||
|
set(LYD_HOST_API_LIB_NAME "lydHostApi_amd")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Find precompiled lydHostApi library
|
||||||
|
find_library(LYD_HOST_API_LIB
|
||||||
|
NAMES
|
||||||
|
${LYD_HOST_API_LIB_NAME}
|
||||||
|
lib${LYD_HOST_API_LIB_NAME}.a
|
||||||
|
lib${LYD_HOST_API_LIB_NAME}.so
|
||||||
|
PATHS ${LIB_DIR}
|
||||||
|
NO_DEFAULT_PATH
|
||||||
|
)
|
||||||
|
|
||||||
|
if(LYD_HOST_API_LIB)
|
||||||
|
message(STATUS "Found lydHostApi library: ${LYD_HOST_API_LIB}")
|
||||||
|
else()
|
||||||
|
file(GLOB LIB_FILES "${LIB_DIR}/lib${LYD_HOST_API_LIB_NAME}.*")
|
||||||
|
if(LIB_FILES)
|
||||||
|
message(STATUS "Found library files: ${LIB_FILES}")
|
||||||
|
set(LYD_HOST_API_LIB ${LIB_FILES})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Could not find precompiled lydHostApi library in ${LIB_DIR}")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Set common compile options
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
# Set optimization flags
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
|
||||||
|
|
||||||
|
# Find common dependencies
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
find_package(OpenCV REQUIRED)
|
||||||
|
find_package(Eigen3 REQUIRED)
|
||||||
|
find_package(PCL REQUIRED)
|
||||||
|
find_package(yaml-cpp REQUIRED)
|
||||||
|
find_package(OpenSSL REQUIRED)
|
||||||
|
pkg_check_modules(LIBUSB REQUIRED libusb-1.0)
|
||||||
|
|
||||||
|
# Shared include directories
|
||||||
|
include_directories(
|
||||||
|
include
|
||||||
|
${EIGEN3_INCLUDE_DIRS}
|
||||||
|
${OpenCV_INCLUDE_DIRS}
|
||||||
|
${PCL_INCLUDE_DIRS}
|
||||||
|
${yaml-cpp_INCLUDE_DIR}
|
||||||
|
${LIBUSB_INCLUDE_DIRS}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
# Shared library list
|
||||||
|
set(COMMON_LIBS
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
${yaml-cpp_LIBRARIES}
|
||||||
|
${OPENSSL_LIBRARIES}
|
||||||
|
${LIBUSB_LIBRARIES}
|
||||||
|
pthread
|
||||||
|
rt
|
||||||
|
${CMAKE_DL_LIBS}
|
||||||
|
${LYD_HOST_API_LIB}
|
||||||
|
)
|
||||||
|
|
||||||
|
# ===== ROS1 Configuration =====
|
||||||
|
if(ROS_VERSION STREQUAL "ROS1")
|
||||||
|
message(STATUS "Configuring for ROS1 build")
|
||||||
|
|
||||||
|
find_package(catkin REQUIRED COMPONENTS
|
||||||
|
roscpp
|
||||||
|
std_msgs
|
||||||
|
sensor_msgs
|
||||||
|
nav_msgs
|
||||||
|
cv_bridge
|
||||||
|
tf
|
||||||
|
image_transport
|
||||||
|
message_generation
|
||||||
|
)
|
||||||
|
|
||||||
|
# ---- AE/AWB debug services ----
|
||||||
|
# Declare custom .srv files; catkin generates ros1 message headers for them.
|
||||||
|
add_service_files(
|
||||||
|
FILES
|
||||||
|
GetAe.srv
|
||||||
|
GetAwb.srv
|
||||||
|
SetAe.srv
|
||||||
|
SetAwb.srv
|
||||||
|
)
|
||||||
|
generate_messages(
|
||||||
|
DEPENDENCIES
|
||||||
|
std_msgs
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(${catkin_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
catkin_package(
|
||||||
|
CATKIN_DEPENDS roscpp std_msgs sensor_msgs nav_msgs cv_bridge image_transport message_runtime
|
||||||
|
INCLUDE_DIRS include
|
||||||
|
)
|
||||||
|
|
||||||
|
# Set output directories
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib/${PROJECT_NAME})
|
||||||
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib)
|
||||||
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CATKIN_DEVEL_PREFIX}/lib)
|
||||||
|
|
||||||
|
add_executable(host_sdk_sample
|
||||||
|
src/host_sdk_sample.cpp
|
||||||
|
src/yaml_parser.cpp
|
||||||
|
src/rawCloudRender.cpp
|
||||||
|
src/camera_pose_visualization.cpp
|
||||||
|
)
|
||||||
|
target_link_libraries(host_sdk_sample
|
||||||
|
${catkin_LIBRARIES}
|
||||||
|
${COMMON_LIBS}
|
||||||
|
${LYD_HOST_API_LIB}
|
||||||
|
${LIBUSB_LIBRARIES}
|
||||||
|
yaml-cpp
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
pthread
|
||||||
|
usb-1.0
|
||||||
|
)
|
||||||
|
# Make sure the AE/AWB srv headers are generated before host_sdk_sample
|
||||||
|
# is compiled (catkin's generate_messages produces this target).
|
||||||
|
add_dependencies(host_sdk_sample ${PROJECT_NAME}_generate_messages_cpp)
|
||||||
|
|
||||||
|
add_library(pointcloud_depth_converter src/pointcloud_depth_converter.cpp)
|
||||||
|
target_link_libraries(pointcloud_depth_converter
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
)
|
||||||
|
add_library(depth_image_ros_node src/depth_image_ros_node.cpp)
|
||||||
|
target_link_libraries(depth_image_ros_node
|
||||||
|
pointcloud_depth_converter
|
||||||
|
${catkin_LIBRARIES}
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
)
|
||||||
|
add_executable(pcd2depth_node src/pcd2depth_ros.cpp)
|
||||||
|
target_link_libraries(pcd2depth_node
|
||||||
|
depth_image_ros_node
|
||||||
|
${catkin_LIBRARIES}
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(cloud_reprojector src/cloud_reprojector.cpp)
|
||||||
|
target_link_libraries(cloud_reprojector
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(cloud_reprojection_node src/cloud_reprojection_ros.cpp)
|
||||||
|
target_link_libraries(cloud_reprojection_node
|
||||||
|
cloud_reprojector
|
||||||
|
${catkin_LIBRARIES}
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(image_overlay_node src/image_overlay_node.cpp)
|
||||||
|
target_link_libraries(image_overlay_node
|
||||||
|
${catkin_LIBRARIES}
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Installation rules
|
||||||
|
install(TARGETS host_sdk_sample
|
||||||
|
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
|
||||||
|
)
|
||||||
|
|
||||||
|
install(DIRECTORY include/
|
||||||
|
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
|
||||||
|
FILES_MATCHING PATTERN "*.h"
|
||||||
|
)
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/config")
|
||||||
|
install(DIRECTORY config/
|
||||||
|
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ===== ROS2 Configuration =====
|
||||||
|
elseif(ROS_VERSION STREQUAL "ROS2")
|
||||||
|
message(STATUS "Configuring for ROS2 build")
|
||||||
|
|
||||||
|
# Find all necessary ROS2 packages
|
||||||
|
find_package(ament_cmake REQUIRED)
|
||||||
|
find_package(rclcpp REQUIRED)
|
||||||
|
find_package(std_msgs REQUIRED)
|
||||||
|
find_package(sensor_msgs REQUIRED)
|
||||||
|
find_package(nav_msgs REQUIRED)
|
||||||
|
find_package(visualization_msgs REQUIRED)
|
||||||
|
find_package(cv_bridge REQUIRED)
|
||||||
|
find_package(image_transport REQUIRED)
|
||||||
|
find_package(pcl_conversions REQUIRED)
|
||||||
|
find_package(message_filters REQUIRED)
|
||||||
|
find_package(tf2 REQUIRED)
|
||||||
|
find_package(tf2_ros REQUIRED)
|
||||||
|
find_package(geometry_msgs REQUIRED)
|
||||||
|
find_package(tf2_geometry_msgs REQUIRED)
|
||||||
|
find_package(ament_index_cpp REQUIRED)
|
||||||
|
|
||||||
|
# ---- AE/AWB debug services ----
|
||||||
|
# Generate C++ bindings for the 4 .srv files in srv/. The generated
|
||||||
|
# headers are linked into host_sdk_sample so it can host the services.
|
||||||
|
find_package(rosidl_default_generators REQUIRED)
|
||||||
|
rosidl_generate_interfaces(${PROJECT_NAME}
|
||||||
|
"srv/GetAe.srv"
|
||||||
|
"srv/GetAwb.srv"
|
||||||
|
"srv/SetAe.srv"
|
||||||
|
"srv/SetAwb.srv"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create executable
|
||||||
|
add_executable(host_sdk_sample
|
||||||
|
src/host_sdk_sample.cpp
|
||||||
|
src/yaml_parser.cpp
|
||||||
|
src/rawCloudRender.cpp
|
||||||
|
src/camera_pose_visualization.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
# Link libraries
|
||||||
|
target_link_libraries(host_sdk_sample
|
||||||
|
${COMMON_LIBS}
|
||||||
|
yaml-cpp
|
||||||
|
usb-1.0
|
||||||
|
)
|
||||||
|
|
||||||
|
# Link the generated AE/AWB srv typesupport into host_sdk_sample so it
|
||||||
|
# can host the 4 debug services.
|
||||||
|
rosidl_get_typesupport_target(cpp_typesupport_target
|
||||||
|
${PROJECT_NAME} "rosidl_typesupport_cpp")
|
||||||
|
target_link_libraries(host_sdk_sample "${cpp_typesupport_target}")
|
||||||
|
|
||||||
|
# Add ROS2 dependencies
|
||||||
|
ament_target_dependencies(host_sdk_sample
|
||||||
|
rclcpp
|
||||||
|
std_msgs
|
||||||
|
sensor_msgs
|
||||||
|
nav_msgs
|
||||||
|
visualization_msgs
|
||||||
|
cv_bridge
|
||||||
|
image_transport
|
||||||
|
tf2
|
||||||
|
tf2_ros
|
||||||
|
geometry_msgs
|
||||||
|
tf2_geometry_msgs
|
||||||
|
ament_index_cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(pointcloud_depth_converter_ros2 src/pointcloud_depth_converter.cpp)
|
||||||
|
target_link_libraries(pointcloud_depth_converter_ros2
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(depth_image_ros2_node_lib src/depth_image_ros2_node.cpp)
|
||||||
|
target_link_libraries(depth_image_ros2_node_lib
|
||||||
|
pointcloud_depth_converter_ros2
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
ament_target_dependencies(depth_image_ros2_node_lib
|
||||||
|
rclcpp
|
||||||
|
sensor_msgs
|
||||||
|
std_msgs
|
||||||
|
cv_bridge
|
||||||
|
image_transport
|
||||||
|
pcl_conversions
|
||||||
|
message_filters
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(pcd2depth_ros2_node src/pcd2depth_ros2.cpp)
|
||||||
|
target_link_libraries(pcd2depth_ros2_node
|
||||||
|
depth_image_ros2_node_lib
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
yaml-cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
ament_target_dependencies(pcd2depth_ros2_node
|
||||||
|
rclcpp
|
||||||
|
sensor_msgs
|
||||||
|
std_msgs
|
||||||
|
cv_bridge
|
||||||
|
image_transport
|
||||||
|
pcl_conversions
|
||||||
|
message_filters
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(cloud_reprojector_ros2 src/cloud_reprojector.cpp)
|
||||||
|
target_compile_definitions(cloud_reprojector_ros2 PRIVATE ROS2)
|
||||||
|
target_link_libraries(cloud_reprojector_ros2
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(cloud_reprojection_ros2_node src/cloud_reprojection_ros.cpp)
|
||||||
|
target_compile_definitions(cloud_reprojection_ros2_node PRIVATE ROS2)
|
||||||
|
target_link_libraries(cloud_reprojection_ros2_node
|
||||||
|
cloud_reprojector_ros2
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
${PCL_LIBRARIES}
|
||||||
|
yaml-cpp
|
||||||
|
)
|
||||||
|
ament_target_dependencies(cloud_reprojection_ros2_node
|
||||||
|
rclcpp
|
||||||
|
sensor_msgs
|
||||||
|
nav_msgs
|
||||||
|
cv_bridge
|
||||||
|
image_transport
|
||||||
|
pcl_conversions
|
||||||
|
message_filters
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable(image_overlay_node src/image_overlay_node.cpp)
|
||||||
|
target_compile_definitions(image_overlay_node PRIVATE ROS2)
|
||||||
|
target_link_libraries(image_overlay_node
|
||||||
|
${OpenCV_LIBS}
|
||||||
|
)
|
||||||
|
ament_target_dependencies(image_overlay_node
|
||||||
|
rclcpp
|
||||||
|
sensor_msgs
|
||||||
|
cv_bridge
|
||||||
|
image_transport
|
||||||
|
message_filters
|
||||||
|
)
|
||||||
|
|
||||||
|
# Installation rules - ensure all install targets are defined before ament_package()
|
||||||
|
# Install executable
|
||||||
|
install(TARGETS
|
||||||
|
host_sdk_sample
|
||||||
|
pcd2depth_ros2_node
|
||||||
|
cloud_reprojection_ros2_node
|
||||||
|
image_overlay_node
|
||||||
|
depth_image_ros2_node_lib
|
||||||
|
pointcloud_depth_converter_ros2
|
||||||
|
cloud_reprojector_ros2
|
||||||
|
EXPORT export_${PROJECT_NAME}
|
||||||
|
ARCHIVE DESTINATION lib
|
||||||
|
LIBRARY DESTINATION lib
|
||||||
|
RUNTIME DESTINATION lib/${PROJECT_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Install package.xml
|
||||||
|
install(FILES package.xml
|
||||||
|
DESTINATION share/${PROJECT_NAME}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Install headers
|
||||||
|
install(DIRECTORY include/
|
||||||
|
DESTINATION include
|
||||||
|
)
|
||||||
|
# Install launch_ROS2 directory
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/launch_ROS2")
|
||||||
|
install(DIRECTORY launch_ROS2/
|
||||||
|
DESTINATION share/${PROJECT_NAME}/launch
|
||||||
|
)
|
||||||
|
message(STATUS "Installing launch_ROS2 directory to share/${PROJECT_NAME}/launch")
|
||||||
|
else()
|
||||||
|
message(WARNING "launch_ROS2 directory not found")
|
||||||
|
endif()
|
||||||
|
# Install config files
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/config")
|
||||||
|
install(DIRECTORY config/
|
||||||
|
DESTINATION share/${PROJECT_NAME}/config
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Install launch files
|
||||||
|
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/launch")
|
||||||
|
install(DIRECTORY launch/
|
||||||
|
DESTINATION share/${PROJECT_NAME}/launch
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
ament_export_targets(export_${PROJECT_NAME})
|
||||||
|
# Declare dependencies
|
||||||
|
ament_export_dependencies(
|
||||||
|
rclcpp
|
||||||
|
std_msgs
|
||||||
|
sensor_msgs
|
||||||
|
nav_msgs
|
||||||
|
visualization_msgs
|
||||||
|
cv_bridge
|
||||||
|
image_transport
|
||||||
|
pcl_conversions
|
||||||
|
message_filters
|
||||||
|
tf2
|
||||||
|
tf2_ros
|
||||||
|
geometry_msgs
|
||||||
|
tf2_geometry_msgs
|
||||||
|
ament_index_cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
ament_package()
|
||||||
|
message(STATUS "Install targets added")
|
||||||
|
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Invalid ROS_VERSION: ${ROS_VERSION}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# ARM platform specific link options
|
||||||
|
if(TARGET_PLATFORM STREQUAL "arm")
|
||||||
|
set_target_properties(host_sdk_sample PROPERTIES
|
||||||
|
LINK_FLAGS "-Wl,--no-as-needed -Wl,--rpath=${LIB_DIR}"
|
||||||
|
)
|
||||||
|
message(STATUS "Adding ARM-specific link options and RPATH")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Add debug information
|
||||||
|
message(STATUS "=======================================")
|
||||||
|
message(STATUS "Project: ${PROJECT_NAME}")
|
||||||
|
message(STATUS "ROS_VERSION: ${ROS_VERSION}")
|
||||||
|
message(STATUS "Target platform: ${TARGET_PLATFORM}")
|
||||||
|
message(STATUS "lydHostApi library: ${LYD_HOST_API_LIB}")
|
||||||
|
message(STATUS "libusb library: ${LIBUSB_LIBRARIES}")
|
||||||
|
message(STATUS "=======================================")
|
||||||
|
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
APPENDIX: How to apply the Apache License to your work.
|
||||||
|
|
||||||
|
To apply the Apache License to your work, attach the following
|
||||||
|
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||||
|
replaced with your own identifying information. (Don't include
|
||||||
|
the brackets!) The text should be enclosed in the appropriate
|
||||||
|
comment syntax for the file format. We also recommend that a
|
||||||
|
file or class name and description of purpose be included on the
|
||||||
|
same "printed page" as the copyright notice for easier
|
||||||
|
identification within third-party archives.
|
||||||
|
|
||||||
|
Copyright 2025 Manifold Tech Ltd.
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at
|
||||||
|
|
||||||
|
http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
@@ -0,0 +1,821 @@
|
|||||||
|
# Odin_ROS_Driver Readme
|
||||||
|
|
||||||
|
ROS driver suite for Odin sensor modules (Manifold Tech Ltd.)
|
||||||
|
|
||||||
|
Odin1 wiki: https://manifoldtechltd.github.io/wiki/Odin1/Cover.html
|
||||||
|
|
||||||
|
## Odin_ROS_Driver
|
||||||
|
|
||||||
|
Compatibility:
|
||||||
|
|
||||||
|
● ROS 1(LTS Release: Noetic recommended)
|
||||||
|
|
||||||
|
● ROS 2(LTS Release: Humble recommended)
|
||||||
|
|
||||||
|
## Important Notice:
|
||||||
|
|
||||||
|
This driver package provides core functionality for point cloud SLAM applications and targets specific use cases. It is intended exclusively for technical professionals conducting secondary development. End users must perform scenario-specific optimization and custom development to align with operational requirements in practical deployment environments.
|
||||||
|
|
||||||
|
## 1. Version
|
||||||
|
|
||||||
|
Current version: v0.12.0
|
||||||
|
|
||||||
|
Required device firmware version: v0.12.0
|
||||||
|
|
||||||
|
## 2. Preparation
|
||||||
|
|
||||||
|
### 2.1 OS Requirement
|
||||||
|
|
||||||
|
● Ubuntu 20.04 for ROS Noetic and ROS2 Foxy;
|
||||||
|
|
||||||
|
● Ubuntu 22.04 for ROS2 Humble;
|
||||||
|
|
||||||
|
● Ubuntu 18.04 is currently not supported;
|
||||||
|
|
||||||
|
● Ubuntu 24.04 is not officially supported but may work with some modifications.
|
||||||
|
|
||||||
|
### 2.2 Dependencies
|
||||||
|
|
||||||
|
● Opencv >= 4.2.0(recommand 4.5.5/4.8.0. Make sure only one version of opencv is installed)
|
||||||
|
|
||||||
|
● yaml-cpp
|
||||||
|
|
||||||
|
● thread
|
||||||
|
|
||||||
|
● OpenSSL
|
||||||
|
|
||||||
|
● Eigen3
|
||||||
|
|
||||||
|
### 2.3 Dependencies Install
|
||||||
|
|
||||||
|
#### 2.3.1 System
|
||||||
|
```shell
|
||||||
|
sudo apt update
|
||||||
|
sudo apt-get install build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2.3.2 yaml-cpp
|
||||||
|
```shell
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y libyaml-cpp-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2.3.3 libusb
|
||||||
|
```shell
|
||||||
|
sudo apt update
|
||||||
|
sudo apt install -y libusb-1.0-0-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2.3.4 opencv
|
||||||
|
```shell
|
||||||
|
sudo apt update
|
||||||
|
sudo apt-get install libopencv-dev
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 2.3.4 ROS install
|
||||||
|
|
||||||
|
For ROS Noetic installation, please refer to:
|
||||||
|
[ROS Noetic installation instructions](https://wiki.ros.org/noetic/Installation)
|
||||||
|
|
||||||
|
For ROS2 Foxy installation, please refer to:
|
||||||
|
[ROS Foxy installation instructions](https://docs.ros.org/en/foxy/Installation/Ubuntu-Install-Debians.html)
|
||||||
|
|
||||||
|
For ROS2 Humble installation, please refer to:
|
||||||
|
[ROS Humble installation instructions](https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html)
|
||||||
|
|
||||||
|
## 3. Preparation
|
||||||
|
|
||||||
|
### 3.1 Create Udev rules
|
||||||
|
```shell
|
||||||
|
sudo vim /etc/udev/rules.d/99-odin-usb.rules
|
||||||
|
```
|
||||||
|
Add the following content to the 99-odin-usb.rules file
|
||||||
|
```shell
|
||||||
|
SUBSYSTEM=="usb", ATTR{idVendor}=="2207", ATTR{idProduct}=="0019", MODE="0666", GROUP="plugdev"
|
||||||
|
```
|
||||||
|
Reload rules and reinsert devices
|
||||||
|
```shell
|
||||||
|
sudo udevadm control --reload
|
||||||
|
sudo udevadm trigger
|
||||||
|
```
|
||||||
|
### 3.2 OS Requirement
|
||||||
|
```shell
|
||||||
|
git clone https://github.com/manifoldsdk/odin_ros_driver.git catkin_ws/src/odin_ros_driver
|
||||||
|
```
|
||||||
|
Note:
|
||||||
|
Please clone the source code into the "[ros_workspace]/src/" folder, otherwise compilation errors will occur.
|
||||||
|
|
||||||
|
### 3.3 make
|
||||||
|
|
||||||
|
#### 3.3.1 ROS1 (Noetic for example):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
source /opt/ros/noetic/setup.bash
|
||||||
|
./script/build_ros.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 3.3.2 ROS2 (Foxy for example):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
source /opt/ros/foxy/setup.bash
|
||||||
|
./script/build_ros2.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.4 run:
|
||||||
|
|
||||||
|
#### 3.4.1 ROS1 (Noetic for example):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
source [ros_workspace]/devel/setup.bash
|
||||||
|
roslaunch odin_ros_driver [launch file]
|
||||||
|
```
|
||||||
|
● odin_ros_driver: package name;
|
||||||
|
|
||||||
|
● launch file: launch file;
|
||||||
|
|
||||||
|
● ros_workspace: User's ROS environment workspace;
|
||||||
|
```shell
|
||||||
|
roslaunch odin_ros_driver odin1_ros1.launch
|
||||||
|
```
|
||||||
|
#### 3.4.2 ROS2 (Foxy for example):
|
||||||
|
|
||||||
|
```shell
|
||||||
|
source [ros2_workspace]/install/setup.bash
|
||||||
|
ros2 launch odin_ros_driver [launch file]
|
||||||
|
```
|
||||||
|
● odin_ros_driver: package name;
|
||||||
|
|
||||||
|
● launch file: launch file;
|
||||||
|
|
||||||
|
● ros2_workspace: User's ROS2 environment workspace;
|
||||||
|
|
||||||
|
ROS2 Demo Launch Instructions:
|
||||||
|
```shell
|
||||||
|
ros2 launch odin_ros_driver odin1_ros2.launch.py
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3.5 Operation Mode:
|
||||||
|
|
||||||
|
The operation mode can be configured via the `custom_map_mode` parameter in config/control_command.yaml.
|
||||||
|
|
||||||
|
#### Odometry mode
|
||||||
|
|
||||||
|
Set `custom_map_mode = 0` to enable odometry mode. In this mode, the map frame and odom frame share the same pose.
|
||||||
|
|
||||||
|
If the odom data is found to drift, the script command "./set_param.sh algo_reset 1" can be used to dynamically reset the algorithm.
|
||||||
|
|
||||||
|
#### SLAM mode
|
||||||
|
|
||||||
|
Set `custom_map_mode = 1` to enable slam mode. This mode provides a complete SLAM system that builds upon the Odometry Mode by adding **loop closure detection** and **map saving** capabilities.
|
||||||
|
|
||||||
|
After launching the driver, odin1 will automatically perform mapping and cache map data. When the scene capture is complete, users need to execute `./set_param.sh save_map 1` in the driver's source directory to save all map data collected since the program started. The map will be saved to the location specified by the `mapping_result_dest_dir` and `mapping_result_file_name` parameters in config/control_command.yaml. If these parameters are not specified, default values will be used.
|
||||||
|
|
||||||
|
After the initial save, you can execute the command again to save a new map. Each save operation will generate a new map file. (Please allow at least 5 seconds between consecutive save operations)
|
||||||
|
|
||||||
|
The map origin corresponds to the odom coordinate system's origin at the program's startup.
|
||||||
|
|
||||||
|
##### Relocalization mode
|
||||||
|
|
||||||
|
To enable relocalization, set `custom_map_mode = 2` and specify the absolute path to the pre-built map using the `relocalization_map_abs_path` parameter in config/control_command.yaml.
|
||||||
|
|
||||||
|
Once launched, odin1 will initiate the relocalization process based on the current viewpoint and the specified map. To ensure a high success rate, it is recommended to starting within 1 meter ±10 degrees of the original position and orientation from the SLAM trajectory.
|
||||||
|
|
||||||
|
Note that relocalization performance is highly environment-dependent. In highly distinctive scenes, successful matching may occur even beyond the 1m/10° range, while other environments may require more stringent conditions. We advise testing in your target environment to determine practical tolerances.
|
||||||
|
|
||||||
|
If relocalization fails initially, the system will temporarily operate in a fallback SLAM mode (map saving is disabled in this state). During this time, you can freely move odin1. It will continue relocalization attempts in the background. Once successful, the TF between map and odom frames will be published. (Tip: Gently shaking or moving the device after initialization can help improve relocalization accuracy.)
|
||||||
|
|
||||||
|
The following topics are published in the odom frame: `/odin1/cloud_slam, /odin1/odom, /odin1/highodom and /odin1/path`. To obtain these in the map frame, apply the TF from odom frame to map frame.
|
||||||
|
|
||||||
|
## 4. File structure and data format
|
||||||
|
### 4.1 File structure
|
||||||
|
```shell
|
||||||
|
Odin_ROS_Driver/ // ROS1/ROS2 driver package
|
||||||
|
3rdparty/ // Third-party libraries
|
||||||
|
src/
|
||||||
|
host_sdk_sample.cpp // Example source code
|
||||||
|
yaml_parser.cpp // Source code for reading yaml parameters
|
||||||
|
rawCloudRender.cpp // Source code for RenderCloud
|
||||||
|
depth_image_ros_node.cpp //depth_image_ros_node
|
||||||
|
depth_image_ros2_node.cpp //depth_image_ros2_node
|
||||||
|
pcd2depth_ros.cpp //Source code for pcd2depth_ros
|
||||||
|
pcd2depth_ros2.cpp //Source code for pcd2depth_ros2
|
||||||
|
pointcloud_depth_converter.cpp //Source code for pointcloud_depth_converter
|
||||||
|
cloud_reprojection_ros.cpp //Source code for cloud reprojection node (ROS1/ROS2)
|
||||||
|
cloud_reprojector.cpp //Core logic for cloud reprojection
|
||||||
|
lib/
|
||||||
|
liblydHostApi_amd.a // Static library for AMD platform
|
||||||
|
liblydHostApi_arm.a // Static library for ARM platform
|
||||||
|
include/
|
||||||
|
host_sdk_sample.h // Example header file
|
||||||
|
lidar_api_type.h // API data structure header file
|
||||||
|
lidar_api.h // API function declarations
|
||||||
|
yaml_parser.h // Parameter file reading header file
|
||||||
|
rawCloudRender.h // API about RenderCloud
|
||||||
|
data_logger.h // LOG about save_data
|
||||||
|
depth_image_ros_node.hpp // depth_image_ros_node
|
||||||
|
depth_image_ros2_node.hpp // depth_image_ros2_node
|
||||||
|
pointcloud_depth_converter.hpp // pointcloud_depth_convert
|
||||||
|
cloud_reprojection_ros_node.hpp // cloud_reprojection_ros_node (ROS1/ROS2)
|
||||||
|
cloud_reprojector.hpp // Core class for cloud reprojection
|
||||||
|
config/
|
||||||
|
control_command.yaml // Control parameter file for driver
|
||||||
|
calib.yaml // Machine calibration yaml,differ for each individual device. Retrieved from the device everytime it connects to ROS driver
|
||||||
|
launch_ROS1/
|
||||||
|
odin1_ros1.launch // ROS1 launch file
|
||||||
|
launch_ROS2/
|
||||||
|
odin1_ros2.launch.py // ROS2 launch file
|
||||||
|
script/
|
||||||
|
build_ros1.sh // Installation script for ROS1
|
||||||
|
build_ros2.sh // Installation script for ROS2
|
||||||
|
recorddata/ // holds recorded data that can import into MindCloud
|
||||||
|
log/ // holds log files
|
||||||
|
Driver_{timestamp}/ // holds all log folders for each time driver started
|
||||||
|
Conn_{timestamp}/ // holds all log files for each odin1 device connection
|
||||||
|
dev_status.csv // device status log file
|
||||||
|
README.md // Usage instructions
|
||||||
|
CMakeLists.txt // CMake build file
|
||||||
|
License // License file
|
||||||
|
```
|
||||||
|
### 4.2 File structure
|
||||||
|
| Launch File Name | Description |
|
||||||
|
|--------------------------|-------------|
|
||||||
|
| odin1_ros1.launch | Launch file for ROS1 - Odin1 Basic Operations Demo |
|
||||||
|
| odin1_ros2.launch.py | Launch file for ROS2 - Odin1 Basic Operations Demo |
|
||||||
|
|
||||||
|
|
||||||
|
### 4.3 ROS topics
|
||||||
|
Internal parameters of the Odin ROS driver are defined in config/control_command.yaml. Below are descriptions of the commonly used parameters:
|
||||||
|
|
||||||
|
| Topic |control_command.yaml | Detailed Description |
|
||||||
|
|---------------------|----------------------|----------------------|
|
||||||
|
| odin1/imu | sendimu | Imu Topic |
|
||||||
|
| odin1/image | sendrgb | RGB Camera Topic, decoded from original jpeg data from device, bgr8 format |
|
||||||
|
| odin1/image_undistort | sendrgbundistort | undistorted RGB Camera Topic, processed with calib.yaml from device |
|
||||||
|
| odin1/image/compressed | sendrgbcompressed | RGB Camera compressed Topic, original jpeg data from device |
|
||||||
|
| odin1/cloud_raw | senddtof | Raw_Cloud Topic |
|
||||||
|
| odin1/cloud_render | sendcloudrender | Render_Cloud Topic, processed with raw point cloud, rgb image, and calib.yaml from device |
|
||||||
|
| odin1/cloud_slam | sendcloudslam | Slam_PointCloud Topic |
|
||||||
|
| odin1/odometry | sendodom | Odom Topic |
|
||||||
|
| odin1/odometry_high | sendodom | high frequency Odom Topic |
|
||||||
|
| odin1/path | showpath | Odom Path Topic |
|
||||||
|
| tf | sendodom | tf tree Topic |
|
||||||
|
| odin1/depth_img_competetion | senddepth | Dense depth image Topic. Demo, high computing power required. One-to-one with odin1/image_undistort. To utilize the data please directly subscribe to this topic instead of echoing it. Original value is already depth data, no need for further convert. |
|
||||||
|
| odin1/depth_img_competetion_cloud | senddepth | Dense Depth_Cloud Topic. Demo, high computing power required |
|
||||||
|
| odin1/reprojected_image | sendreprojection | Reprojected cloud to image Topic. Projects cloud_slam to camera image using odometry. Processed on host device. |
|
||||||
|
|
||||||
|
### 4.4 Data format
|
||||||
|
|
||||||
|
1. The raw point cloud (cloud_raw) has the following fields:
|
||||||
|
```
|
||||||
|
float32 x // X axis, in meters
|
||||||
|
float32 y // Y axis, in meters
|
||||||
|
float32 z // Z axis, in meters
|
||||||
|
uint8 intensity // Reflectivity, range 0–255
|
||||||
|
uint16 confidence // Point confidence, actual value range from 0 to around 1300 in typical scene, higher value means more reliable. Recommanded filtering threshold is 30-35, should be adjusted accordingly.
|
||||||
|
float32 offset_time // Time offset relative to the base timestamp unit: s
|
||||||
|
```
|
||||||
|
|
||||||
|
To work with this custom format in PCL, first define the point type:
|
||||||
|
```cpp
|
||||||
|
/*** LS ***/
|
||||||
|
namespace ls_ros {
|
||||||
|
struct EIGEN_ALIGN16 Point {
|
||||||
|
float x;
|
||||||
|
float y;
|
||||||
|
float z;
|
||||||
|
uint8_t intensity;
|
||||||
|
uint16_t confidence;
|
||||||
|
float offset_time;
|
||||||
|
EIGEN_MAKE_ALIGNED_OPERATOR_NEW
|
||||||
|
};
|
||||||
|
} // namespace ls_ros
|
||||||
|
|
||||||
|
POINT_CLOUD_REGISTER_POINT_STRUCT(ls_ros::Point,
|
||||||
|
(float, x, x)
|
||||||
|
(float, y, y)
|
||||||
|
(float, z, z)
|
||||||
|
(uint8_t, intensity, intensity)
|
||||||
|
(uint16_t, confidence, confidence)
|
||||||
|
(float offset_time , offset_time)
|
||||||
|
)
|
||||||
|
```
|
||||||
|
Then, you can easily convert a ROS sensor_msgs::PointCloud2 message into a PCL point cloud:
|
||||||
|
```
|
||||||
|
pcl::PointCloud<ls_ros::Point> ls_cloud;
|
||||||
|
pcl::fromROSMsg(*msg, ls_cloud);
|
||||||
|
```
|
||||||
|
|
||||||
|
2. The slam point cloud (cloud_slam) and directly rendered point cloud (cloud_render) has the following fields:
|
||||||
|
```
|
||||||
|
float32 x // X axis, in meters
|
||||||
|
float32 y // Y axis, in meters
|
||||||
|
float32 z // Z axis, in meters
|
||||||
|
float32 rgb // RGB value
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4.5 Other functionalities
|
||||||
|
|
||||||
|
|control_command.yaml | Detailed Description |
|
||||||
|
|-----------------------|----------------------|
|
||||||
|
| use_host_ros_time | Time synchronization mode: 0 - use odin internal system time as data timestamp (typical and recommended); 1 - use host ROS time upon receive (not recommended for most users); 2 - align odin1 time to host time via NTP-like synchronization, timestamp is the sensor data reception time on host time axis. |
|
||||||
|
| strict_usb3.0_check | Strict USB3.0 check, if off, allow connection even if usb connection is below usb 3.0 |
|
||||||
|
| recorddata | Record data in specific format that can be imported into MindCloud(TM) for post-processing. Please be aware that this will consume a lot of storage space. Testing shows 9.5G for 10mins of data. The per-frame timestamps written into the recorded files (IMU / image / point cloud / pose / rotate) follow the same alignment policy as `use_host_ros_time`, so under NTP mode (`use_host_ros_time=1` or `2`) the recorded timestamps are NTP-aligned host time instead of odin1 boot time. <br>录制文件 (IMU / 图像 / 点云 / Pose / Rotate) 中每帧的时间戳与 `use_host_ros_time` 采用相同对齐策略:在 NTP 模式 (`use_host_ros_time=1` 或 `2`) 下,录制时间戳为 NTP 对齐后的主机时间,而非 odin1 开机时间。 |
|
||||||
|
| devstatuslog | Device status logging, currently save device status (soc temperature, cpu usage, ram usage, dtof sensor temp .etc) and data tx & rx rate to devstatus.csv under log folder. A new file will be created every time the driver is started. |
|
||||||
|
| showcamerapose | Display Camera Pose and Field of View. |
|
||||||
|
| custom_map_mode | Operation Modes: Mode 0 - Odometry mode: The map frame and odom frame share the same pose. Mode 1 - Mapping (with loop closure) mode: This mode supports map saving. Mode 2 - Relocalization mode: Requires specifying the absolute path to the map file. After successful relocalization, it will output the TF relationship between the map and odom frames.|
|
||||||
|
| custom_init_pos | Initialization Position (currently unused). |
|
||||||
|
| relocalization_map_abs_path | Absolute Path to Map File: Used for relocalization mode. |
|
||||||
|
| mapping_result_dest_dir and mapping_result_file_name| Path and Name for Saving Maps in Mapping Mode: If not specified, default values will be used. |
|
||||||
|
|
||||||
|
### 4.6 Runtime AE/AWB Tuning via ROS Service / 通过 ROS Service 在线调节 AE/AWB
|
||||||
|
|
||||||
|
The driver hosts four ROS services that let a side terminal tune the
|
||||||
|
camera's auto exposure (AE) and auto white balance (AWB) at runtime,
|
||||||
|
while the main data streams keep flowing. The same SDK call is shared
|
||||||
|
with the driver's main control path and serialised by an internal
|
||||||
|
mutex, so it is safe to invoke these services concurrently with normal
|
||||||
|
operation.
|
||||||
|
|
||||||
|
驱动启动后会注册 4 个 ROS Service,允许在不重启 driver 的前提下,从另一个终端动态调节
|
||||||
|
相机的自动曝光(AE)和自动白平衡(AWB)。底层 SDK 调用与驱动主控制路径共享同一把
|
||||||
|
互斥锁,因此可以与正常数据流并发调用。
|
||||||
|
|
||||||
|
**Service list / Service 一览**
|
||||||
|
|
||||||
|
| Service name | Type / 类型 | Purpose / 用途 |
|
||||||
|
|---|---|---|
|
||||||
|
| `/odin1/get_ae` | `odin_ros_driver/srv/GetAe` | Query current AE status / 查询当前 AE 状态 |
|
||||||
|
| `/odin1/get_awb` | `odin_ros_driver/srv/GetAwb` | Query current AWB status / 查询当前 AWB 状态 |
|
||||||
|
| `/odin1/set_ae` | `odin_ros_driver/srv/SetAe` | Set AE mode and (manual) exposure / gain / 设置 AE 模式和手动曝光/增益 |
|
||||||
|
| `/odin1/set_awb` | `odin_ros_driver/srv/SetAwb` | Set AWB mode and (manual) R/B gain / 设置 AWB 模式和手动 R/B 增益 |
|
||||||
|
|
||||||
|
#### 4.6.1 Request fields, ranges, physical meaning / 请求字段、范围与物理含义
|
||||||
|
|
||||||
|
**`SetAe.Request`**
|
||||||
|
|
||||||
|
| Field | Range / 范围 | Meaning / 含义 |
|
||||||
|
|---|---|---|
|
||||||
|
| `mode` | `0` (AUTO) or / 或 `1` (MANUAL) | `0` = device runs its own AE loop, the two floats below are ignored / 设备自动调 AE,下方参数被忽略<br>`1` = device locks AE and applies the provided values / 设备锁 AE 并应用提供的值 |
|
||||||
|
| `exposure_time` | `0.0001` ~ `0.033` s (manual only / 仅手动模式) | Sensor exposure time per frame. Longer = brighter but more motion blur / 每帧传感器曝光时间。越长越亮但运动模糊增大 |
|
||||||
|
| `gain` | `1.0` ~ `64.0` (manual only / 仅手动模式) | Analog gain. Higher = brighter output but worse SNR / 模拟增益。越大越亮但信噪比越差 |
|
||||||
|
|
||||||
|
**`SetAwb.Request`**
|
||||||
|
|
||||||
|
| Field | Range / 范围 | Meaning / 含义 |
|
||||||
|
|---|---|---|
|
||||||
|
| `mode` | `0` (AUTO) or / 或 `1` (MANUAL) | `0` = device runs its own AWB loop / 设备自动 AWB<br>`1` = device locks AWB and applies provided gains / 设备锁定 AWB 并应用所给增益 |
|
||||||
|
| `rgain` | `0.1` ~ `4.0` (manual only / 仅手动模式) | R channel gain. Higher `rgain` vs `bgain` shifts the image warm (yellow/red) / R 通道增益,相对 bgain 越大,画面越偏暖 |
|
||||||
|
| `bgain` | `0.1` ~ `4.0` (manual only / 仅手动模式) | B channel gain. Higher `bgain` vs `rgain` shifts the image cool (blue) / B 通道增益,相对 rgain 越大,画面越偏冷 |
|
||||||
|
|
||||||
|
> Gr / Gb channels are fixed to 1.0 by the device and are not adjustable.
|
||||||
|
> Gr / Gb 通道被设备固定为 1.0,不可调节。
|
||||||
|
|
||||||
|
#### 4.6.2 Response fields / 响应字段
|
||||||
|
|
||||||
|
All four services return a `success` (bool) and `rc` (int32). Get
|
||||||
|
services additionally return the queried state.
|
||||||
|
4 个 Service 都返回 `success` (bool) 与 `rc` (int32)。Get 类还会返回查询到的状态字段。
|
||||||
|
|
||||||
|
**`GetAe.Response`**
|
||||||
|
|
||||||
|
| Field | Typical range / 典型范围 | Meaning / 含义 |
|
||||||
|
|---|---|---|
|
||||||
|
| `exposure_time` | `0.0001`~`0.033` s | Current exposure / 当前曝光时间 |
|
||||||
|
| `gain` | `1.0`~`64.0` | Current analog gain / 当前模拟增益 |
|
||||||
|
| `iso` | `100`~`6400` | Equivalent ISO / 等效 ISO |
|
||||||
|
| `brightness` | `0`~`255` | Average frame brightness / 平均帧亮度 |
|
||||||
|
| `is_converged` | `0` or `1` | `1` = AE settled / AE 已收敛 |
|
||||||
|
| `env_lv` | `0`~`15` | Ambient luminance index, higher = brighter / 环境光强度指数,越大越亮 |
|
||||||
|
| `fps` | `~10` / `~14.5` / `~29` | Current frame rate / 当前帧率 |
|
||||||
|
|
||||||
|
**`GetAwb.Response`**
|
||||||
|
|
||||||
|
| Field | Typical range / 典型范围 | Meaning / 含义 |
|
||||||
|
|---|---|---|
|
||||||
|
| `rgain` / `bgain` | `0.1`~`4.0` | R / B channel gain / R / B 通道增益 |
|
||||||
|
| `grgain` / `gbgain` | `1.0` (fixed / 固定) | Gr / Gb gain, device-fixed / Gr / Gb 增益,设备固定 |
|
||||||
|
| `cct` | `2500`~`8000` K | Correlated color temperature / 相关色温 |
|
||||||
|
| `ccri` | `-50`~`50` | Color temp deviation index, 0 = on Planckian locus / 色温偏离指数,0 表示在普朗克轨迹上 |
|
||||||
|
| `is_converged` | `0` or `1` | `1` = AWB settled / AWB 已收敛 |
|
||||||
|
|
||||||
|
#### 4.6.3 `rc` return code / `rc` 返回码
|
||||||
|
|
||||||
|
| `rc` | Meaning / 含义 |
|
||||||
|
|---|---|
|
||||||
|
| `0` | Success / 成功 |
|
||||||
|
| `400` | Device payload too short / 设备载荷过短 |
|
||||||
|
| `401` | Device opcode not supported / 设备不支持该 opcode |
|
||||||
|
| `402` | Device parameter length wrong / 参数长度错误 |
|
||||||
|
| `403` | **Parameter out of range** / 参数越界 — most common when manual values exceed the table above / 手动值超出上表范围时最常见 |
|
||||||
|
| `404` | Device-side socket error / 设备端 socket 错误 |
|
||||||
|
| `405` | Device-side `ae_control` did not respond / 设备端 `ae_control` 无应答(确认 lydapp 已运行) |
|
||||||
|
| `255` (`0xFF`) | Unknown opcode reported by ae_control / ae_control 报未知 opcode |
|
||||||
|
| `-1` | SDK not initialised / SDK 未初始化 |
|
||||||
|
| `-2` ~ `-5` | USB transfer / timeout / malformed reply / USB 传输异常、超时、应答畸形 |
|
||||||
|
| `-100` | **Driver has not opened the device yet** / driver 还未打开设备,请等设备连接成功 |
|
||||||
|
|
||||||
|
#### 4.6.4 Usage examples / 调用示例
|
||||||
|
|
||||||
|
ROS2 (Humble) — start the driver in one terminal, then in a side terminal:
|
||||||
|
ROS2(Humble)—— 在一个终端启动 driver,在另一个终端:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
source install/setup.bash
|
||||||
|
|
||||||
|
# Query current state / 查询当前状态
|
||||||
|
ros2 service call /odin1/get_ae odin_ros_driver/srv/GetAe
|
||||||
|
ros2 service call /odin1/get_awb odin_ros_driver/srv/GetAwb
|
||||||
|
|
||||||
|
# Set AE to AUTO / 设置 AE 为自动
|
||||||
|
ros2 service call /odin1/set_ae odin_ros_driver/srv/SetAe "{mode: 0}"
|
||||||
|
|
||||||
|
# Set AE to MANUAL with 10 ms exposure and gain 4.0
|
||||||
|
# 设置 AE 为手动,10 毫秒曝光,增益 4.0
|
||||||
|
ros2 service call /odin1/set_ae odin_ros_driver/srv/SetAe \
|
||||||
|
"{mode: 1, exposure_time: 0.010, gain: 4.0}"
|
||||||
|
|
||||||
|
# Set AWB to MANUAL with rgain=1.5, bgain=2.0
|
||||||
|
# 设置 AWB 为手动,rgain=1.5、bgain=2.0
|
||||||
|
ros2 service call /odin1/set_awb odin_ros_driver/srv/SetAwb \
|
||||||
|
"{mode: 1, rgain: 1.5, bgain: 2.0}"
|
||||||
|
|
||||||
|
# Restore AUTO / 一键回自动
|
||||||
|
ros2 service call /odin1/set_ae odin_ros_driver/srv/SetAe "{mode: 0}"
|
||||||
|
ros2 service call /odin1/set_awb odin_ros_driver/srv/SetAwb "{mode: 0}"
|
||||||
|
|
||||||
|
# Inspect srv definition / 查看 srv 完整定义
|
||||||
|
ros2 interface show odin_ros_driver/srv/SetAe
|
||||||
|
```
|
||||||
|
|
||||||
|
ROS1 (Noetic) — start the driver, then in a side terminal:
|
||||||
|
ROS1(Noetic)—— 启动 driver 后,新开终端:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
source devel/setup.bash
|
||||||
|
|
||||||
|
# Query / 查询
|
||||||
|
rosservice call /odin1/get_ae
|
||||||
|
rosservice call /odin1/get_awb
|
||||||
|
|
||||||
|
# Set AE manual / 设置 AE 手动
|
||||||
|
rosservice call /odin1/set_ae "{mode: 1, exposure_time: 0.010, gain: 4.0}"
|
||||||
|
|
||||||
|
# Set AWB manual / 设置 AWB 手动
|
||||||
|
rosservice call /odin1/set_awb "{mode: 1, rgain: 1.5, bgain: 2.0}"
|
||||||
|
|
||||||
|
# Restore AUTO (ROS1 requires all fields to be present)
|
||||||
|
# 一键回自动(ROS1 要求填齐全部字段)
|
||||||
|
rosservice call /odin1/set_ae "{mode: 0, exposure_time: 0.0, gain: 0.0}"
|
||||||
|
rosservice call /odin1/set_awb "{mode: 0, rgain: 0.0, bgain: 0.0}"
|
||||||
|
|
||||||
|
# Inspect srv definition / 查看 srv 完整定义
|
||||||
|
rossrv show odin_ros_driver/SetAe
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 4.6.5 Recommended starting points by scene / 不同场景推荐起步参数
|
||||||
|
|
||||||
|
**AE (`exposure_time`, `gain`)**
|
||||||
|
|
||||||
|
| Scene / 场景 | `exposure_time` | `gain` |
|
||||||
|
|---|---|---|
|
||||||
|
| Bright outdoor / 明亮室外 | `0.001` ~ `0.005` s | `1.0` ~ `2.0` |
|
||||||
|
| Normal indoor / 普通室内 | `0.008` ~ `0.015` s | `2.0` ~ `8.0` |
|
||||||
|
| Dim light / 暗光环境 | `0.020` ~ `0.030` s | `8.0` ~ `32.0` |
|
||||||
|
| Very dark / 极暗 | `0.033` s | `32.0` ~ `64.0` |
|
||||||
|
|
||||||
|
**AWB (`rgain`, `bgain`)**
|
||||||
|
|
||||||
|
| Target tone / 目标色调 | `rgain` | `bgain` |
|
||||||
|
|---|---|---|
|
||||||
|
| Warm (tungsten, sunset) / 暖(钨丝灯、夕阳) | `2.0` ~ `2.5` | `1.0` ~ `1.2` |
|
||||||
|
| Neutral (D65 daylight) / 中性(D65 日光) | `1.5` ~ `1.7` | `1.8` ~ `2.0` |
|
||||||
|
| Cool (cloudy, fluorescent) / 冷(阴天、荧光) | `1.2` ~ `1.4` | `2.2` ~ `2.6` |
|
||||||
|
| Very cool / 极冷 | `1.0` | `3.0` ~ `4.0` |
|
||||||
|
|
||||||
|
#### 4.6.6 Caveats / 注意事项
|
||||||
|
|
||||||
|
- The service blocks for up to ~10 s waiting for the device to reply;
|
||||||
|
typical latency is tens of milliseconds.
|
||||||
|
Service 最长阻塞约 10 秒等设备应答;正常几十毫秒返回。
|
||||||
|
- Manual mode is **not** persisted across driver / device restart;
|
||||||
|
it falls back to AUTO on each new connection.
|
||||||
|
手动模式**不会**跨重启保留;每次重连默认回到 AUTO。
|
||||||
|
- `rc = -100` means the driver has not yet opened the device.
|
||||||
|
Wait until the driver logs `device connected` before calling.
|
||||||
|
返回 `rc = -100` 表示 driver 还没打开设备,等到 driver 日志显示 `device connected` 再调用。
|
||||||
|
- The effective maximum `exposure_time` is bounded by the frame
|
||||||
|
period `1 / fps`. With `dtof_fps = 290` (29 Hz, period ~34 ms)
|
||||||
|
the upper limit 0.033 s is already at the frame boundary.
|
||||||
|
最大可用 `exposure_time` 受帧周期 `1/fps` 限制。在 `dtof_fps = 290`(29 Hz、周期 ~34 ms)下,上限 0.033 s 已经贴到帧边界。
|
||||||
|
|
||||||
|
## 5. FAQ
|
||||||
|
### 5.1 Segmentation fault upon re-launching host SDK
|
||||||
|
**Error Message**
|
||||||
|
No device connected after 60 seconds
|
||||||
|
|
||||||
|
**Solution**
|
||||||
|
1. Please power on Odin module again # Disconnect and reconnect odin power
|
||||||
|
|
||||||
|
2. Reinitialize Odin SDK # Execute SDK after device reboot
|
||||||
|
|
||||||
|
|
||||||
|
### 5.2 Library binding failure during compilation
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
ld: cannot find -llydHostApi or symbol lookup errors
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
|
||||||
|
1. Clean previous build artifacts
|
||||||
|
|
||||||
|
ROS1
|
||||||
|
```shell
|
||||||
|
rm -rf devel/ build/
|
||||||
|
```
|
||||||
|
ROS2
|
||||||
|
```shell
|
||||||
|
rm -rf devel/ install/ log/
|
||||||
|
```
|
||||||
|
2. Re-run script installation
|
||||||
|
|
||||||
|
### 5.3 Docker GUI passthrough failure
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
Unable to open X display or No protocol specified
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
```shell
|
||||||
|
xhost + #This command enables graphical passthrough to Docker containers
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5.4 ROS driver exit with get version failed error
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
```shell
|
||||||
|
<ERROR><api.cpp:lidar_get_version:672>: get device version fail.
|
||||||
|
get version failed.
|
||||||
|
```
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
|
||||||
|
Device firmware version is too low, please update to latest version.
|
||||||
|
|
||||||
|
|
||||||
|
### 5.5 RVIZ has not responded for a long time
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
Rviz does not respond, and after a while the terminal prints Device disconnected, waiting for reconnection...
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
|
||||||
|
Please power on Odin module again
|
||||||
|
|
||||||
|
### 5.6 Device not responding
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
Missed ok response from device,probably wrong interaction procedure.
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
|
||||||
|
Please adopt the solution mentioned in 5.1
|
||||||
|
|
||||||
|
### 5.7 Device has no external calibration file
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
ERROR:Missing camera node 'cam_0'
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
|
||||||
|
Please plug and unplug the USB again
|
||||||
|
|
||||||
|
### 5.8 ROS Driver report device disconnected immediately after stream started
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
|
||||||
|
```shell
|
||||||
|
Device ready and streams activated
|
||||||
|
Device detaching...
|
||||||
|
Wating for device reconnection...
|
||||||
|
Device disconnected, waiting for reconnection...
|
||||||
|
```
|
||||||
|
|
||||||
|
**Reason**
|
||||||
|
|
||||||
|
Mostly common on ros2 environment and connected to complex network environment, such as office wifi & ethernet. ROS2 default to broadcast, and complex network environment will cause ros2 publish to block, leading to device disconnection.
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
|
||||||
|
If cross-device communication is not required, please restrict ros2 to localhost only with:
|
||||||
|
```shell
|
||||||
|
export ROS_LOCALHOST_ONLY=1
|
||||||
|
```
|
||||||
|
|
||||||
|
If cross-device communication is required, please simplify the network environment as much as possible. Mini local network with only required devices is recommended.
|
||||||
|
|
||||||
|
### 5.9 ROS Driver died immediately after stream started
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
|
||||||
|
```shell
|
||||||
|
Device ready and streams activated
|
||||||
|
[host_sdk_sample-2] process has died ......
|
||||||
|
```
|
||||||
|
|
||||||
|
**Test**
|
||||||
|
|
||||||
|
Disable odin1/image with sendrgb = 0 in control_command.yaml and try again. If the driver now works, it is likely that the issue is related to multiple version of opencv is installed on the system.
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
|
||||||
|
Purge the unused version of opencv and maintain a single complete version, then rebuild the driver and try again.
|
||||||
|
|
||||||
|
### 5.10 ROS Driver printing "TF_OLD_DATA ignoring data" warning
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
|
||||||
|
```shell
|
||||||
|
[rviz2-3] Warning: TF_OLD_DATA ignoring data from the past for frame odin1_base_link at time 20.547632 according to authority Authority undetectable
|
||||||
|
[rviz2-3] Possible reasons are listed at http://wiki.ros.org/tf/Errors%20explained
|
||||||
|
[rviz2-3] at line 294 in ./src/buffer_core.cpp
|
||||||
|
```
|
||||||
|
|
||||||
|
**Reason**
|
||||||
|
|
||||||
|
This is a ros & rviz feature to warn user that some tf data is being ignored due to timestamp conflicts. It happens when user keeps ros driver running and power-cycles odin device, which cause odin's internal system time being reset and now data timestamps conflicts with old data recieved by rviz during last run.
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
|
||||||
|
There's a reset button on bottom of rviz gui. Click on this button will reset rviz's internal state and stop the warning.
|
||||||
|
|
||||||
|
### 5.11 ROS Driver printing "unknown cmd code: xx" error
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
|
||||||
|
```shell
|
||||||
|
<ERROR><api.cpp:cmd_data_deal:418>: unknow command code 21.
|
||||||
|
```
|
||||||
|
|
||||||
|
**Reason**
|
||||||
|
|
||||||
|
This is due to ros driver version mismatch with device firmware version, resulting in ros driver unable to decode new data added in newer firmware.
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
|
||||||
|
Please make sure you are using most up-to-date ros driver and device firmware.
|
||||||
|
|
||||||
|
### 5.12 USB device access error (LIBUSB_ERROR_BUSY or LIBUSB_ERROR_ACCESS)
|
||||||
|
|
||||||
|
**Error Message**
|
||||||
|
|
||||||
|
```shell
|
||||||
|
libusb: error [udev_hotplug_event] ignoring udev action bind
|
||||||
|
LIBUSB_ERROR_BUSY
|
||||||
|
```
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
```shell
|
||||||
|
libusb: error [_get_usbfs_fd] libusb couldn't open USB device /dev/bus/usb/xxx/xxx, errno=13
|
||||||
|
LIBUSB_ERROR_ACCESS
|
||||||
|
```
|
||||||
|
|
||||||
|
**Reason**
|
||||||
|
|
||||||
|
- **LIBUSB_ERROR_BUSY**: Another process is already using the USB device. This commonly happens when multiple instances of the ROS driver are running, or another application (such as a previous crashed instance) still holds the device handle.
|
||||||
|
|
||||||
|
- **LIBUSB_ERROR_ACCESS**: The current user does not have permission to access the USB device. This is typically caused by missing udev rules or insufficient user privileges.
|
||||||
|
|
||||||
|
**Resolution**
|
||||||
|
|
||||||
|
For **LIBUSB_ERROR_BUSY**:
|
||||||
|
|
||||||
|
1. Check if another instance of the driver is running:
|
||||||
|
```shell
|
||||||
|
ps aux | grep host_sdk_sample
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Kill any existing instances:
|
||||||
|
```shell
|
||||||
|
killall host_sdk_sample
|
||||||
|
```
|
||||||
|
|
||||||
|
3. If the issue persists, unplug and replug the USB device to reset the device state.
|
||||||
|
|
||||||
|
For **LIBUSB_ERROR_ACCESS**:
|
||||||
|
|
||||||
|
1. Add udev rules for the device. Create a file `/etc/udev/rules.d/99-odin.rules` with the following content:
|
||||||
|
```shell
|
||||||
|
SUBSYSTEM=="usb", ATTR{idVendor}=="2207", ATTR{idProduct}=="0019", MODE="0666", GROUP="plugdev"
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Reload udev rules:
|
||||||
|
```shell
|
||||||
|
sudo udevadm control --reload-rules
|
||||||
|
sudo udevadm trigger
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Alternatively, run the driver with sudo (not recommended for production):
|
||||||
|
```shell
|
||||||
|
sudo -E ros2 launch odin_ros_driver odin_ros_driver.launch.py
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Make sure your user is in the `plugdev` group:
|
||||||
|
```shell
|
||||||
|
sudo usermod -aG plugdev $USER
|
||||||
|
```
|
||||||
|
Then log out and log back in for the group change to take effect.
|
||||||
|
|
||||||
|
### 5.13 ros2 bag drops high-frequency topics (IMU / odometry_highfreq) / ros2 bag 录制丢失高频话题(IMU / odometry_highfreq)
|
||||||
|
|
||||||
|
**Symptom / 现象**
|
||||||
|
|
||||||
|
When recording with `ros2 bag record`, low-frequency topics (cloud, image, odometry, wiwc) are intact, but `/odin1/imu` (400 Hz) and `/odin1/odometry_highfreq` (400 Hz) show missing samples — analysis scripts report inter-message intervals that are 2× or more of the expected period, while no drop is reported on the SDK side or by an online subscriber such as `ros2 topic hz`.
|
||||||
|
|
||||||
|
使用 `ros2 bag record` 录制时,低频话题(cloud、image、odometry、wiwc)完整无丢,但 `/odin1/imu`(400 Hz)和 `/odin1/odometry_highfreq`(400 Hz)会出现丢帧——分析脚本上看到消息间隔达到正常周期的 2 倍以上,而 SDK 侧不报丢,独立的 `ros2 topic hz` 订阅者也看不到丢。
|
||||||
|
|
||||||
|
**Reason / 原因**
|
||||||
|
|
||||||
|
The driver publishes `/odin1/imu` and `/odin1/odometry_highfreq` with `RELIABLE` QoS. By default `ros2 bag record` subscribes with `history = keep_last`, `depth = 10`, which only buffers ~25 ms of samples at 400 Hz. Whenever the recorder is briefly delayed (disk flush, mcap/sqlite chunk write, scheduler jitter), its subscription queue overflows and DDS silently drops the oldest samples on the **subscriber side**. The SDK and publisher are unaffected, which is why no drop appears in the driver logs or in `ros2 topic hz`.
|
||||||
|
|
||||||
|
驱动以 `RELIABLE` QoS 发布 `/odin1/imu` 与 `/odin1/odometry_highfreq`。`ros2 bag record` 默认订阅使用 `history = keep_last`、`depth = 10`,在 400 Hz 下只能缓冲约 25 ms。一旦录制端有短暂阻塞(落盘 flush、mcap/sqlite chunk 写入、调度抖动),订阅队列就会溢出,DDS 在**订阅端**静默丢掉最旧的样本。SDK 与 publisher 不受影响,因此驱动日志和 `ros2 topic hz` 都看不到丢。
|
||||||
|
|
||||||
|
**Resolution / 解决方案**
|
||||||
|
|
||||||
|
Use the provided QoS override file `script/rosbag2_qos.yaml` to raise the subscriber-side queue depth on the recorder for the two high-rate topics:
|
||||||
|
|
||||||
|
使用本仓库提供的 QoS 配置 `script/rosbag2_qos.yaml`,把高频话题的录制订阅 depth 拉大:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
# script/rosbag2_qos.yaml
|
||||||
|
/odin1/imu:
|
||||||
|
reliability: reliable
|
||||||
|
history: keep_last
|
||||||
|
depth: 4000
|
||||||
|
|
||||||
|
/odin1/odometry_highfreq:
|
||||||
|
reliability: reliable
|
||||||
|
history: keep_last
|
||||||
|
depth: 4000
|
||||||
|
```
|
||||||
|
|
||||||
|
Apply it when recording / 录制时通过 `--qos-profile-overrides-path` 应用:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
ros2 bag record -a \
|
||||||
|
--qos-profile-overrides-path src/odin_ros_driver/script/rosbag2_qos.yaml \
|
||||||
|
-o my_bag
|
||||||
|
```
|
||||||
|
|
||||||
|
Or only the high-rate topics / 也可以只录制高频话题:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
ros2 bag record \
|
||||||
|
--qos-profile-overrides-path src/odin_ros_driver/script/rosbag2_qos.yaml \
|
||||||
|
-o my_bag \
|
||||||
|
/odin1/imu /odin1/odometry_highfreq /odin1/odometry /odin1/wiwc /odin1/cloud_raw
|
||||||
|
```
|
||||||
|
|
||||||
|
**Optional further tuning / 可选的进一步优化**
|
||||||
|
|
||||||
|
If drops still occur after applying the override (typically on slower disks), try the following in addition / 套用上述 override 后仍有丢包时(通常发生在慢盘上),可叠加以下措施:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
# Use mcap backend with a larger internal cache (faster than sqlite3).
|
||||||
|
# 使用 mcap 后端 + 更大的内部缓存(比 sqlite3 快)。
|
||||||
|
ros2 bag record -s mcap --max-cache-size 1073741824 \
|
||||||
|
--qos-profile-overrides-path src/odin_ros_driver/script/rosbag2_qos.yaml \
|
||||||
|
-o my_bag \
|
||||||
|
/odin1/imu /odin1/odometry_highfreq ...
|
||||||
|
|
||||||
|
# Enlarge kernel UDP socket buffers (the most common hidden bottleneck for
|
||||||
|
# 400 Hz RELIABLE traffic, default is only 208 KB).
|
||||||
|
# 放大内核 UDP socket buffer(400 Hz RELIABLE 流量最常见的隐藏瓶颈,默认仅 208 KB)。
|
||||||
|
sudo sysctl -w net.core.rmem_max=33554432
|
||||||
|
sudo sysctl -w net.core.wmem_max=33554432
|
||||||
|
```
|
||||||
|
|
||||||
|
**Does ROS1 have the same problem? / ROS1 是否存在同样的问题?**
|
||||||
|
|
||||||
|
No. ROS1 uses TCP-based publish/subscribe with a single `queue_size` parameter on each side, and has no QoS profile mismatch between publisher and subscriber. The ROS1 publisher path in this driver already sizes the IMU and `odometry_highfreq` publishers to `queue_size = 4000` (`include/host_sdk_sample.h`, see `initialize_publishers` ROS1 branch), and `rosbag record` uses TCP transport which is reliable by construction. As a result this specific drop pattern does not occur under ROS1; no additional configuration is required.
|
||||||
|
|
||||||
|
不存在。ROS1 使用基于 TCP 的发布/订阅,发布端与订阅端各自只有一个 `queue_size` 参数,不存在 ROS2 那种 QoS profile 不匹配的问题。本驱动 ROS1 路径已经把 IMU 与 `odometry_highfreq` 的发布队列设置为 `queue_size = 4000`(见 `include/host_sdk_sample.h` 中 `initialize_publishers` 的 ROS1 分支),并且 `rosbag record` 使用 TCP 传输本身即可靠传递。因此在 ROS1 下不会出现该丢帧现象,也不需要额外配置。
|
||||||
|
|
||||||
|
## 6. Contact Information
|
||||||
|
|
||||||
|
You can contact our support through support@manifoldtech.cn
|
||||||
|
|
||||||
|
To help diagnose the issue, please provide the following details to our FAE engineer:
|
||||||
|
|
||||||
|
1. Current firmware version
|
||||||
|
```shell
|
||||||
|
[device_version_capture]: ros_driver_version: [Version Number]
|
||||||
|
```
|
||||||
|
2. Photos of power adapter and converter cable in use.
|
||||||
|
|
||||||
|
3. Does the issue happen occasionally or consistently?
|
||||||
|
|
||||||
|
4. Provide images of the problem scenario.
|
||||||
|
|
||||||
|
5. Did the troubleshooting methods in Section V resolve the issue?
|
||||||
|
|
||||||
|
6. Expected timeline for issue resolution.
|
||||||
@@ -0,0 +1,642 @@
|
|||||||
|
# Relocalization Guide / 重定位使用指南
|
||||||
|
|
||||||
|
This guide explains how to use the relocalization feature in Odin ROS Driver, including automatic relocalization and init position relocalization modes.
|
||||||
|
|
||||||
|
本指南介绍如何使用 Odin ROS Driver 的重定位功能,包括自动重定位和指定初始位置重定位两种模式。
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Table of Contents / 目录
|
||||||
|
|
||||||
|
1. [Overview / 概述](#overview--概述)
|
||||||
|
2. [Prerequisites / 前提条件](#prerequisites--前提条件)
|
||||||
|
3. [Mode 1: Auto Relocalization / 自动重定位](#mode-1-auto-relocalization--自动重定位)
|
||||||
|
4. [Mode 2: Init Position Relocalization / 指定初始位置重定位](#mode-2-init-position-relocalization--指定初始位置重定位)
|
||||||
|
5. [init_pos Format / init_pos 格式说明](#init_pos-format--init_pos-格式说明)
|
||||||
|
6. [Configuration Examples / 配置示例](#configuration-examples--配置示例)
|
||||||
|
7. [Programmatic API / 编程接口](#programmatic-api--编程接口)
|
||||||
|
8. [Troubleshooting / 故障排除](#troubleshooting--故障排除)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Overview / 概述
|
||||||
|
|
||||||
|
### English
|
||||||
|
|
||||||
|
Relocalization mode (`custom_map_mode: 2`) allows Odin to localize itself within a pre-built map. There are two approaches:
|
||||||
|
|
||||||
|
| Mode | Description | Use Case |
|
||||||
|
|------|-------------|----------|
|
||||||
|
| **Auto Relocalization** | Algorithm automatically searches for position in the map | Starting position is unknown or within recommended range |
|
||||||
|
| **Init Position Relocalization** | User provides an initial pose estimate via `init_pos` | Starting position is known, faster convergence needed |
|
||||||
|
|
||||||
|
### 中文
|
||||||
|
|
||||||
|
重定位模式(`custom_map_mode: 2`)允许 Odin 在预先构建的地图中进行自我定位。有两种方式:
|
||||||
|
|
||||||
|
| 模式 | 描述 | 适用场景 |
|
||||||
|
|------|------|----------|
|
||||||
|
| **自动重定位** | 算法自动在地图中搜索位置 | 起始位置未知,或在推荐范围内 |
|
||||||
|
| **指定初始位置重定位** | 用户通过 `init_pos` 提供初始位姿估计 | 起始位置已知,需要更快收敛 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Prerequisites / 前提条件
|
||||||
|
|
||||||
|
### English
|
||||||
|
|
||||||
|
1. **Pre-built map file**: A `.bin` map file created in SLAM mode (`custom_map_mode: 1`)
|
||||||
|
2. **Map file path**: Know the absolute path to your map file
|
||||||
|
3. **Starting position**: For init position mode, know the approximate starting pose in map coordinates
|
||||||
|
|
||||||
|
### 中文
|
||||||
|
|
||||||
|
1. **预构建的地图文件**:在 SLAM 模式(`custom_map_mode: 1`)下创建的 `.bin` 地图文件
|
||||||
|
2. **地图文件路径**:知道地图文件的绝对路径
|
||||||
|
3. **起始位置**:对于指定初始位置模式,需要知道在地图坐标系中的大致起始位姿
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mode 1: Auto Relocalization / 自动重定位
|
||||||
|
|
||||||
|
### English
|
||||||
|
|
||||||
|
In auto relocalization mode, the algorithm automatically searches for the device's position within the map based on current sensor observations.
|
||||||
|
|
||||||
|
**Configuration** (`config/control_command.yaml`):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
register_keys:
|
||||||
|
custom_map_mode: 2
|
||||||
|
relocalization_map_abs_path: "/path/to/your/map.bin"
|
||||||
|
# custom_init_pos is NOT set or uses default [0,0,0,0,0,0,1]
|
||||||
|
```
|
||||||
|
|
||||||
|
**Recommended Starting Conditions**:
|
||||||
|
- Within **1 meter** of a position on the original SLAM trajectory
|
||||||
|
- Within **±10 degrees** of the original orientation
|
||||||
|
- In a visually distinctive area of the map
|
||||||
|
|
||||||
|
**Behavior**:
|
||||||
|
1. On startup, Odin attempts to match current observations with the map
|
||||||
|
2. If successful, TF between `map` and `odom` frames is published
|
||||||
|
3. If unsuccessful, system operates in fallback SLAM mode (map saving disabled)
|
||||||
|
4. Relocalization attempts continue in background until successful
|
||||||
|
|
||||||
|
**Tips**:
|
||||||
|
- Gently shaking or moving the device after startup can improve relocalization accuracy
|
||||||
|
- Highly distinctive scenes may allow successful matching beyond the 1m/10° range
|
||||||
|
|
||||||
|
### 中文
|
||||||
|
|
||||||
|
在自动重定位模式下,算法根据当前传感器观测自动在地图中搜索设备位置。
|
||||||
|
|
||||||
|
**配置** (`config/control_command.yaml`):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
register_keys:
|
||||||
|
custom_map_mode: 2
|
||||||
|
relocalization_map_abs_path: "/path/to/your/map.bin"
|
||||||
|
# custom_init_pos 不设置或使用默认值 [0,0,0,0,0,0,1]
|
||||||
|
```
|
||||||
|
|
||||||
|
**推荐起始条件**:
|
||||||
|
- 距离原始 SLAM 轨迹上某点 **1 米**以内
|
||||||
|
- 朝向与原始方向偏差在 **±10 度**以内
|
||||||
|
- 位于地图中视觉特征明显的区域
|
||||||
|
|
||||||
|
**行为**:
|
||||||
|
1. 启动时,Odin 尝试将当前观测与地图匹配
|
||||||
|
2. 如果成功,发布 `map` 和 `odom` 坐标系之间的 TF
|
||||||
|
3. 如果失败,系统进入后备 SLAM 模式(地图保存功能禁用)
|
||||||
|
4. 后台持续尝试重定位直到成功
|
||||||
|
|
||||||
|
**提示**:
|
||||||
|
- 启动后轻轻晃动或移动设备可以提高重定位精度
|
||||||
|
- 在特征明显的场景中,可能在超出 1m/10° 范围时也能成功匹配
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Mode 2: Init Position Relocalization / 指定初始位置重定位
|
||||||
|
|
||||||
|
### English
|
||||||
|
|
||||||
|
In init position relocalization mode, you provide an initial pose estimate to help the algorithm converge faster.
|
||||||
|
|
||||||
|
**Configuration** (`config/control_command.yaml`):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
register_keys:
|
||||||
|
custom_map_mode: 2
|
||||||
|
relocalization_map_abs_path: "/path/to/your/map.bin"
|
||||||
|
custom_init_pos: [x, y, z, qx, qy, qz, qw]
|
||||||
|
```
|
||||||
|
|
||||||
|
**When to Use**:
|
||||||
|
- You know the approximate starting position (e.g., from external localization system)
|
||||||
|
- Starting position is far from the recommended 1m/10° range
|
||||||
|
- You need faster relocalization convergence
|
||||||
|
- Deploying in a fixed docking station with known pose
|
||||||
|
|
||||||
|
**Behavior**:
|
||||||
|
1. Algorithm uses provided `init_pos` as initial pose estimate
|
||||||
|
2. Searches for matches in the vicinity of the provided position
|
||||||
|
3. Faster convergence compared to auto mode when estimate is accurate
|
||||||
|
|
||||||
|
### 中文
|
||||||
|
|
||||||
|
在指定初始位置重定位模式下,您提供初始位姿估计以帮助算法更快收敛。
|
||||||
|
|
||||||
|
**配置** (`config/control_command.yaml`):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
register_keys:
|
||||||
|
custom_map_mode: 2
|
||||||
|
relocalization_map_abs_path: "/path/to/your/map.bin"
|
||||||
|
custom_init_pos: [x, y, z, qx, qy, qz, qw]
|
||||||
|
```
|
||||||
|
|
||||||
|
**适用场景**:
|
||||||
|
- 您知道大致的起始位置(例如,来自外部定位系统)
|
||||||
|
- 起始位置远离推荐的 1m/10° 范围
|
||||||
|
- 需要更快的重定位收敛速度
|
||||||
|
- 部署在已知位姿的固定充电桩
|
||||||
|
|
||||||
|
**行为**:
|
||||||
|
1. 算法使用提供的 `init_pos` 作为初始位姿估计
|
||||||
|
2. 在提供位置的附近搜索匹配
|
||||||
|
3. 当估计准确时,比自动模式收敛更快
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## init_pos Format / init_pos 格式说明
|
||||||
|
|
||||||
|
### English
|
||||||
|
|
||||||
|
`init_pos` is an array of **7 float values** representing position and orientation:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
custom_init_pos: [x, y, z, qx, qy, qz, qw]
|
||||||
|
```
|
||||||
|
|
||||||
|
| Index | Parameter | Description | Unit |
|
||||||
|
|-------|-----------|-------------|------|
|
||||||
|
| 0 | x | X position in map frame | meters |
|
||||||
|
| 1 | y | Y position in map frame | meters |
|
||||||
|
| 2 | z | Z position in map frame | meters |
|
||||||
|
| 3 | qx | Quaternion X component | - |
|
||||||
|
| 4 | qy | Quaternion Y component | - |
|
||||||
|
| 5 | qz | Quaternion Z component | - |
|
||||||
|
| 6 | qw | Quaternion W component | - |
|
||||||
|
|
||||||
|
**Important Notes**:
|
||||||
|
- The quaternion must be normalized: `sqrt(qx² + qy² + qz² + qw²) ≈ 1.0`
|
||||||
|
- Coordinates are relative to the **map frame** (world frame at SLAM start)
|
||||||
|
- Default value `[0, 0, 0, 0, 0, 0, 1]` represents origin with no rotation
|
||||||
|
|
||||||
|
**Common Quaternion Values**:
|
||||||
|
|
||||||
|
| Orientation | qx | qy | qz | qw |
|
||||||
|
|-------------|----|----|----|----|
|
||||||
|
| No rotation (identity) | 0 | 0 | 0 | 1 |
|
||||||
|
| 90° around Z-axis | 0 | 0 | 0.707 | 0.707 |
|
||||||
|
| 180° around Z-axis | 0 | 0 | 1 | 0 |
|
||||||
|
| -90° around Z-axis | 0 | 0 | -0.707 | 0.707 |
|
||||||
|
|
||||||
|
### 中文
|
||||||
|
|
||||||
|
`init_pos` 是一个包含 **7 个 float 值**的数组,表示位置和朝向:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
custom_init_pos: [x, y, z, qx, qy, qz, qw]
|
||||||
|
```
|
||||||
|
|
||||||
|
| 索引 | 参数 | 描述 | 单位 |
|
||||||
|
|------|------|------|------|
|
||||||
|
| 0 | x | 地图坐标系中的 X 位置 | 米 |
|
||||||
|
| 1 | y | 地图坐标系中的 Y 位置 | 米 |
|
||||||
|
| 2 | z | 地图坐标系中的 Z 位置 | 米 |
|
||||||
|
| 3 | qx | 四元数 X 分量 | - |
|
||||||
|
| 4 | qy | 四元数 Y 分量 | - |
|
||||||
|
| 5 | qz | 四元数 Z 分量 | - |
|
||||||
|
| 6 | qw | 四元数 W 分量 | - |
|
||||||
|
|
||||||
|
**重要说明**:
|
||||||
|
- 四元数必须归一化:`sqrt(qx² + qy² + qz² + qw²) ≈ 1.0`
|
||||||
|
- 坐标相对于**地图坐标系**(SLAM 启动时的世界坐标系)
|
||||||
|
- 默认值 `[0, 0, 0, 0, 0, 0, 1]` 表示原点且无旋转
|
||||||
|
|
||||||
|
**常用四元数值**:
|
||||||
|
|
||||||
|
| 朝向 | qx | qy | qz | qw |
|
||||||
|
|------|----|----|----|----|
|
||||||
|
| 无旋转(单位四元数) | 0 | 0 | 0 | 1 |
|
||||||
|
| 绕 Z 轴旋转 90° | 0 | 0 | 0.707 | 0.707 |
|
||||||
|
| 绕 Z 轴旋转 180° | 0 | 0 | 1 | 0 |
|
||||||
|
| 绕 Z 轴旋转 -90° | 0 | 0 | -0.707 | 0.707 |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Configuration Examples / 配置示例
|
||||||
|
|
||||||
|
### Example 1: Auto Relocalization / 自动重定位示例
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
register_keys:
|
||||||
|
custom_map_mode: 2
|
||||||
|
relocalization_map_abs_path: "/home/user/maps/office_map.bin"
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example 2: Init Position at Origin / 在原点指定初始位置
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
register_keys:
|
||||||
|
custom_map_mode: 2
|
||||||
|
relocalization_map_abs_path: "/home/user/maps/office_map.bin"
|
||||||
|
custom_init_pos: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example 3: Init Position with Offset / 带偏移的初始位置
|
||||||
|
|
||||||
|
Position at (5.2, -3.1, 0) with 90° rotation around Z-axis:
|
||||||
|
|
||||||
|
位置在 (5.2, -3.1, 0),绕 Z 轴旋转 90°:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
register_keys:
|
||||||
|
custom_map_mode: 2
|
||||||
|
relocalization_map_abs_path: "/home/user/maps/warehouse_map.bin"
|
||||||
|
custom_init_pos: [5.2, -3.1, 0.0, 0.0, 0.0, 0.707, 0.707]
|
||||||
|
```
|
||||||
|
|
||||||
|
### Example 4: Docking Station Pose / 充电桩位置
|
||||||
|
|
||||||
|
Known docking station at (10.5, 2.3, 0) facing -X direction (180° rotation):
|
||||||
|
|
||||||
|
已知充电桩位置在 (10.5, 2.3, 0),朝向 -X 方向(旋转 180°):
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
register_keys:
|
||||||
|
custom_map_mode: 2
|
||||||
|
relocalization_map_abs_path: "/home/user/maps/factory_map.bin"
|
||||||
|
custom_init_pos: [10.5, 2.3, 0.0, 0.0, 0.0, 1.0, 0.0]
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Programmatic API / 编程接口
|
||||||
|
|
||||||
|
### English
|
||||||
|
|
||||||
|
You can also set `init_pos` programmatically using the `lidar_set_custom_parameter` API. This is useful for:
|
||||||
|
- Dynamic relocalization during runtime
|
||||||
|
- Integration with external localization systems
|
||||||
|
- Setting initial pose from robot's last known position
|
||||||
|
|
||||||
|
#### API Function
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include "lidar_api.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Set a custom parameter on the device
|
||||||
|
* @param device Device handle obtained from lidar_open_device()
|
||||||
|
* @param param_name Parameter name (e.g., "init_pos")
|
||||||
|
* @param value_data Pointer to the parameter data
|
||||||
|
* @param value_length Size of the data in bytes
|
||||||
|
* @return 0 on success, -1 on error, -2 if file transfer in progress
|
||||||
|
*/
|
||||||
|
int lidar_set_custom_parameter(device_handle device,
|
||||||
|
const char* param_name,
|
||||||
|
const void* value_data,
|
||||||
|
size_t value_length);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Complete Example
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include "lidar_api.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
// Helper function to create quaternion from yaw angle (rotation around Z-axis)
|
||||||
|
void yaw_to_quaternion(float yaw_rad, float* qx, float* qy, float* qz, float* qw) {
|
||||||
|
*qx = 0.0f;
|
||||||
|
*qy = 0.0f;
|
||||||
|
*qz = sinf(yaw_rad / 2.0f);
|
||||||
|
*qw = cosf(yaw_rad / 2.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_init_position(device_handle device,
|
||||||
|
float x, float y, float z,
|
||||||
|
float qx, float qy, float qz, float qw) {
|
||||||
|
// init_pos format: [x, y, z, qx, qy, qz, qw] - 7 floats
|
||||||
|
float init_pos[7] = {x, y, z, qx, qy, qz, qw};
|
||||||
|
|
||||||
|
int result = lidar_set_custom_parameter(
|
||||||
|
device,
|
||||||
|
"init_pos", // Parameter name
|
||||||
|
init_pos, // Data pointer
|
||||||
|
sizeof(init_pos) // 7 * sizeof(float) = 28 bytes
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
printf("Successfully set init_pos: [%.3f, %.3f, %.3f, %.3f, %.3f, %.3f, %.3f]\n",
|
||||||
|
x, y, z, qx, qy, qz, qw);
|
||||||
|
} else {
|
||||||
|
printf("Failed to set init_pos, error code: %d\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Usage examples:
|
||||||
|
|
||||||
|
// Example 1: Set position at origin with no rotation
|
||||||
|
void example_origin(device_handle device) {
|
||||||
|
set_init_position(device,
|
||||||
|
0.0f, 0.0f, 0.0f, // x, y, z
|
||||||
|
0.0f, 0.0f, 0.0f, 1.0f // qx, qy, qz, qw (identity)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example 2: Set position with 90° yaw rotation
|
||||||
|
void example_with_rotation(device_handle device) {
|
||||||
|
float qx, qy, qz, qw;
|
||||||
|
float yaw_degrees = 90.0f;
|
||||||
|
float yaw_rad = yaw_degrees * M_PI / 180.0f;
|
||||||
|
|
||||||
|
yaw_to_quaternion(yaw_rad, &qx, &qy, &qz, &qw);
|
||||||
|
|
||||||
|
set_init_position(device,
|
||||||
|
5.2f, -3.1f, 0.0f, // x, y, z
|
||||||
|
qx, qy, qz, qw // quaternion from yaw
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Example 3: Set position from external localization system
|
||||||
|
void example_from_external_localization(device_handle device,
|
||||||
|
double ext_x, double ext_y, double ext_yaw) {
|
||||||
|
float qx, qy, qz, qw;
|
||||||
|
yaw_to_quaternion((float)ext_yaw, &qx, &qy, &qz, &qw);
|
||||||
|
|
||||||
|
set_init_position(device,
|
||||||
|
(float)ext_x, (float)ext_y, 0.0f,
|
||||||
|
qx, qy, qz, qw
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ROS Integration Example
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include "lidar_api.h"
|
||||||
|
#include <geometry_msgs/PoseWithCovarianceStamped.h> // ROS1
|
||||||
|
// or
|
||||||
|
#include <geometry_msgs/msg/pose_with_covariance_stamped.hpp> // ROS2
|
||||||
|
|
||||||
|
// Callback for /initialpose topic (from RViz "2D Pose Estimate" tool)
|
||||||
|
void initialPoseCallback(const geometry_msgs::PoseWithCovarianceStamped::ConstPtr& msg,
|
||||||
|
device_handle device) {
|
||||||
|
float init_pos[7] = {
|
||||||
|
(float)msg->pose.pose.position.x,
|
||||||
|
(float)msg->pose.pose.position.y,
|
||||||
|
(float)msg->pose.pose.position.z,
|
||||||
|
(float)msg->pose.pose.orientation.x,
|
||||||
|
(float)msg->pose.pose.orientation.y,
|
||||||
|
(float)msg->pose.pose.orientation.z,
|
||||||
|
(float)msg->pose.pose.orientation.w
|
||||||
|
};
|
||||||
|
|
||||||
|
int result = lidar_set_custom_parameter(device, "init_pos", init_pos, sizeof(init_pos));
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
ROS_INFO("Set init_pos from RViz: [%.2f, %.2f, %.2f]",
|
||||||
|
init_pos[0], init_pos[1], init_pos[2]);
|
||||||
|
} else {
|
||||||
|
ROS_ERROR("Failed to set init_pos: %d", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Important Notes
|
||||||
|
|
||||||
|
1. **Call timing**: Set `init_pos` **before** starting the stream with `lidar_start_stream()`
|
||||||
|
2. **Map mode**: Ensure `custom_map_mode` is set to `2` (relocalization mode)
|
||||||
|
3. **Map file**: The relocalization map must be set via `lidar_set_relocalization_map()` or YAML config
|
||||||
|
4. **Thread safety**: `lidar_set_custom_parameter` is thread-safe but blocks until response received
|
||||||
|
|
||||||
|
### 中文
|
||||||
|
|
||||||
|
您也可以使用 `lidar_set_custom_parameter` API 以编程方式设置 `init_pos`。适用于:
|
||||||
|
- 运行时动态重定位
|
||||||
|
- 与外部定位系统集成
|
||||||
|
- 从机器人上次已知位置设置初始位姿
|
||||||
|
|
||||||
|
#### API 函数
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include "lidar_api.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief 在设备上设置自定义参数
|
||||||
|
* @param device 从 lidar_open_device() 获取的设备句柄
|
||||||
|
* @param param_name 参数名称(如 "init_pos")
|
||||||
|
* @param value_data 指向参数数据的指针
|
||||||
|
* @param value_length 数据大小(字节)
|
||||||
|
* @return 成功返回 0,错误返回 -1,文件传输中返回 -2
|
||||||
|
*/
|
||||||
|
int lidar_set_custom_parameter(device_handle device,
|
||||||
|
const char* param_name,
|
||||||
|
const void* value_data,
|
||||||
|
size_t value_length);
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 完整示例
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include "lidar_api.h"
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
// 辅助函数:从偏航角(绕 Z 轴旋转)创建四元数
|
||||||
|
void yaw_to_quaternion(float yaw_rad, float* qx, float* qy, float* qz, float* qw) {
|
||||||
|
*qx = 0.0f;
|
||||||
|
*qy = 0.0f;
|
||||||
|
*qz = sinf(yaw_rad / 2.0f);
|
||||||
|
*qw = cosf(yaw_rad / 2.0f);
|
||||||
|
}
|
||||||
|
|
||||||
|
int set_init_position(device_handle device,
|
||||||
|
float x, float y, float z,
|
||||||
|
float qx, float qy, float qz, float qw) {
|
||||||
|
// init_pos 格式: [x, y, z, qx, qy, qz, qw] - 7 个 float
|
||||||
|
float init_pos[7] = {x, y, z, qx, qy, qz, qw};
|
||||||
|
|
||||||
|
int result = lidar_set_custom_parameter(
|
||||||
|
device,
|
||||||
|
"init_pos", // 参数名
|
||||||
|
init_pos, // 数据指针
|
||||||
|
sizeof(init_pos) // 7 * sizeof(float) = 28 字节
|
||||||
|
);
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
printf("成功设置 init_pos: [%.3f, %.3f, %.3f, %.3f, %.3f, %.3f, %.3f]\n",
|
||||||
|
x, y, z, qx, qy, qz, qw);
|
||||||
|
} else {
|
||||||
|
printf("设置 init_pos 失败,错误码: %d\n", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用示例:
|
||||||
|
|
||||||
|
// 示例 1:在原点设置位置,无旋转
|
||||||
|
void example_origin(device_handle device) {
|
||||||
|
set_init_position(device,
|
||||||
|
0.0f, 0.0f, 0.0f, // x, y, z
|
||||||
|
0.0f, 0.0f, 0.0f, 1.0f // qx, qy, qz, qw(单位四元数)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 示例 2:设置带 90° 偏航旋转的位置
|
||||||
|
void example_with_rotation(device_handle device) {
|
||||||
|
float qx, qy, qz, qw;
|
||||||
|
float yaw_degrees = 90.0f;
|
||||||
|
float yaw_rad = yaw_degrees * M_PI / 180.0f;
|
||||||
|
|
||||||
|
yaw_to_quaternion(yaw_rad, &qx, &qy, &qz, &qw);
|
||||||
|
|
||||||
|
set_init_position(device,
|
||||||
|
5.2f, -3.1f, 0.0f, // x, y, z
|
||||||
|
qx, qy, qz, qw // 从偏航角计算的四元数
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 示例 3:从外部定位系统设置位置
|
||||||
|
void example_from_external_localization(device_handle device,
|
||||||
|
double ext_x, double ext_y, double ext_yaw) {
|
||||||
|
float qx, qy, qz, qw;
|
||||||
|
yaw_to_quaternion((float)ext_yaw, &qx, &qy, &qz, &qw);
|
||||||
|
|
||||||
|
set_init_position(device,
|
||||||
|
(float)ext_x, (float)ext_y, 0.0f,
|
||||||
|
qx, qy, qz, qw
|
||||||
|
);
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### ROS 集成示例
|
||||||
|
|
||||||
|
```cpp
|
||||||
|
#include "lidar_api.h"
|
||||||
|
#include <geometry_msgs/PoseWithCovarianceStamped.h> // ROS1
|
||||||
|
// 或
|
||||||
|
#include <geometry_msgs/msg/pose_with_covariance_stamped.hpp> // ROS2
|
||||||
|
|
||||||
|
// /initialpose 话题的回调函数(来自 RViz 的 "2D Pose Estimate" 工具)
|
||||||
|
void initialPoseCallback(const geometry_msgs::PoseWithCovarianceStamped::ConstPtr& msg,
|
||||||
|
device_handle device) {
|
||||||
|
float init_pos[7] = {
|
||||||
|
(float)msg->pose.pose.position.x,
|
||||||
|
(float)msg->pose.pose.position.y,
|
||||||
|
(float)msg->pose.pose.position.z,
|
||||||
|
(float)msg->pose.pose.orientation.x,
|
||||||
|
(float)msg->pose.pose.orientation.y,
|
||||||
|
(float)msg->pose.pose.orientation.z,
|
||||||
|
(float)msg->pose.pose.orientation.w
|
||||||
|
};
|
||||||
|
|
||||||
|
int result = lidar_set_custom_parameter(device, "init_pos", init_pos, sizeof(init_pos));
|
||||||
|
|
||||||
|
if (result == 0) {
|
||||||
|
ROS_INFO("从 RViz 设置 init_pos: [%.2f, %.2f, %.2f]",
|
||||||
|
init_pos[0], init_pos[1], init_pos[2]);
|
||||||
|
} else {
|
||||||
|
ROS_ERROR("设置 init_pos 失败: %d", result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 重要说明
|
||||||
|
|
||||||
|
1. **调用时机**:在调用 `lidar_start_stream()` 启动数据流**之前**设置 `init_pos`
|
||||||
|
2. **地图模式**:确保 `custom_map_mode` 设置为 `2`(重定位模式)
|
||||||
|
3. **地图文件**:必须通过 `lidar_set_relocalization_map()` 或 YAML 配置设置重定位地图
|
||||||
|
4. **线程安全**:`lidar_set_custom_parameter` 是线程安全的,但会阻塞直到收到响应
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Troubleshooting / 故障排除
|
||||||
|
|
||||||
|
### Relocalization Fails / 重定位失败
|
||||||
|
|
||||||
|
**English**:
|
||||||
|
- Ensure starting position is within recommended range (1m/10°)
|
||||||
|
- Check that the map file path is correct and file exists
|
||||||
|
- Verify the environment hasn't changed significantly since mapping
|
||||||
|
- Try gently moving the device to provide more observations
|
||||||
|
|
||||||
|
**中文**:
|
||||||
|
- 确保起始位置在推荐范围内(1m/10°)
|
||||||
|
- 检查地图文件路径是否正确且文件存在
|
||||||
|
- 验证环境自建图以来没有显著变化
|
||||||
|
- 尝试轻轻移动设备以提供更多观测
|
||||||
|
|
||||||
|
### init_pos Not Taking Effect / init_pos 未生效
|
||||||
|
|
||||||
|
**English**:
|
||||||
|
- Verify `custom_map_mode` is set to `2`
|
||||||
|
- Check that `custom_init_pos` has exactly 7 values
|
||||||
|
- Ensure quaternion is normalized (sum of squares ≈ 1)
|
||||||
|
- Restart the driver after modifying configuration
|
||||||
|
|
||||||
|
**中文**:
|
||||||
|
- 验证 `custom_map_mode` 设置为 `2`
|
||||||
|
- 检查 `custom_init_pos` 是否恰好有 7 个值
|
||||||
|
- 确保四元数已归一化(平方和 ≈ 1)
|
||||||
|
- 修改配置后重启驱动程序
|
||||||
|
|
||||||
|
### TF Not Published / TF 未发布
|
||||||
|
|
||||||
|
**English**:
|
||||||
|
- Relocalization may still be in progress
|
||||||
|
- Check ROS logs for relocalization status messages
|
||||||
|
- System operates in fallback mode until relocalization succeeds
|
||||||
|
|
||||||
|
**中文**:
|
||||||
|
- 重定位可能仍在进行中
|
||||||
|
- 检查 ROS 日志中的重定位状态消息
|
||||||
|
- 系统在重定位成功前以后备模式运行
|
||||||
|
|
||||||
|
### Map File Not Found / 地图文件未找到
|
||||||
|
|
||||||
|
**English**:
|
||||||
|
- Use absolute path (starting with `/`)
|
||||||
|
- Check file permissions
|
||||||
|
- Verify file extension is `.bin`
|
||||||
|
|
||||||
|
**中文**:
|
||||||
|
- 使用绝对路径(以 `/` 开头)
|
||||||
|
- 检查文件权限
|
||||||
|
- 验证文件扩展名为 `.bin`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Related Topics / 相关话题
|
||||||
|
|
||||||
|
| Topic | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| `/odin1/odometry` | Odometry in odom frame |
|
||||||
|
| `/odin1/odometry_highfreq` | High-frequency odometry |
|
||||||
|
| `/odin1/cloud_slam` | SLAM point cloud in odom frame |
|
||||||
|
| `/tf` | Transform tree (includes map→odom after successful relocalization) |
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## See Also / 参见
|
||||||
|
|
||||||
|
- [README.md](README.md) - Main documentation
|
||||||
|
- [config/control_command.yaml](config/control_command.yaml) - Configuration file
|
||||||
|
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
# O1-P040100042
|
||||||
|
cam_num: 1
|
||||||
|
img_topic_0: /camera/rgb
|
||||||
|
Tcl_0: [
|
||||||
|
-0.00916, -0.99996, 0.00032, 0.03215,
|
||||||
|
0.00239, -0.00034, -1.00000, -0.01185,
|
||||||
|
0.99996, -0.00916, 0.00239, 0.00536,
|
||||||
|
0.00000, 0.00000, 0.00000, 1.00000
|
||||||
|
]
|
||||||
|
|
||||||
|
cam_0:
|
||||||
|
cam_model: FishPoly
|
||||||
|
image_width: 1600
|
||||||
|
image_height: 1296
|
||||||
|
k2: 6.5597407531742908e-04
|
||||||
|
k3: -2.8960653254664001e-02
|
||||||
|
k4: 4.5390330144604515e-02
|
||||||
|
k5: -6.4513398102889072e-02
|
||||||
|
k6: 3.8735200610848508e-02
|
||||||
|
k7: -9.9027101865577991e-03
|
||||||
|
p1: 0.
|
||||||
|
p2: 0.
|
||||||
|
A11: 7.3689426240691989e+02
|
||||||
|
A12: -1.6114977429994648e-01
|
||||||
|
A22: 7.3661135398452438e+02
|
||||||
|
u0: 8.0612553451014685e+02
|
||||||
|
v0: 6.3965071026991302e+02
|
||||||
|
isFast: 0
|
||||||
|
numDiff: 3000
|
||||||
|
maxIncidentAngle: 120
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
register_keys:
|
||||||
|
|
||||||
|
# if off, allow connection even if usb connection is below usb 3.0
|
||||||
|
# ATTENTION: usb 3.0 is always recommended, as advance functionality like SLAM mode requires usb 3.0 for reliable map file transfer
|
||||||
|
strict_usb3.0_check: 0 # 0: off: 1: on;
|
||||||
|
|
||||||
|
# 0: use odin internal system time as data time stamp, typical and recommended;
|
||||||
|
# 1: use host ros time (upon receive) as data time stamp, only use if you specifically require this setup, not recommended for most users
|
||||||
|
# 2: align odin1 time to host time, timestamp is the sensor data reception time on host time axis
|
||||||
|
use_host_ros_time: 1
|
||||||
|
|
||||||
|
streamctrl: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# original rgb data in jpeg format from device
|
||||||
|
sendrgbcompressed: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# RGB data, decoded from original jpeg data from device, bgr8 format
|
||||||
|
# Processed on host device
|
||||||
|
sendrgb: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# undistort rgb image processed from decoded rgb data.
|
||||||
|
# depends on sendrgb. related camera parameters can be found in ws/src/odin_ros_driver/config/calib.yaml
|
||||||
|
# Processed on host device
|
||||||
|
sendrgbundistort: 0 # 0: off; 1: on.
|
||||||
|
|
||||||
|
# IMU data
|
||||||
|
sendimu: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# SDK IMU smooth sending feature
|
||||||
|
# When enabled, SDK will send IMU data at precise intervals (default 400Hz)
|
||||||
|
# using a dedicated high-priority thread to reduce jitter and timing variance
|
||||||
|
enable_imu_smooth: 1 # 0: disable SDK IMU smooth sending; 1: enable (default)
|
||||||
|
|
||||||
|
# SDK IMU smooth sending frequency in Hz (only effective when enable_imu_smooth = 1)
|
||||||
|
imu_smooth_frequency: 400 # 1-1000 Hz, recommended 400 Hz
|
||||||
|
|
||||||
|
# Odometry data
|
||||||
|
sendodom: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# TF from odom to base_link. Leave it on unless you specifically need it off.
|
||||||
|
# ATTENTION: critical for rviz to show cloud_raw.
|
||||||
|
send_odom_baselink_tf: 0 # 0: off; 1: on.
|
||||||
|
|
||||||
|
# raw dtof data
|
||||||
|
senddtof: 1 # 0: off; 1: on
|
||||||
|
cloud_raw_confidence_threshold: 35 # please refer to readme for more details
|
||||||
|
|
||||||
|
# dtof sensor frame rate. Supported values: 100 (10fps) or 145 (14.5fps)
|
||||||
|
# Higher frame rate provides smoother point cloud data but may increase data bandwidth
|
||||||
|
# Note: value is multiplied by 10 (e.g., 145 means 14.5fps)
|
||||||
|
dtof_fps: 100 # 100: 10fps; 145: 14.5fps
|
||||||
|
|
||||||
|
# slam cloud data
|
||||||
|
sendcloudslam: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# processed with raw point cloud, rgb image, and calib.yaml from device
|
||||||
|
# Processed on host device
|
||||||
|
sendcloudrender: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# depth completion demo, high computing resource usage.
|
||||||
|
# for more information please refer to the readme file.
|
||||||
|
# Processed on host device
|
||||||
|
senddepth: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# cloud reprojection demo, projects cloud_slam to camera image using odometry
|
||||||
|
# Processed on host device
|
||||||
|
sendreprojection: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# image overlay settings - overlays reprojected points on camera image
|
||||||
|
# Processed on host device
|
||||||
|
sendoverlay: 0 # 0: off; 1: on
|
||||||
|
overlay_reprojected_topic: "/odin1/reprojected_image" # reprojected image topic
|
||||||
|
overlay_camera_topic: "/odin1/image/undistorted" # camera image topic (undistorted)
|
||||||
|
overlay_output_topic: "/odin1/overlay_image" # output overlay image topic
|
||||||
|
overlay_alpha: 0.6 # blend alpha (0.0-1.0, higher = more reproj color)
|
||||||
|
|
||||||
|
# record rgb, odometry, and slam cloud data as proprietary olx format for further processing in MindCloud(TM) software.
|
||||||
|
# save path: ws/src/odin_ros_driver/recorddata/{record_start_time}/
|
||||||
|
# ATTENTION: please copy the full folder for post-processing.
|
||||||
|
recorddata: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# Save device runtime status info to ws/src/odin_ros_driver/log/Driver_{drvier_start_time}/Conn_{device_connection_time}/dev_status.csv
|
||||||
|
devstatuslog: 1 # 0: off; 1: on.
|
||||||
|
|
||||||
|
save_log: 0 # 0: off; 1: on;
|
||||||
|
|
||||||
|
# raw dtof sensor intensity data in gray format, mostly for debug purpose.
|
||||||
|
pubintensitygray: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
showpath: 0 # 0: off; 1: on
|
||||||
|
showcamerapose: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
custom_map_mode: 2 # 0: Odometry mode 1: SLAM mode 2: Relocalization mode.
|
||||||
|
custom_init_pos: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
|
||||||
|
custom_init_pose_search_radius: 4.0 # max position offset in meters, recommended <= 10
|
||||||
|
custom_init_pose_max_rot_deg: 180.0 # max rotation offset in degrees, up to 180
|
||||||
|
relocalization_map_abs_path: "/absolute/path/to/1hao.bin" # required for Relocalization mode; edit on the target computer
|
||||||
|
|
||||||
|
# To get the mapping result file, please use the set_param.sh script provided: "./set_param.sh save_map 1"
|
||||||
|
mapping_result_dest_dir: "" # "": if not specified, save to default location of {ws}/src/odin_ros_driver/map/{driver_start_time}/
|
||||||
|
mapping_result_file_name: "" # "": if not specified, save to location above with default file name of map_{map_save_time}.bin
|
||||||
|
|
||||||
|
# Image mask transfer settings
|
||||||
|
sendimagemask: 0 # 0: off; 1: on - transfer image mask to device on startup
|
||||||
|
image_mask_abs_path: "" # absolute path to the image mask file (e.g., /path/to/mask.png(1600x1296 resolution)
|
||||||
|
|
||||||
|
# Algorithm reset settings
|
||||||
|
resetalgo: 0 # 0: off; 1: on - send algo_reset command to device on startup
|
||||||
+110
@@ -0,0 +1,110 @@
|
|||||||
|
register_keys:
|
||||||
|
|
||||||
|
# if off, allow connection even if usb connection is below usb 3.0
|
||||||
|
# ATTENTION: usb 3.0 is always recommended, as advance functionality like SLAM mode requires usb 3.0 for reliable map file transfer
|
||||||
|
strict_usb3.0_check: 0 # 0: off: 1: on;
|
||||||
|
|
||||||
|
# 0: use odin internal system time as data time stamp, typical and recommended;
|
||||||
|
# 1: use host ros time (upon receive) as data time stamp, only use if you specifically require this setup, not recommended for most users
|
||||||
|
# 2: align odin1 time to host time, timestamp is the sensor data reception time on host time axis
|
||||||
|
use_host_ros_time: 1
|
||||||
|
|
||||||
|
streamctrl: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# original rgb data in jpeg format from device
|
||||||
|
sendrgbcompressed: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# RGB data, decoded from original jpeg data from device, bgr8 format
|
||||||
|
# Processed on host device
|
||||||
|
sendrgb: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# undistort rgb image processed from decoded rgb data.
|
||||||
|
# depends on sendrgb. related camera parameters can be found in ws/src/odin_ros_driver/config/calib.yaml
|
||||||
|
# Processed on host device
|
||||||
|
sendrgbundistort: 0 # 0: off; 1: on.
|
||||||
|
|
||||||
|
# IMU data
|
||||||
|
sendimu: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# SDK IMU smooth sending feature
|
||||||
|
# When enabled, SDK will send IMU data at precise intervals (default 400Hz)
|
||||||
|
# using a dedicated high-priority thread to reduce jitter and timing variance
|
||||||
|
enable_imu_smooth: 1 # 0: disable SDK IMU smooth sending; 1: enable (default)
|
||||||
|
|
||||||
|
# SDK IMU smooth sending frequency in Hz (only effective when enable_imu_smooth = 1)
|
||||||
|
imu_smooth_frequency: 400 # 1-1000 Hz, recommended 400 Hz
|
||||||
|
|
||||||
|
# Odometry data
|
||||||
|
sendodom: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# TF from odom to base_link. Leave it on unless you specifically need it off.
|
||||||
|
# ATTENTION: critical for rviz to show cloud_raw.
|
||||||
|
send_odom_baselink_tf: 0 # 0: off; 1: on.
|
||||||
|
|
||||||
|
# raw dtof data
|
||||||
|
senddtof: 1 # 0: off; 1: on
|
||||||
|
cloud_raw_confidence_threshold: 35 # please refer to readme for more details
|
||||||
|
|
||||||
|
# dtof sensor frame rate. Supported values: 100 (10fps) or 145 (14.5fps)
|
||||||
|
# Higher frame rate provides smoother point cloud data but may increase data bandwidth
|
||||||
|
# Note: value is multiplied by 10 (e.g., 145 means 14.5fps)
|
||||||
|
dtof_fps: 100 # 100: 10fps; 145: 14.5fps
|
||||||
|
|
||||||
|
# slam cloud data
|
||||||
|
sendcloudslam: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# processed with raw point cloud, rgb image, and calib.yaml from device
|
||||||
|
# Processed on host device
|
||||||
|
sendcloudrender: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# depth completion demo, high computing resource usage.
|
||||||
|
# for more information please refer to the readme file.
|
||||||
|
# Processed on host device
|
||||||
|
senddepth: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# cloud reprojection demo, projects cloud_slam to camera image using odometry
|
||||||
|
# Processed on host device
|
||||||
|
sendreprojection: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# image overlay settings - overlays reprojected points on camera image
|
||||||
|
# Processed on host device
|
||||||
|
sendoverlay: 0 # 0: off; 1: on
|
||||||
|
overlay_reprojected_topic: "/odin1/reprojected_image" # reprojected image topic
|
||||||
|
overlay_camera_topic: "/odin1/image/undistorted" # camera image topic (undistorted)
|
||||||
|
overlay_output_topic: "/odin1/overlay_image" # output overlay image topic
|
||||||
|
overlay_alpha: 0.6 # blend alpha (0.0-1.0, higher = more reproj color)
|
||||||
|
|
||||||
|
# record rgb, odometry, and slam cloud data as proprietary olx format for further processing in MindCloud(TM) software.
|
||||||
|
# save path: ws/src/odin_ros_driver/recorddata/{record_start_time}/
|
||||||
|
# ATTENTION: please copy the full folder for post-processing.
|
||||||
|
recorddata: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# Save device runtime status info to ws/src/odin_ros_driver/log/Driver_{drvier_start_time}/Conn_{device_connection_time}/dev_status.csv
|
||||||
|
devstatuslog: 1 # 0: off; 1: on.
|
||||||
|
|
||||||
|
save_log: 0 # 0: off; 1: on;
|
||||||
|
|
||||||
|
# raw dtof sensor intensity data in gray format, mostly for debug purpose.
|
||||||
|
pubintensitygray: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
showpath: 0 # 0: off; 1: on
|
||||||
|
showcamerapose: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# Screen LOC=ODOM profile. Keep Odin in odometry mode; sim2real_web_udp_bridge_node
|
||||||
|
# may publish the pure-odom map->odom fallback anchor.
|
||||||
|
custom_map_mode: 0 # 0: Odometry mode 1: SLAM mode 2: Relocalization mode.
|
||||||
|
custom_init_pos: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
|
||||||
|
custom_init_pose_search_radius: 4.0 # max position offset in meters, recommended <= 10
|
||||||
|
custom_init_pose_max_rot_deg: 180.0 # max rotation offset in degrees, up to 180
|
||||||
|
relocalization_map_abs_path: "" # unused in odometry mode
|
||||||
|
|
||||||
|
# To get the mapping result file, please use the set_param.sh script provided: "./set_param.sh save_map 1"
|
||||||
|
mapping_result_dest_dir: "" # "": if not specified, save to default location of {ws}/src/odin_ros_driver/map/{driver_start_time}/
|
||||||
|
mapping_result_file_name: "" # "": if not specified, save to location above with default file name of map_{map_save_time}.bin
|
||||||
|
|
||||||
|
# Image mask transfer settings
|
||||||
|
sendimagemask: 0 # 0: off; 1: on - transfer image mask to device on startup
|
||||||
|
image_mask_abs_path: "" # absolute path to the image mask file (e.g., /path/to/mask.png(1600x1296 resolution)
|
||||||
|
|
||||||
|
# Algorithm reset settings
|
||||||
|
resetalgo: 0 # 0: off; 1: on - send algo_reset command to device on startup
|
||||||
+110
@@ -0,0 +1,110 @@
|
|||||||
|
register_keys:
|
||||||
|
|
||||||
|
# if off, allow connection even if usb connection is below usb 3.0
|
||||||
|
# ATTENTION: usb 3.0 is always recommended, as advance functionality like SLAM mode requires usb 3.0 for reliable map file transfer
|
||||||
|
strict_usb3.0_check: 0 # 0: off: 1: on;
|
||||||
|
|
||||||
|
# 0: use odin internal system time as data time stamp, typical and recommended;
|
||||||
|
# 1: use host ros time (upon receive) as data time stamp, only use if you specifically require this setup, not recommended for most users
|
||||||
|
# 2: align odin1 time to host time, timestamp is the sensor data reception time on host time axis
|
||||||
|
use_host_ros_time: 1
|
||||||
|
|
||||||
|
streamctrl: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# original rgb data in jpeg format from device
|
||||||
|
sendrgbcompressed: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# RGB data, decoded from original jpeg data from device, bgr8 format
|
||||||
|
# Processed on host device
|
||||||
|
sendrgb: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# undistort rgb image processed from decoded rgb data.
|
||||||
|
# depends on sendrgb. related camera parameters can be found in ws/src/odin_ros_driver/config/calib.yaml
|
||||||
|
# Processed on host device
|
||||||
|
sendrgbundistort: 0 # 0: off; 1: on.
|
||||||
|
|
||||||
|
# IMU data
|
||||||
|
sendimu: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# SDK IMU smooth sending feature
|
||||||
|
# When enabled, SDK will send IMU data at precise intervals (default 400Hz)
|
||||||
|
# using a dedicated high-priority thread to reduce jitter and timing variance
|
||||||
|
enable_imu_smooth: 1 # 0: disable SDK IMU smooth sending; 1: enable (default)
|
||||||
|
|
||||||
|
# SDK IMU smooth sending frequency in Hz (only effective when enable_imu_smooth = 1)
|
||||||
|
imu_smooth_frequency: 400 # 1-1000 Hz, recommended 400 Hz
|
||||||
|
|
||||||
|
# Odometry data
|
||||||
|
sendodom: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# TF from odom to base_link. Leave it on unless you specifically need it off.
|
||||||
|
# ATTENTION: critical for rviz to show cloud_raw.
|
||||||
|
send_odom_baselink_tf: 0 # 0: off; 1: on.
|
||||||
|
|
||||||
|
# raw dtof data
|
||||||
|
senddtof: 1 # 0: off; 1: on
|
||||||
|
cloud_raw_confidence_threshold: 35 # please refer to readme for more details
|
||||||
|
|
||||||
|
# dtof sensor frame rate. Supported values: 100 (10fps) or 145 (14.5fps)
|
||||||
|
# Higher frame rate provides smoother point cloud data but may increase data bandwidth
|
||||||
|
# Note: value is multiplied by 10 (e.g., 145 means 14.5fps)
|
||||||
|
dtof_fps: 100 # 100: 10fps; 145: 14.5fps
|
||||||
|
|
||||||
|
# slam cloud data
|
||||||
|
sendcloudslam: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# processed with raw point cloud, rgb image, and calib.yaml from device
|
||||||
|
# Processed on host device
|
||||||
|
sendcloudrender: 1 # 0: off; 1: on
|
||||||
|
|
||||||
|
# depth completion demo, high computing resource usage.
|
||||||
|
# for more information please refer to the readme file.
|
||||||
|
# Processed on host device
|
||||||
|
senddepth: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# cloud reprojection demo, projects cloud_slam to camera image using odometry
|
||||||
|
# Processed on host device
|
||||||
|
sendreprojection: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# image overlay settings - overlays reprojected points on camera image
|
||||||
|
# Processed on host device
|
||||||
|
sendoverlay: 0 # 0: off; 1: on
|
||||||
|
overlay_reprojected_topic: "/odin1/reprojected_image" # reprojected image topic
|
||||||
|
overlay_camera_topic: "/odin1/image/undistorted" # camera image topic (undistorted)
|
||||||
|
overlay_output_topic: "/odin1/overlay_image" # output overlay image topic
|
||||||
|
overlay_alpha: 0.6 # blend alpha (0.0-1.0, higher = more reproj color)
|
||||||
|
|
||||||
|
# record rgb, odometry, and slam cloud data as proprietary olx format for further processing in MindCloud(TM) software.
|
||||||
|
# save path: ws/src/odin_ros_driver/recorddata/{record_start_time}/
|
||||||
|
# ATTENTION: please copy the full folder for post-processing.
|
||||||
|
recorddata: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# Save device runtime status info to ws/src/odin_ros_driver/log/Driver_{drvier_start_time}/Conn_{device_connection_time}/dev_status.csv
|
||||||
|
devstatuslog: 1 # 0: off; 1: on.
|
||||||
|
|
||||||
|
save_log: 0 # 0: off; 1: on;
|
||||||
|
|
||||||
|
# raw dtof sensor intensity data in gray format, mostly for debug purpose.
|
||||||
|
pubintensitygray: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
showpath: 0 # 0: off; 1: on
|
||||||
|
showcamerapose: 0 # 0: off; 1: on
|
||||||
|
|
||||||
|
# Screen LOC=RELOC profile. Odin loads relocalization_map_abs_path and publishes
|
||||||
|
# the map/odom TF after relocalization succeeds; pure-odom fallback is disabled.
|
||||||
|
custom_map_mode: 2 # 0: Odometry mode 1: SLAM mode 2: Relocalization mode.
|
||||||
|
custom_init_pos: [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]
|
||||||
|
custom_init_pose_search_radius: 4.0 # max position offset in meters, recommended <= 10
|
||||||
|
custom_init_pose_max_rot_deg: 180.0 # max rotation offset in degrees, up to 180
|
||||||
|
relocalization_map_abs_path: "/absolute/path/to/1hao.bin" # required for Relocalization mode; edit on the target computer
|
||||||
|
|
||||||
|
# To get the mapping result file, please use the set_param.sh script provided: "./set_param.sh save_map 1"
|
||||||
|
mapping_result_dest_dir: "" # "": if not specified, save to default location of {ws}/src/odin_ros_driver/map/{driver_start_time}/
|
||||||
|
mapping_result_file_name: "" # "": if not specified, save to location above with default file name of map_{map_save_time}.bin
|
||||||
|
|
||||||
|
# Image mask transfer settings
|
||||||
|
sendimagemask: 0 # 0: off; 1: on - transfer image mask to device on startup
|
||||||
|
image_mask_abs_path: "" # absolute path to the image mask file (e.g., /path/to/mask.png(1600x1296 resolution)
|
||||||
|
|
||||||
|
# Algorithm reset settings
|
||||||
|
resetalgo: 0 # 0: off; 1: on - send algo_reset command to device on startup
|
||||||
@@ -0,0 +1,438 @@
|
|||||||
|
Panels:
|
||||||
|
- Class: rviz/Displays
|
||||||
|
Help Height: 0
|
||||||
|
Name: Displays
|
||||||
|
Property Tree Widget:
|
||||||
|
Expanded:
|
||||||
|
- /Global Options1
|
||||||
|
- /Odometry1
|
||||||
|
- /slam1
|
||||||
|
- /TF1/Frames1
|
||||||
|
Splitter Ratio: 0.4993045926094055
|
||||||
|
Tree Height: 495
|
||||||
|
- Class: rviz/Selection
|
||||||
|
Name: Selection
|
||||||
|
- Class: rviz/Tool Properties
|
||||||
|
Expanded:
|
||||||
|
- /2D Pose Estimate1
|
||||||
|
- /2D Nav Goal1
|
||||||
|
- /Publish Point1
|
||||||
|
Name: Tool Properties
|
||||||
|
Splitter Ratio: 0.5886790156364441
|
||||||
|
- Class: rviz/Views
|
||||||
|
Expanded:
|
||||||
|
- /Current View1
|
||||||
|
Name: Views
|
||||||
|
Splitter Ratio: 0.5
|
||||||
|
- Class: rviz/Time
|
||||||
|
Name: Time
|
||||||
|
SyncMode: 0
|
||||||
|
SyncSource: Image
|
||||||
|
Preferences:
|
||||||
|
PromptSaveOnExit: true
|
||||||
|
Toolbars:
|
||||||
|
toolButtonStyle: 2
|
||||||
|
Visualization Manager:
|
||||||
|
Class: ""
|
||||||
|
Displays:
|
||||||
|
- Alpha: 0.5
|
||||||
|
Cell Size: 1
|
||||||
|
Class: rviz/Grid
|
||||||
|
Color: 160; 160; 164
|
||||||
|
Enabled: true
|
||||||
|
Line Style:
|
||||||
|
Line Width: 0.029999999329447746
|
||||||
|
Value: Lines
|
||||||
|
Name: Grid
|
||||||
|
Normal Cell Count: 0
|
||||||
|
Offset:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Z: 0
|
||||||
|
Plane: XY
|
||||||
|
Plane Cell Count: 10
|
||||||
|
Reference Frame: <Fixed Frame>
|
||||||
|
Value: true
|
||||||
|
- Class: rviz/Image
|
||||||
|
Enabled: true
|
||||||
|
Image Topic: /odin1/image
|
||||||
|
Max Value: 1
|
||||||
|
Median window: 5
|
||||||
|
Min Value: 0
|
||||||
|
Name: Image
|
||||||
|
Normalize Range: true
|
||||||
|
Queue Size: 2
|
||||||
|
Transport Hint: raw
|
||||||
|
Unreliable: false
|
||||||
|
Value: true
|
||||||
|
- Class: rviz/Image
|
||||||
|
Enabled: false
|
||||||
|
Image Topic: /odin1/image/undistorted
|
||||||
|
Max Value: 1
|
||||||
|
Median window: 5
|
||||||
|
Min Value: 0
|
||||||
|
Name: Image_undistort
|
||||||
|
Normalize Range: true
|
||||||
|
Queue Size: 2
|
||||||
|
Transport Hint: raw
|
||||||
|
Unreliable: false
|
||||||
|
Value: false
|
||||||
|
- Class: rviz/Image
|
||||||
|
Enabled: false
|
||||||
|
Image Topic: /odin1/reprojected_image
|
||||||
|
Max Value: 1
|
||||||
|
Median window: 5
|
||||||
|
Min Value: 0
|
||||||
|
Name: cloudslam_reprojected
|
||||||
|
Normalize Range: true
|
||||||
|
Queue Size: 2
|
||||||
|
Transport Hint: raw
|
||||||
|
Unreliable: false
|
||||||
|
Value: false
|
||||||
|
- Alpha: 1
|
||||||
|
Autocompute Intensity Bounds: true
|
||||||
|
Autocompute Value Bounds:
|
||||||
|
Max Value: 10
|
||||||
|
Min Value: -10
|
||||||
|
Value: true
|
||||||
|
Axis: Z
|
||||||
|
Channel Name: intensity
|
||||||
|
Class: rviz/PointCloud2
|
||||||
|
Color: 255; 255; 255
|
||||||
|
Color Transformer: Intensity
|
||||||
|
Decay Time: 0
|
||||||
|
Enabled: false
|
||||||
|
Invert Rainbow: false
|
||||||
|
Max Color: 255; 255; 255
|
||||||
|
Min Color: 0; 0; 0
|
||||||
|
Name: raw
|
||||||
|
Position Transformer: XYZ
|
||||||
|
Queue Size: 10
|
||||||
|
Selectable: true
|
||||||
|
Size (Pixels): 3
|
||||||
|
Size (m): 0.009999999776482582
|
||||||
|
Style: Points
|
||||||
|
Topic: /odin1/cloud_raw
|
||||||
|
Unreliable: false
|
||||||
|
Use Fixed Frame: true
|
||||||
|
Use rainbow: true
|
||||||
|
Value: false
|
||||||
|
- Alpha: 1
|
||||||
|
Autocompute Intensity Bounds: true
|
||||||
|
Autocompute Value Bounds:
|
||||||
|
Max Value: 1.8493094444274902
|
||||||
|
Min Value: -0.13891705870628357
|
||||||
|
Value: true
|
||||||
|
Axis: Z
|
||||||
|
Channel Name: intensity
|
||||||
|
Class: rviz/PointCloud2
|
||||||
|
Color: 255; 255; 255
|
||||||
|
Color Transformer: RGB8
|
||||||
|
Decay Time: 0
|
||||||
|
Enabled: false
|
||||||
|
Invert Rainbow: false
|
||||||
|
Max Color: 255; 255; 255
|
||||||
|
Min Color: 0; 0; 0
|
||||||
|
Name: render
|
||||||
|
Position Transformer: XYZ
|
||||||
|
Queue Size: 10
|
||||||
|
Selectable: true
|
||||||
|
Size (Pixels): 3
|
||||||
|
Size (m): 0.009999999776482582
|
||||||
|
Style: Points
|
||||||
|
Topic: /odin1/cloud_render
|
||||||
|
Unreliable: false
|
||||||
|
Use Fixed Frame: true
|
||||||
|
Use rainbow: true
|
||||||
|
Value: false
|
||||||
|
- Class: rviz/Group
|
||||||
|
Displays:
|
||||||
|
- Angle Tolerance: 0.10000000149011612
|
||||||
|
Class: rviz/Odometry
|
||||||
|
Covariance:
|
||||||
|
Orientation:
|
||||||
|
Alpha: 0.5
|
||||||
|
Color: 255; 255; 127
|
||||||
|
Color Style: Unique
|
||||||
|
Frame: Local
|
||||||
|
Offset: 1
|
||||||
|
Scale: 1
|
||||||
|
Value: true
|
||||||
|
Position:
|
||||||
|
Alpha: 0.30000001192092896
|
||||||
|
Color: 204; 51; 204
|
||||||
|
Scale: 1
|
||||||
|
Value: true
|
||||||
|
Value: false
|
||||||
|
Enabled: true
|
||||||
|
Keep: 1
|
||||||
|
Name: Odometry
|
||||||
|
Position Tolerance: 0.10000000149011612
|
||||||
|
Queue Size: 1
|
||||||
|
Shape:
|
||||||
|
Alpha: 1
|
||||||
|
Axes Length: 1
|
||||||
|
Axes Radius: 0.10000000149011612
|
||||||
|
Color: 255; 25; 0
|
||||||
|
Head Length: 0.30000001192092896
|
||||||
|
Head Radius: 0.10000000149011612
|
||||||
|
Shaft Length: 1
|
||||||
|
Shaft Radius: 0.05000000074505806
|
||||||
|
Value: Axes
|
||||||
|
Topic: /odin1/odometry
|
||||||
|
Unreliable: false
|
||||||
|
Value: true
|
||||||
|
- Angle Tolerance: 0.10000000149011612
|
||||||
|
Class: rviz/Odometry
|
||||||
|
Covariance:
|
||||||
|
Orientation:
|
||||||
|
Alpha: 0.5
|
||||||
|
Color: 255; 255; 127
|
||||||
|
Color Style: Unique
|
||||||
|
Frame: Local
|
||||||
|
Offset: 1
|
||||||
|
Scale: 1
|
||||||
|
Value: true
|
||||||
|
Position:
|
||||||
|
Alpha: 0.30000001192092896
|
||||||
|
Color: 204; 51; 204
|
||||||
|
Scale: 1
|
||||||
|
Value: true
|
||||||
|
Value: true
|
||||||
|
Enabled: false
|
||||||
|
Keep: 100
|
||||||
|
Name: Odometry_high
|
||||||
|
Position Tolerance: 0.10000000149011612
|
||||||
|
Queue Size: 10
|
||||||
|
Shape:
|
||||||
|
Alpha: 1
|
||||||
|
Axes Length: 1
|
||||||
|
Axes Radius: 0.10000000149011612
|
||||||
|
Color: 52; 101; 164
|
||||||
|
Head Length: 0.30000001192092896
|
||||||
|
Head Radius: 0.10000000149011612
|
||||||
|
Shaft Length: 1
|
||||||
|
Shaft Radius: 0.05000000074505806
|
||||||
|
Value: Arrow
|
||||||
|
Topic: /odin1/odometry_highfreq
|
||||||
|
Unreliable: false
|
||||||
|
Value: false
|
||||||
|
- Class: rviz/MarkerArray
|
||||||
|
Enabled: false
|
||||||
|
Marker Topic: /odin1/camera_pose_visual
|
||||||
|
Name: camera_view
|
||||||
|
Namespaces:
|
||||||
|
{}
|
||||||
|
Queue Size: 100
|
||||||
|
Value: false
|
||||||
|
Enabled: true
|
||||||
|
Name: Odometry
|
||||||
|
- Class: rviz/Group
|
||||||
|
Displays:
|
||||||
|
- Alpha: 1
|
||||||
|
Autocompute Intensity Bounds: true
|
||||||
|
Autocompute Value Bounds:
|
||||||
|
Max Value: 10
|
||||||
|
Min Value: -10
|
||||||
|
Value: true
|
||||||
|
Axis: Z
|
||||||
|
Channel Name: rgb
|
||||||
|
Class: rviz/PointCloud2
|
||||||
|
Color: 255; 255; 255
|
||||||
|
Color Transformer: RGB8
|
||||||
|
Decay Time: 0
|
||||||
|
Enabled: true
|
||||||
|
Invert Rainbow: false
|
||||||
|
Max Color: 255; 255; 255
|
||||||
|
Min Color: 0; 0; 0
|
||||||
|
Name: slam_current
|
||||||
|
Position Transformer: XYZ
|
||||||
|
Queue Size: 10
|
||||||
|
Selectable: true
|
||||||
|
Size (Pixels): 3
|
||||||
|
Size (m): 0.009999999776482582
|
||||||
|
Style: Points
|
||||||
|
Topic: /odin1/cloud_slam
|
||||||
|
Unreliable: false
|
||||||
|
Use Fixed Frame: true
|
||||||
|
Use rainbow: true
|
||||||
|
Value: true
|
||||||
|
- Alpha: 0.10000000149011612
|
||||||
|
Autocompute Intensity Bounds: true
|
||||||
|
Autocompute Value Bounds:
|
||||||
|
Max Value: 10
|
||||||
|
Min Value: -10
|
||||||
|
Value: true
|
||||||
|
Axis: Z
|
||||||
|
Channel Name: intensity
|
||||||
|
Class: rviz/PointCloud2
|
||||||
|
Color: 255; 255; 255
|
||||||
|
Color Transformer: RGB8
|
||||||
|
Decay Time: 5
|
||||||
|
Enabled: false
|
||||||
|
Invert Rainbow: false
|
||||||
|
Max Color: 255; 255; 255
|
||||||
|
Min Color: 0; 0; 0
|
||||||
|
Name: slam_decay
|
||||||
|
Position Transformer: XYZ
|
||||||
|
Queue Size: 10
|
||||||
|
Selectable: true
|
||||||
|
Size (Pixels): 1
|
||||||
|
Size (m): 0.009999999776482582
|
||||||
|
Style: Points
|
||||||
|
Topic: /odin1/cloud_slam
|
||||||
|
Unreliable: false
|
||||||
|
Use Fixed Frame: true
|
||||||
|
Use rainbow: true
|
||||||
|
Value: false
|
||||||
|
- Class: rviz/MarkerArray
|
||||||
|
Enabled: false
|
||||||
|
Marker Topic: /odin1/path
|
||||||
|
Name: path
|
||||||
|
Namespaces:
|
||||||
|
{}
|
||||||
|
Queue Size: 100
|
||||||
|
Value: false
|
||||||
|
Enabled: true
|
||||||
|
Name: slam
|
||||||
|
- Class: rviz/Group
|
||||||
|
Displays:
|
||||||
|
- Class: rviz/Image
|
||||||
|
Enabled: true
|
||||||
|
Image Topic: /odin1/depth_img_competetion
|
||||||
|
Max Value: 1
|
||||||
|
Median window: 5
|
||||||
|
Min Value: 0
|
||||||
|
Name: dense_depth_image
|
||||||
|
Normalize Range: true
|
||||||
|
Queue Size: 2
|
||||||
|
Transport Hint: raw
|
||||||
|
Unreliable: false
|
||||||
|
Value: true
|
||||||
|
- Alpha: 1
|
||||||
|
Autocompute Intensity Bounds: true
|
||||||
|
Autocompute Value Bounds:
|
||||||
|
Max Value: 10
|
||||||
|
Min Value: -10
|
||||||
|
Value: true
|
||||||
|
Axis: Z
|
||||||
|
Channel Name: intensity
|
||||||
|
Class: rviz/PointCloud2
|
||||||
|
Color: 255; 255; 255
|
||||||
|
Color Transformer: RGB8
|
||||||
|
Decay Time: 0
|
||||||
|
Enabled: false
|
||||||
|
Invert Rainbow: false
|
||||||
|
Max Color: 255; 255; 255
|
||||||
|
Min Color: 0; 0; 0
|
||||||
|
Name: dense_depth_cloud
|
||||||
|
Position Transformer: XYZ
|
||||||
|
Queue Size: 10
|
||||||
|
Selectable: true
|
||||||
|
Size (Pixels): 3
|
||||||
|
Size (m): 0.009999999776482582
|
||||||
|
Style: Points
|
||||||
|
Topic: /odin1/depth_img_competetion_cloud
|
||||||
|
Unreliable: false
|
||||||
|
Use Fixed Frame: true
|
||||||
|
Use rainbow: true
|
||||||
|
Value: false
|
||||||
|
Enabled: false
|
||||||
|
Name: dense_depth_demo
|
||||||
|
- Class: rviz/TF
|
||||||
|
Enabled: true
|
||||||
|
Filter (blacklist): ""
|
||||||
|
Filter (whitelist): ""
|
||||||
|
Frame Timeout: 15
|
||||||
|
Frames:
|
||||||
|
All Enabled: true
|
||||||
|
odin1_base_link:
|
||||||
|
Value: true
|
||||||
|
odom:
|
||||||
|
Value: true
|
||||||
|
Marker Alpha: 1
|
||||||
|
Marker Scale: 1
|
||||||
|
Name: TF
|
||||||
|
Show Arrows: true
|
||||||
|
Show Axes: true
|
||||||
|
Show Names: true
|
||||||
|
Tree:
|
||||||
|
odom:
|
||||||
|
odin1_base_link:
|
||||||
|
{}
|
||||||
|
Update Interval: 0
|
||||||
|
Value: true
|
||||||
|
Enabled: true
|
||||||
|
Global Options:
|
||||||
|
Background Color: 48; 48; 48
|
||||||
|
Default Light: true
|
||||||
|
Fixed Frame: odom
|
||||||
|
Frame Rate: 30
|
||||||
|
Name: root
|
||||||
|
Tools:
|
||||||
|
- Class: rviz/Interact
|
||||||
|
Hide Inactive Objects: true
|
||||||
|
- Class: rviz/MoveCamera
|
||||||
|
- Class: rviz/Select
|
||||||
|
- Class: rviz/FocusCamera
|
||||||
|
- Class: rviz/Measure
|
||||||
|
- Class: rviz/SetInitialPose
|
||||||
|
Theta std deviation: 0.2617993950843811
|
||||||
|
Topic: /initialpose
|
||||||
|
X std deviation: 0.5
|
||||||
|
Y std deviation: 0.5
|
||||||
|
- Class: rviz/SetGoal
|
||||||
|
Topic: /move_base_simple/goal
|
||||||
|
- Class: rviz/PublishPoint
|
||||||
|
Single click: true
|
||||||
|
Topic: /clicked_point
|
||||||
|
Value: true
|
||||||
|
Views:
|
||||||
|
Current:
|
||||||
|
Class: rviz/Orbit
|
||||||
|
Distance: 16.25591278076172
|
||||||
|
Enable Stereo Rendering:
|
||||||
|
Stereo Eye Separation: 0.05999999865889549
|
||||||
|
Stereo Focal Distance: 1
|
||||||
|
Swap Stereo Eyes: false
|
||||||
|
Value: false
|
||||||
|
Field of View: 0.7853981852531433
|
||||||
|
Focal Point:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Z: 0
|
||||||
|
Focal Shape Fixed Size: false
|
||||||
|
Focal Shape Size: 0.05000000074505806
|
||||||
|
Invert Z Axis: false
|
||||||
|
Name: Current View
|
||||||
|
Near Clip Distance: 0.009999999776482582
|
||||||
|
Pitch: 1.010398030281067
|
||||||
|
Target Frame: odom
|
||||||
|
Yaw: 0.8753980994224548
|
||||||
|
Saved: ~
|
||||||
|
Window Geometry:
|
||||||
|
Displays:
|
||||||
|
collapsed: false
|
||||||
|
Height: 1016
|
||||||
|
Hide Left Dock: false
|
||||||
|
Hide Right Dock: false
|
||||||
|
Image:
|
||||||
|
collapsed: false
|
||||||
|
Image_undistort:
|
||||||
|
collapsed: false
|
||||||
|
QMainWindow State: 000000ff00000000fd0000000400000000000001e70000033afc020000000cfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000b0fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000022c000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d006100670065010000026f000001080000001600fffffffb0000002200640065006e00730065005f00640065007000740068005f0069006d006100670065000000047d000001730000001600fffffffb0000001e0049006d006100670065005f0075006e0064006900730074006f007200740000000568000000df0000001600fffffffb0000002a0063006c006f007500640073006c0061006d005f0072006500700072006f006a0065006300740065006400000002b2000000c50000001600ffffff000000010000015f0000033afc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d0000033a000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000007380000005efc0100000002fb0000000800540069006d0065010000000000000738000003bc00fffffffb0000000800540069006d00650100000000000004500000000000000000000003e60000033a00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||||
|
Selection:
|
||||||
|
collapsed: false
|
||||||
|
Time:
|
||||||
|
collapsed: false
|
||||||
|
Tool Properties:
|
||||||
|
collapsed: false
|
||||||
|
Views:
|
||||||
|
collapsed: false
|
||||||
|
Width: 1848
|
||||||
|
X: 72
|
||||||
|
Y: 27
|
||||||
|
cloudslam_reprojected:
|
||||||
|
collapsed: false
|
||||||
|
dense_depth_image:
|
||||||
|
collapsed: false
|
||||||
@@ -0,0 +1,499 @@
|
|||||||
|
Panels:
|
||||||
|
- Class: rviz_common/Displays
|
||||||
|
Help Height: 0
|
||||||
|
Name: Displays
|
||||||
|
Property Tree Widget:
|
||||||
|
Expanded:
|
||||||
|
- /Global Options1
|
||||||
|
- /Status1
|
||||||
|
- /Image1/Topic1
|
||||||
|
- /cloudslam_reprojected1
|
||||||
|
- /Odometry1
|
||||||
|
- /slam1
|
||||||
|
- /dense_depth_demo1
|
||||||
|
Splitter Ratio: 0.5
|
||||||
|
Tree Height: 593
|
||||||
|
- Class: rviz_common/Selection
|
||||||
|
Name: Selection
|
||||||
|
- Class: rviz_common/Tool Properties
|
||||||
|
Expanded:
|
||||||
|
- /2D Goal Pose1
|
||||||
|
- /Publish Point1
|
||||||
|
Name: Tool Properties
|
||||||
|
Splitter Ratio: 0.5886790156364441
|
||||||
|
- Class: rviz_common/Views
|
||||||
|
Expanded:
|
||||||
|
- /Current View1
|
||||||
|
Name: Views
|
||||||
|
Splitter Ratio: 0.5
|
||||||
|
Visualization Manager:
|
||||||
|
Class: ""
|
||||||
|
Displays:
|
||||||
|
- Alpha: 0.5
|
||||||
|
Cell Size: 1
|
||||||
|
Class: rviz_default_plugins/Grid
|
||||||
|
Color: 160; 160; 164
|
||||||
|
Enabled: true
|
||||||
|
Line Style:
|
||||||
|
Line Width: 0.029999999329447746
|
||||||
|
Value: Lines
|
||||||
|
Name: Grid
|
||||||
|
Normal Cell Count: 0
|
||||||
|
Offset:
|
||||||
|
X: 0
|
||||||
|
Y: 0
|
||||||
|
Z: 0
|
||||||
|
Plane: XY
|
||||||
|
Plane Cell Count: 10
|
||||||
|
Reference Frame: <Fixed Frame>
|
||||||
|
Value: true
|
||||||
|
- Class: rviz_default_plugins/Image
|
||||||
|
Enabled: true
|
||||||
|
Max Value: 1
|
||||||
|
Median window: 5
|
||||||
|
Min Value: 0
|
||||||
|
Name: Image
|
||||||
|
Normalize Range: true
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/image
|
||||||
|
Value: true
|
||||||
|
- Class: rviz_default_plugins/Image
|
||||||
|
Enabled: false
|
||||||
|
Max Value: 1
|
||||||
|
Median window: 5
|
||||||
|
Min Value: 0
|
||||||
|
Name: Image_undistort
|
||||||
|
Normalize Range: true
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/image/undistorted
|
||||||
|
Value: false
|
||||||
|
- Class: rviz_default_plugins/Image
|
||||||
|
Enabled: false
|
||||||
|
Max Value: 1
|
||||||
|
Median window: 5
|
||||||
|
Min Value: 0
|
||||||
|
Name: cloudslam_reprojected
|
||||||
|
Normalize Range: true
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/reprojected_image
|
||||||
|
Value: false
|
||||||
|
- Alpha: 1
|
||||||
|
Autocompute Intensity Bounds: true
|
||||||
|
Autocompute Value Bounds:
|
||||||
|
Max Value: 10
|
||||||
|
Min Value: -10
|
||||||
|
Value: true
|
||||||
|
Axis: Z
|
||||||
|
Channel Name: intensity
|
||||||
|
Class: rviz_default_plugins/PointCloud2
|
||||||
|
Color: 255; 255; 255
|
||||||
|
Color Transformer: Intensity
|
||||||
|
Decay Time: 0
|
||||||
|
Enabled: false
|
||||||
|
Invert Rainbow: false
|
||||||
|
Max Color: 255; 255; 255
|
||||||
|
Max Intensity: 239
|
||||||
|
Min Color: 0; 0; 0
|
||||||
|
Min Intensity: 0
|
||||||
|
Name: raw
|
||||||
|
Position Transformer: XYZ
|
||||||
|
Selectable: true
|
||||||
|
Size (Pixels): 3
|
||||||
|
Size (m): 0.009999999776482582
|
||||||
|
Style: Points
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
Filter size: 10
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/cloud_raw
|
||||||
|
Use Fixed Frame: true
|
||||||
|
Use rainbow: true
|
||||||
|
Value: false
|
||||||
|
- Alpha: 1
|
||||||
|
Autocompute Intensity Bounds: true
|
||||||
|
Autocompute Value Bounds:
|
||||||
|
Max Value: 1.8730175495147705
|
||||||
|
Min Value: -0.12252448499202728
|
||||||
|
Value: true
|
||||||
|
Axis: Z
|
||||||
|
Channel Name: rgb
|
||||||
|
Class: rviz_default_plugins/PointCloud2
|
||||||
|
Color: 255; 255; 255
|
||||||
|
Color Transformer: RGB8
|
||||||
|
Decay Time: 0
|
||||||
|
Enabled: false
|
||||||
|
Invert Rainbow: false
|
||||||
|
Max Color: 255; 255; 255
|
||||||
|
Max Intensity: 2.3509885615147286e-38
|
||||||
|
Min Color: 0; 0; 0
|
||||||
|
Min Intensity: 0
|
||||||
|
Name: render
|
||||||
|
Position Transformer: XYZ
|
||||||
|
Selectable: true
|
||||||
|
Size (Pixels): 3
|
||||||
|
Size (m): 0.009999999776482582
|
||||||
|
Style: Points
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
Filter size: 10
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/cloud_render
|
||||||
|
Use Fixed Frame: true
|
||||||
|
Use rainbow: true
|
||||||
|
Value: false
|
||||||
|
- Class: rviz_common/Group
|
||||||
|
Displays:
|
||||||
|
- Angle Tolerance: 0.10000000149011612
|
||||||
|
Class: rviz_default_plugins/Odometry
|
||||||
|
Covariance:
|
||||||
|
Orientation:
|
||||||
|
Alpha: 0.5
|
||||||
|
Color: 255; 255; 127
|
||||||
|
Color Style: Unique
|
||||||
|
Frame: Local
|
||||||
|
Offset: 1
|
||||||
|
Scale: 1
|
||||||
|
Value: true
|
||||||
|
Position:
|
||||||
|
Alpha: 0.30000001192092896
|
||||||
|
Color: 204; 51; 204
|
||||||
|
Scale: 1
|
||||||
|
Value: true
|
||||||
|
Value: true
|
||||||
|
Enabled: true
|
||||||
|
Keep: 1
|
||||||
|
Name: Odometry
|
||||||
|
Position Tolerance: 0.10000000149011612
|
||||||
|
Shape:
|
||||||
|
Alpha: 1
|
||||||
|
Axes Length: 1
|
||||||
|
Axes Radius: 0.10000000149011612
|
||||||
|
Color: 255; 25; 0
|
||||||
|
Head Length: 0.30000001192092896
|
||||||
|
Head Radius: 0.10000000149011612
|
||||||
|
Shaft Length: 1
|
||||||
|
Shaft Radius: 0.05000000074505806
|
||||||
|
Value: Axes
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
Filter size: 10
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/odometry
|
||||||
|
Value: true
|
||||||
|
- Angle Tolerance: 0.10000000149011612
|
||||||
|
Class: rviz_default_plugins/Odometry
|
||||||
|
Covariance:
|
||||||
|
Orientation:
|
||||||
|
Alpha: 0.5
|
||||||
|
Color: 255; 255; 127
|
||||||
|
Color Style: Unique
|
||||||
|
Frame: Local
|
||||||
|
Offset: 1
|
||||||
|
Scale: 1
|
||||||
|
Value: true
|
||||||
|
Position:
|
||||||
|
Alpha: 0.30000001192092896
|
||||||
|
Color: 204; 51; 204
|
||||||
|
Scale: 1
|
||||||
|
Value: true
|
||||||
|
Value: true
|
||||||
|
Enabled: false
|
||||||
|
Keep: 10
|
||||||
|
Name: Odometry_high
|
||||||
|
Position Tolerance: 0.10000000149011612
|
||||||
|
Shape:
|
||||||
|
Alpha: 1
|
||||||
|
Axes Length: 1
|
||||||
|
Axes Radius: 0.10000000149011612
|
||||||
|
Color: 98; 160; 234
|
||||||
|
Head Length: 0.30000001192092896
|
||||||
|
Head Radius: 0.10000000149011612
|
||||||
|
Shaft Length: 1
|
||||||
|
Shaft Radius: 0.05000000074505806
|
||||||
|
Value: Arrow
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
Filter size: 10
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/odometry_highfreq
|
||||||
|
Value: false
|
||||||
|
- Class: rviz_default_plugins/MarkerArray
|
||||||
|
Enabled: false
|
||||||
|
Name: camera_view
|
||||||
|
Namespaces:
|
||||||
|
{}
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/camera_pose_visual
|
||||||
|
Value: false
|
||||||
|
Enabled: true
|
||||||
|
Name: Odometry
|
||||||
|
- Class: rviz_common/Group
|
||||||
|
Displays:
|
||||||
|
- Alpha: 1
|
||||||
|
Autocompute Intensity Bounds: true
|
||||||
|
Autocompute Value Bounds:
|
||||||
|
Max Value: 10
|
||||||
|
Min Value: -10
|
||||||
|
Value: true
|
||||||
|
Axis: Z
|
||||||
|
Channel Name: intensity
|
||||||
|
Class: rviz_default_plugins/PointCloud2
|
||||||
|
Color: 255; 255; 255
|
||||||
|
Color Transformer: RGB8
|
||||||
|
Decay Time: 0
|
||||||
|
Enabled: true
|
||||||
|
Invert Rainbow: false
|
||||||
|
Max Color: 255; 255; 255
|
||||||
|
Max Intensity: 4096
|
||||||
|
Min Color: 0; 0; 0
|
||||||
|
Min Intensity: 0
|
||||||
|
Name: slam_current
|
||||||
|
Position Transformer: XYZ
|
||||||
|
Selectable: true
|
||||||
|
Size (Pixels): 3
|
||||||
|
Size (m): 0.009999999776482582
|
||||||
|
Style: Points
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
Filter size: 10
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/cloud_slam
|
||||||
|
Use Fixed Frame: true
|
||||||
|
Use rainbow: true
|
||||||
|
Value: true
|
||||||
|
- Alpha: 0.10000000149011612
|
||||||
|
Autocompute Intensity Bounds: true
|
||||||
|
Autocompute Value Bounds:
|
||||||
|
Max Value: 10
|
||||||
|
Min Value: -10
|
||||||
|
Value: true
|
||||||
|
Axis: Z
|
||||||
|
Channel Name: intensity
|
||||||
|
Class: rviz_default_plugins/PointCloud2
|
||||||
|
Color: 255; 255; 255
|
||||||
|
Color Transformer: RGB8
|
||||||
|
Decay Time: 10
|
||||||
|
Enabled: false
|
||||||
|
Invert Rainbow: false
|
||||||
|
Max Color: 255; 255; 255
|
||||||
|
Max Intensity: 4096
|
||||||
|
Min Color: 0; 0; 0
|
||||||
|
Min Intensity: 0
|
||||||
|
Name: slam_deacy
|
||||||
|
Position Transformer: XYZ
|
||||||
|
Selectable: true
|
||||||
|
Size (Pixels): 1
|
||||||
|
Size (m): 0.009999999776482582
|
||||||
|
Style: Points
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
Filter size: 10
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/cloud_slam
|
||||||
|
Use Fixed Frame: true
|
||||||
|
Use rainbow: true
|
||||||
|
Value: false
|
||||||
|
- Class: rviz_default_plugins/MarkerArray
|
||||||
|
Enabled: false
|
||||||
|
Name: path
|
||||||
|
Namespaces:
|
||||||
|
{}
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/path
|
||||||
|
Value: false
|
||||||
|
Enabled: true
|
||||||
|
Name: slam
|
||||||
|
- Class: rviz_common/Group
|
||||||
|
Displays:
|
||||||
|
- Class: rviz_default_plugins/Image
|
||||||
|
Enabled: true
|
||||||
|
Max Value: 1
|
||||||
|
Median window: 5
|
||||||
|
Min Value: 0
|
||||||
|
Name: dense_depth_image
|
||||||
|
Normalize Range: true
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/depth_img_competetion
|
||||||
|
Value: true
|
||||||
|
- Alpha: 1
|
||||||
|
Autocompute Intensity Bounds: true
|
||||||
|
Autocompute Value Bounds:
|
||||||
|
Max Value: 10
|
||||||
|
Min Value: -10
|
||||||
|
Value: true
|
||||||
|
Axis: Z
|
||||||
|
Channel Name: intensity
|
||||||
|
Class: rviz_default_plugins/PointCloud2
|
||||||
|
Color: 255; 255; 255
|
||||||
|
Color Transformer: RGB8
|
||||||
|
Decay Time: 0
|
||||||
|
Enabled: false
|
||||||
|
Invert Rainbow: false
|
||||||
|
Max Color: 255; 255; 255
|
||||||
|
Max Intensity: 4096
|
||||||
|
Min Color: 0; 0; 0
|
||||||
|
Min Intensity: 0
|
||||||
|
Name: dense_depth_cloud
|
||||||
|
Position Transformer: XYZ
|
||||||
|
Selectable: true
|
||||||
|
Size (Pixels): 3
|
||||||
|
Size (m): 0.009999999776482582
|
||||||
|
Style: Flat Squares
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
Filter size: 10
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /odin1/depth_img_competetion_cloud
|
||||||
|
Use Fixed Frame: true
|
||||||
|
Use rainbow: true
|
||||||
|
Value: false
|
||||||
|
Enabled: false
|
||||||
|
Name: dense_depth_demo
|
||||||
|
- Class: rviz_default_plugins/TF
|
||||||
|
Enabled: true
|
||||||
|
Frame Timeout: 15
|
||||||
|
Frames:
|
||||||
|
All Enabled: true
|
||||||
|
odin1_base_link:
|
||||||
|
Value: true
|
||||||
|
odom:
|
||||||
|
Value: true
|
||||||
|
Marker Scale: 1
|
||||||
|
Name: TF
|
||||||
|
Show Arrows: true
|
||||||
|
Show Axes: true
|
||||||
|
Show Names: false
|
||||||
|
Tree:
|
||||||
|
odom:
|
||||||
|
odin1_base_link:
|
||||||
|
{}
|
||||||
|
Update Interval: 0
|
||||||
|
Value: true
|
||||||
|
Enabled: true
|
||||||
|
Global Options:
|
||||||
|
Background Color: 48; 48; 48
|
||||||
|
Fixed Frame: odom
|
||||||
|
Frame Rate: 30
|
||||||
|
Name: root
|
||||||
|
Tools:
|
||||||
|
- Class: rviz_default_plugins/Interact
|
||||||
|
Hide Inactive Objects: true
|
||||||
|
- Class: rviz_default_plugins/MoveCamera
|
||||||
|
- Class: rviz_default_plugins/Select
|
||||||
|
- Class: rviz_default_plugins/FocusCamera
|
||||||
|
- Class: rviz_default_plugins/Measure
|
||||||
|
Line color: 128; 128; 0
|
||||||
|
- Class: rviz_default_plugins/SetInitialPose
|
||||||
|
Covariance x: 0.25
|
||||||
|
Covariance y: 0.25
|
||||||
|
Covariance yaw: 0.06853891909122467
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /initialpose
|
||||||
|
- Class: rviz_default_plugins/SetGoal
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /goal_pose
|
||||||
|
- Class: rviz_default_plugins/PublishPoint
|
||||||
|
Single click: true
|
||||||
|
Topic:
|
||||||
|
Depth: 5
|
||||||
|
Durability Policy: Volatile
|
||||||
|
History Policy: Keep Last
|
||||||
|
Reliability Policy: Reliable
|
||||||
|
Value: /clicked_point
|
||||||
|
Transformation:
|
||||||
|
Current:
|
||||||
|
Class: rviz_default_plugins/TF
|
||||||
|
Value: true
|
||||||
|
Views:
|
||||||
|
Current:
|
||||||
|
Class: rviz_default_plugins/Orbit
|
||||||
|
Distance: 10.9336576461792
|
||||||
|
Enable Stereo Rendering:
|
||||||
|
Stereo Eye Separation: 0.05999999865889549
|
||||||
|
Stereo Focal Distance: 1
|
||||||
|
Swap Stereo Eyes: false
|
||||||
|
Value: false
|
||||||
|
Focal Point:
|
||||||
|
X: 0.2568470537662506
|
||||||
|
Y: 2.1451337337493896
|
||||||
|
Z: 0.3774382472038269
|
||||||
|
Focal Shape Fixed Size: false
|
||||||
|
Focal Shape Size: 0.05000000074505806
|
||||||
|
Invert Z Axis: false
|
||||||
|
Name: Current View
|
||||||
|
Near Clip Distance: 0.009999999776482582
|
||||||
|
Pitch: 0.3953983187675476
|
||||||
|
Target Frame: odom
|
||||||
|
Value: Orbit (rviz)
|
||||||
|
Yaw: 3.230407953262329
|
||||||
|
Saved: ~
|
||||||
|
Window Geometry:
|
||||||
|
Displays:
|
||||||
|
collapsed: false
|
||||||
|
Height: 1016
|
||||||
|
Hide Left Dock: false
|
||||||
|
Hide Right Dock: false
|
||||||
|
Image:
|
||||||
|
collapsed: false
|
||||||
|
Image_undistort:
|
||||||
|
collapsed: false
|
||||||
|
QMainWindow State: 000000ff00000000fd0000000400000000000001d40000039efc020000000cfb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003d0000028e000000c900fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261fb0000000a0049006d00610067006501000002d10000010a0000002800fffffffb0000002200640065006e00730065005f00640065007000740068005f0069006d006100670065000000023e0000007a0000002800fffffffb0000001e0049006d006100670065005f0075006e0064006900730074006f00720074000000028f0000014c0000002800fffffffb0000002a0063006c006f007500640073006c0061006d005f0072006500700072006f006a006500630074006500640000000310000000cb0000002800ffffff000000010000010f0000039efc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003d0000039e000000a400fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004420000003efc0100000002fb0000000800540069006d00650100000000000004420000000000000000fb0000000800540069006d00650100000000000004500000000000000000000004910000039e00000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000
|
||||||
|
Selection:
|
||||||
|
collapsed: false
|
||||||
|
Tool Properties:
|
||||||
|
collapsed: false
|
||||||
|
Views:
|
||||||
|
collapsed: false
|
||||||
|
Width: 1920
|
||||||
|
X: 540
|
||||||
|
Y: 124
|
||||||
|
cloudslam_reprojected:
|
||||||
|
collapsed: false
|
||||||
|
dense_depth_image:
|
||||||
|
collapsed: false
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user