2025-08-22 16:57:29 +08:00
|
|
|
|
# CMVR-ES
|
|
|
|
|
|
|
2026-07-09 14:22:35 +08:00
|
|
|
|
## 简介
|
2025-08-22 16:57:29 +08:00
|
|
|
|
|
2026-07-09 14:22:35 +08:00
|
|
|
|
CMVR-ES 工程。
|
2025-08-22 16:57:29 +08:00
|
|
|
|
|
feat(arm): add collision-aware planning and refactor motion control
Integrate OMPL RRTConnect and quintic B-spline smoothing into moveP, reuse
the B-spline trajectory generator for moveJ, and remove the TOPPRA paths
and dependencies. Separate joint and Cartesian planners, smoothers, and
the standalone curve math library.
Move speedL execution into SpeedLExecutor, tighten velocity QP feasibility,
and add adaptive speed reduction, braking recovery, feedback-derived TCP
velocity, and grouped cyclic velocity submission. Improve MuJoCo control
cycle synchronization and camera streaming.
Centralize kinematics and collision geometry in RobotModel, expose box
obstacles through CollisionChecker, and extract SelfCollisionMonitor for
protective stops and recovery. Add cancellable moveP pre-approach and
configurable failure recovery to the touch workflow, with updated configs,
documentation, and regression coverage.
Validation: recorded -j8 build and 133 passing tests on 2026-10-08, including
headless MuJoCo checks for eight target poses and seven moveJ returns.
Static scene configuration removal passed 27 follow-up tests and six arm
configuration parses. Staged diff and shell syntax checks pass; no new
hardware tests were run for this commit.
2026-10-13 09:18:06 +08:00
|
|
|
|
机械臂已提供独立的 OMPL RRTConnect 关节路径规划模块,构建与使用方式见
|
|
|
|
|
|
[RRTConnect 接入说明](docs/ompl_rrt_connect.md)。`MotorRobotArm::moveP` 已接入路径规划、
|
|
|
|
|
|
五次 B 样条平滑、运动限值校验与碰撞复检,并按控制周期下发电机指令。
|
|
|
|
|
|
|
|
|
|
|
|
运行时自碰撞监测位于 `cmvr-es/safety/self_collision`:`SelfCollisionMonitor`
|
|
|
|
|
|
通过 `RobotArm` 接口读取反馈、触发保护停止并协调恢复,碰撞计算仍由
|
|
|
|
|
|
`algorithms/collision_detection` 中的 `CollisionChecker` 完成。
|
|
|
|
|
|
`SelfCollisionTask` 仅绑定机械臂和转发周期调度;Monitor 不创建线程,恢复调用期间
|
|
|
|
|
|
须继续周期检测。现有 `self_collision_task` 配置格式保持不变。
|
|
|
|
|
|
|
2026-07-09 14:22:35 +08:00
|
|
|
|
## 安装
|
|
|
|
|
|
|
|
|
|
|
|
### 1. 拉取 Git 子模块
|
2025-08-22 16:57:29 +08:00
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
|
git submodule update --init --recursive
|
|
|
|
|
|
```
|
|
|
|
|
|
|
2026-07-09 14:22:35 +08:00
|
|
|
|
### 2. 安装系统依赖
|
2025-08-22 16:57:29 +08:00
|
|
|
|
|
|
|
|
|
|
```shell
|
2026-07-09 14:22:35 +08:00
|
|
|
|
# 基础工具
|
2026-02-05 17:31:18 +08:00
|
|
|
|
sudo apt-get update
|
2026-03-05 16:15:13 +08:00
|
|
|
|
sudo apt install -y build-essential cmake git pkg-config patchelf libboost-all-dev libssl-dev
|
|
|
|
|
|
|
2026-07-09 14:22:35 +08:00
|
|
|
|
# OpenCV
|
2026-02-05 17:31:18 +08:00
|
|
|
|
sudo apt install -y \
|
|
|
|
|
|
libjpeg-dev libpng-dev libtiff-dev \
|
|
|
|
|
|
libavcodec-dev libavformat-dev libswscale-dev \
|
|
|
|
|
|
libv4l-dev libxvidcore-dev libx264-dev \
|
2026-03-05 16:15:13 +08:00
|
|
|
|
libgtk-3-dev
|
2025-08-22 16:57:29 +08:00
|
|
|
|
|
2026-02-05 17:31:18 +08:00
|
|
|
|
# PulseAudio
|
|
|
|
|
|
sudo apt-get install libpulse-dev
|
2025-08-22 16:57:29 +08:00
|
|
|
|
|
2026-02-05 17:31:18 +08:00
|
|
|
|
# OpenGL
|
|
|
|
|
|
sudo apt-get install libgl1-mesa-dev
|
2025-08-22 16:57:29 +08:00
|
|
|
|
|
2026-02-05 17:31:18 +08:00
|
|
|
|
# GLFW
|
|
|
|
|
|
sudo apt-get install libglfw3-dev
|
2025-08-22 16:57:29 +08:00
|
|
|
|
|
2026-02-05 17:31:18 +08:00
|
|
|
|
# Assimp
|
|
|
|
|
|
sudo apt-get install libassimp-dev
|
2025-08-22 16:57:29 +08:00
|
|
|
|
|
2026-02-11 15:23:11 +08:00
|
|
|
|
# visp
|
2026-03-05 16:15:13 +08:00
|
|
|
|
sudo apt-get install -y libx11-dev liblapack-dev libzbar-dev libpthread-stubs0-dev libdc1394-dev nlohmann-json3-dev
|
2026-02-05 17:31:18 +08:00
|
|
|
|
|
2026-07-09 14:22:35 +08:00
|
|
|
|
# RealSense
|
2026-03-05 16:15:13 +08:00
|
|
|
|
sudo apt-get install -y \
|
|
|
|
|
|
libusb-1.0-0-dev libudev-dev \
|
|
|
|
|
|
libglu1-mesa-dev
|
2026-03-11 16:23:23 +08:00
|
|
|
|
|
|
|
|
|
|
# Matplot++
|
|
|
|
|
|
sudo apt install gnuplot-qt
|
2026-03-05 16:15:13 +08:00
|
|
|
|
```
|
2026-03-11 16:23:23 +08:00
|
|
|
|
|
2026-07-09 14:22:35 +08:00
|
|
|
|
### 3. 配置 IgH EtherCAT
|
|
|
|
|
|
|
|
|
|
|
|
工程已内置 IgH EtherCAT 1.7.0 的 userspace 文件:
|
|
|
|
|
|
|
|
|
|
|
|
```text
|
|
|
|
|
|
dependency/x86/third_party/ethercat/v1.7.0
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
先设置本机路径:
|
|
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
|
export CMVR_ES_ROOT=/path/to/cmvr-es
|
|
|
|
|
|
export IGH_ETHERCAT_ROOT=$CMVR_ES_ROOT/dependency/x86/third_party/ethercat/v1.7.0
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
安装当前内核的 header:
|
|
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
|
sudo apt-get update
|
|
|
|
|
|
sudo apt-get install -y linux-headers-$(uname -r)
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
如果内置目录里已经有当前内核版本的 EtherCAT 内核模块,直接安装到系统:
|
|
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
|
sudo mkdir -p /lib/modules/$(uname -r)/ethercat
|
|
|
|
|
|
sudo cp -r $IGH_ETHERCAT_ROOT/lib/modules/$(uname -r)/ethercat/* /lib/modules/$(uname -r)/ethercat/
|
|
|
|
|
|
sudo depmod
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
内置内核模块只适用于相同内核版本。如果 `$IGH_ETHERCAT_ROOT/lib/modules/$(uname -r)` 不存在,说明这台机器的内核版本不匹配,需要在这台机器上重新编译安装 IgH EtherCAT:
|
|
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
|
sudo apt-get update
|
|
|
|
|
|
sudo apt-get install -y \
|
|
|
|
|
|
build-essential autoconf automake libtool pkg-config git \
|
|
|
|
|
|
linux-headers-$(uname -r)
|
|
|
|
|
|
|
|
|
|
|
|
cd /tmp
|
|
|
|
|
|
git clone --branch stable-1.7 --depth 1 https://gitlab.com/etherlab.org/ethercat.git ethercat-stable-1.7
|
|
|
|
|
|
cd ethercat-stable-1.7
|
|
|
|
|
|
|
|
|
|
|
|
./bootstrap
|
|
|
|
|
|
./configure \
|
|
|
|
|
|
--prefix=$IGH_ETHERCAT_ROOT \
|
|
|
|
|
|
--libdir=$IGH_ETHERCAT_ROOT/lib \
|
|
|
|
|
|
--includedir=$IGH_ETHERCAT_ROOT/include \
|
|
|
|
|
|
--sysconfdir=$IGH_ETHERCAT_ROOT/etc \
|
|
|
|
|
|
--with-systemdsystemunitdir=$IGH_ETHERCAT_ROOT/lib/systemd/system \
|
|
|
|
|
|
--enable-generic \
|
|
|
|
|
|
--with-linux-dir=/lib/modules/$(uname -r)/build
|
|
|
|
|
|
|
|
|
|
|
|
make -j$(nproc) all modules
|
|
|
|
|
|
make install
|
|
|
|
|
|
sudo make modules_install
|
|
|
|
|
|
sudo depmod
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
启动 EtherCAT。`eno1` 换成实际连接 EtherCAT 从站的网卡:
|
2026-03-11 16:23:23 +08:00
|
|
|
|
|
2026-07-09 14:22:35 +08:00
|
|
|
|
```shell
|
|
|
|
|
|
sudo script/ethercat/start_ethercat.sh eno1
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
脚本会写入内置 IgH 配置文件:
|
|
|
|
|
|
|
|
|
|
|
|
```text
|
|
|
|
|
|
$IGH_ETHERCAT_ROOT/etc/ethercat.conf
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
脚本会把该网卡的 MAC 写到 `MASTER0_DEVICE`,使用 `DEVICE_MODULES="generic"`,把网卡从 NetworkManager 断开,并通过 `ethercatctl -c` 启动 IgH master。
|
|
|
|
|
|
|
|
|
|
|
|
查看状态:
|
|
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
|
script/ethercat/status_ethercat.sh
|
|
|
|
|
|
|
|
|
|
|
|
$IGH_ETHERCAT_ROOT/bin/ethercat master
|
|
|
|
|
|
$IGH_ETHERCAT_ROOT/bin/ethercat slaves
|
|
|
|
|
|
$IGH_ETHERCAT_ROOT/bin/ethercat pdos
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
停止 EtherCAT:
|
|
|
|
|
|
|
|
|
|
|
|
```shell
|
|
|
|
|
|
sudo script/ethercat/stop_ethercat.sh eno1
|
|
|
|
|
|
sudo script/ethercat/stop_ethercat.sh eno1 --restore-network
|
|
|
|
|
|
```
|