规划器 API¶
所有规划器共享接口 get_state(t) -> (pos, vel, acc)(世界系线量前馈)。
SE3ToppTrajectory 还提供 get_motion_state(t) -> (T_d, V_d, Vdot_d),其中
twist 与其导数在期望 body frame 表达。get_motion_reference 将两类接口统一成
SE(3) Lie 控制器所需的 body 运动参考。
SE(3)-TOPP¶
两段 SE(3) 测地线 + 每段时间最优参数化的对接轨迹。
路点:T1(起始位姿)→ T2(预对接:终点沿接近轴后撤 standoff,姿态同 终点)→ T3(终点位姿)。接近段用宽松限速、对接段用严格限速(论文 Table 8:接近 0.10 m/s·0.20 rad/s,对接 0.02 m/s·0.05 rad/s)。
源代码位于: src/compliant_docking/planning/se3_topp.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
属性¶
方法:¶
__init__ ¶
__init__(
start_pos: ndarray,
start_ori: ndarray,
final_pos: ndarray,
final_ori: ndarray,
*,
standoff: float,
v_max_approach: float,
a_max_approach: float,
omega_max_approach: float,
alpha_max_approach: float,
v_max_docking: float,
a_max_docking: float,
omega_max_docking: float,
alpha_max_docking: float,
)
源代码位于: src/compliant_docking/planning/se3_topp.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | |
get_state ¶
get_state(
t: float,
) -> tuple[ndarray, ndarray, ndarray]
世界系 (pos, vel, acc) 线量前馈(t≥总时长停在终点)。
源代码位于: src/compliant_docking/planning/se3_topp.py
129 130 131 132 133 134 135 136 | |
get_pose ¶
get_pose(t: float) -> SE3
t 时刻的完整位姿 T_r(t)(供按步姿态参考与测试使用)。
源代码位于: src/compliant_docking/planning/se3_topp.py
138 139 140 141 142 143 144 145 146 147 148 149 | |
get_motion_state ¶
get_motion_state(
t: float,
) -> tuple[SE3, ndarray, ndarray]
t 时刻的期望运动参考 (T_d, V_d, Vdot_d)——body(体坐标)量。
每段为常螺旋测地线 Td(s) = Ta·Exp(ξ·s),ξ 在段内为常量,严格有::
[V_d] = Td⁻¹·Ṫd = [ξ]·ṡ → V_d = ξ·ṡ
Vdot_d = d(V_d)/dt = ξ·s̈
(body twist 的向量导数,正是 SE(3) Lie 阻抗控制器 Eq. 62 需要的 V̇_d;不得从世界系 pos/vel/acc 反推。)t≥总时长停在终点,t<0 在起点。
供 control/se3_impedance.py(Kim et al. 2025 Eq. 44-66 控制器)与 planning/motion_reference.py 适配器使用。
源代码位于: src/compliant_docking/planning/se3_topp.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
SE(3) 运动参考适配¶
get_motion_reference(planner, t, r_des) -> tuple[pin.SE3, np.ndarray, np.ndarray]
返回 (T_d, V_d, Vdot_d)。若规划器实现 get_motion_state 则直接透传;否则
调用 get_state,以固定 r_des 构造位姿并把世界系线速度/加速度旋转到
desired body frame,角速度与角加速度置零。
解耦五次 / 两段式对接 / 圆+8字¶
三轴解耦的五次多项式轨迹规划器(x/y/z 分别独立) Decoupled quintic polynomial trajectory planner for x, y, z axes
源代码位于: src/compliant_docking/planning/trajectory.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
方法:¶
__init__ ¶
__init__(
start_pos: ndarray,
target_pos: ndarray,
duration: float,
)
Initialize the trajectory planner with decoupled planning for each axis
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
start_pos
|
ndarray
|
初始位置 (x0, y0, z0) / Initial position |
必需 |
target_pos
|
ndarray
|
目标位置 (xf, yf, zf) / Target position |
必需 |
duration
|
float
|
轨迹持续时间(秒) / Trajectory duration (s) |
必需 |
Note
三轴各自满足端点速度/加速度为零,生成 C2 连续的平滑轨迹 / Each axis satisfies zero vel/acc at endpoints (C2 continuity)
源代码位于: src/compliant_docking/planning/trajectory.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 | |
get_state ¶
get_state(
t: float,
) -> tuple[ndarray, ndarray, ndarray]
获取时刻 t 的位置/速度/加速度;三轴独立计算 / Get position, velocity and acceleration at time t; axes computed independently
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
t
|
float
|
当前时间(秒) / Current time (s) |
必需 |
返回:
| 类型 | 描述 |
|---|---|
tuple[ndarray, ndarray, ndarray]
|
(pos, vel, acc) 三个 3D 向量 / 3D numpy arrays |
源代码位于: src/compliant_docking/planning/trajectory.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
verify_boundary_conditions ¶
verify_boundary_conditions(
tol: float = 1e-10,
) -> bool
验证边界条件(起止位置、速度=0、加速度=0)是否满足 / Verify that endpoint position/velocity/acceleration constraints hold
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
tol
|
float
|
浮点比较容差 / Tolerance for comparisons |
1e-10
|
返回:
| 类型 | 描述 |
|---|---|
bool
|
是否全部满足 / True if all constraints satisfied |
源代码位于: src/compliant_docking/planning/trajectory.py
130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | |
两段式对接轨迹:接近段(approach,宽松限速)+ 对接段(docking,严格限速) Two-phase docking trajectory: approach phase (loose limits) + docking phase (strict limits)
任务结构取自 Ren & Shan 2026 (Acta Astronautica) 的两段式对接:末端先以宽松限速 从 start_pos 接近到预对接点(pre-dock,= final_pos 沿接近轴后撤 standoff),再以 严格限速(0.02 m/s 量级)完成最后一段进给。峰值接触力主要由接触前速度决定, 因此对接段的低限速是压低峰值力的关键。
与论文 SE(3)-TOPP 的关系与简化点 / Relation to the paper's SE(3)-TOPP and simplifications: - 论文对整条 SE(3) 路径做时间最优参数化(TOPP),全程不停顿、速度沿路径连续变化; - 本实现是其保守简化版:两段各自独立做 rest-to-rest 五次多项式,途经预对接点处 瞬时停顿(速度/加速度归零)后再进入对接段——时间上不是最优,更保守; - 每段时长由限速解析反推(quintic_rest_to_rest_duration):三轴同步使用同一段 时长 T,并用该段位移的 3D 标量长度 L 保守估计合成速度/加速度峰值 (v_peak = 1.875·L/T、a_peak = 5.7735·L/T²)。对直线段而言三轴共享同一无量纲 时间形状,该估计恰为精确值。
位置/速度/加速度全程 C2 连续:接合点(预对接点)两侧均为 rest-to-rest,自然衔接。
源代码位于: src/compliant_docking/planning/trajectory.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
属性¶
durations
property
¶
durations: tuple[float, float]
(接近段时长 t1, 对接段时长 t2),单位秒 / (approach, docking) durations in s
total_duration
property
¶
total_duration: float
轨迹总时长 t1 + t2(秒)/ Total trajectory duration t1 + t2 (s)
方法:¶
__init__ ¶
__init__(
start_pos: ndarray,
final_pos: ndarray,
standoff: float,
v_max_approach: float,
a_max_approach: float,
v_max_docking: float,
a_max_docking: float,
)
Initialize the two-phase docking trajectory
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
start_pos
|
ndarray
|
初始位置 (3D) / Initial position |
必需 |
final_pos
|
ndarray
|
最终对接目标位置 (3D) / Final docking target position |
必需 |
standoff
|
float
|
预对接点沿接近轴的后撤距离 [m] / stand-off retreat distance [m] |
必需 |
v_max_approach
|
float
|
接近段线速度上限 / approach phase limits |
必需 |
a_max_approach
|
float
|
接近段线加速度上限 / approach phase limits |
必需 |
v_max_docking
|
float
|
对接段线速度上限 / docking phase limits |
必需 |
a_max_docking
|
float
|
对接段线加速度上限 / docking phase limits |
必需 |
源代码位于: src/compliant_docking/planning/trajectory.py
178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 | |
get_state ¶
get_state(
t: float,
) -> tuple[ndarray, ndarray, ndarray]
获取时刻 t 的位置/速度/加速度 / Get position, velocity and acceleration at time t
时间分段: - t < 0:按 t = 0 处理(停在起点); - t ∈ [0, t1):接近段(段内局部时间采样); - t ∈ [t1, t1+t2):对接段(段内局部时间采样); - t ≥ t1+t2:停在 final_pos,速度/加速度为 0。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
t
|
float
|
当前时间(秒) / Current time (s) |
必需 |
返回:
| 类型 | 描述 |
|---|---|
tuple[ndarray, ndarray, ndarray]
|
(pos, vel, acc) 三个 3D 向量 / 3D numpy arrays |
源代码位于: src/compliant_docking/planning/trajectory.py
240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
圆形 + 8 字形轨迹跟踪测试规划器:过渡 → 竖直圆 → 过渡 → 平面 8 字 → 保持 Circle + figure-8 trajectory planner for controller tracking tests (hold at the end)
在不考虑对接的条件下测试控制器的轨迹跟踪能力(轨迹形状参考同类任务空间 跟踪实验,速度/加速度改为对位置公式解析求导,无数值差分)。
时间结构(四段 + 保持): - 段1 过渡 [0, T_tr):start_pos → 圆起点 P1(rest-to-rest 五次时间缩放); - 段2 圆周 [T_tr, T_tr+T_c):竖直圆(y-z 平面),θ = 2π·f_c·(t-t0); - 段3 过渡 [T_tr+T_c, 2·T_tr+T_c):圆终点 P2 → 8 字中心 C(rest-to-rest); - 段4 8字 [2·T_tr+T_c, total):水平 8 字(x-y 平面),φ = 2π·f_8·(t-t0); - t ≥ total:保持在 8 字结束点,速度/加速度为零。
几何 / Geometry: - 圆心 C = start_pos + [0, 0, circle_center_offset](默认在起点正下方 0.06 m); - 圆起点 P1 = C + [0, r, 0];圆终点 P2 = 段2 结束时刻的圆周位置 (f_c·T_c 非整圈时 P2 ≠ P1,过渡段3 必须从 P2 出发); - 8 字为 Lissajous 曲线 p = C + [ax·sinφ, ay·sin(2φ), 0]。
连续性说明 / Continuity note:
每一段均使用五次时间缩放。圆周和 8 字的几何相位也由该缩放推进,因此在每个
段边界位置、速度和加速度都连续(C2);这使测试聚焦于轨迹跟踪,而不是人为的
速度阶跃。circle_frequency / figure8_frequency 表示该段总圈数除以该段
时长的平均频率,故总相位仍为 2π·frequency·duration。
源代码位于: src/compliant_docking/planning/trajectory.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |
属性¶
durations
property
¶
durations: tuple[float, float, float]
(过渡段 T_tr, 圆周段 T_c, 8 字段 T_8) 时长(秒)/ (transition, circle, figure-8) durations
total_duration
property
¶
total_duration: float
轨迹总时长 2·T_tr + T_c + T_8(秒)/ Total duration 2·T_tr + T_c + T_8 (s)
segments
property
¶
segments: tuple[tuple[str, float, float], ...]
四段 (名称, t_start, t_end):过渡1/圆周/过渡2/8字 / The four segments as (name, t_start, t_end): transition/circle/transition/figure-8
方法:¶
__init__ ¶
__init__(
start_pos: ndarray,
*,
transition_duration: float = 1.5,
circle_duration: float = 5.0,
circle_radius: float = 0.1,
circle_frequency: float = 0.2,
circle_center_offset: float = -0.06,
figure8_duration: float = 5.0,
figure8_radius_x: float = 0.1,
figure8_radius_y: float = 0.07,
figure8_frequency: float = 0.2,
)
Initialize the circle + figure-8 tracking-test trajectory
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
start_pos
|
ndarray
|
轨迹出发点 (3D) / Start position (3D) |
必需 |
transition_duration
|
float
|
过渡段时长 T_tr [s] / Transition segment duration |
1.5
|
circle_duration
|
float
|
圆周段时长 T_c [s] / Circle segment duration |
5.0
|
circle_radius
|
float
|
圆周半径 r [m] / Circle radius |
0.1
|
circle_frequency
|
float
|
圆周频率 f_c [Hz] / Circle frequency |
0.2
|
circle_center_offset
|
float
|
圆心相对 start_pos 的 z 偏移 [m](可正可负) / Circle center offset below/above the start position |
-0.06
|
figure8_duration
|
float
|
8 字段时长 T_8 [s] / Figure-8 segment duration |
5.0
|
figure8_radius_x
|
float
|
8 字 x 半幅值 [m] / Figure-8 radius |
0.1
|
figure8_radius_y
|
float
|
8 字 y 半幅值 [m] / Figure-8 radius |
0.07
|
figure8_frequency
|
float
|
8 字频率 f_8 [Hz] / Figure-8 frequency |
0.2
|
源代码位于: src/compliant_docking/planning/trajectory.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
get_state ¶
get_state(
t: float,
) -> tuple[ndarray, ndarray, ndarray]
获取时刻 t 的位置/速度/加速度 / Get position, velocity and acceleration at time t
时间分段: - t < 0:按 t = 0 处理(停在起点); - t ∈ [0, T_tr):过渡段1(start_pos → P1); - t ∈ [T_tr, T_tr+T_c):圆周段(竖直圆,y-z 平面); - t ∈ [T_tr+T_c, 2·T_tr+T_c):过渡段2(P2 → C); - t ∈ [2·T_tr+T_c, total):8 字段(水平,x-y 平面); - t ≥ total:保持在 8 字结束点,速度/加速度为 0。
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
t
|
float
|
当前时间(秒) / Current time (s) |
必需 |
返回:
| 类型 | 描述 |
|---|---|
tuple[ndarray, ndarray, ndarray]
|
(pos, vel, acc) 三个 3D 向量 / 3D numpy arrays |
源代码位于: src/compliant_docking/planning/trajectory.py
410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |
逆运动学¶
使用 Pinocchio 进行逆运动学(阻尼最小二乘):返回关节角与是否收敛 / Compute inverse kinematics (damped least squares) using Pinocchio
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
pin_model
|
Model
|
Pinocchio 模型 / Pinocchio model |
必需 |
pin_data
|
Data
|
Pinocchio 数据 / Pinocchio data |
必需 |
target_pose
|
SE3
|
目标末端位姿 pin.SE3 / target end-effector pose |
必需 |
initial_q
|
ndarray | None
|
初始关节角,None 则取 neutral / initial joint config |
_DEFAULT_INITIAL_Q
|
max_iters
|
int
|
最大迭代步数 / maximum iterations |
3000
|
eps
|
float
|
收敛阈值 / convergence threshold |
1e-07
|
ee_frame
|
str
|
末端 frame 名(由模型/场景决定;默认值为组合 URDF 的
|
'cylinder_link'
|
返回:
| 名称 | 类型 | 描述 |
|---|---|---|
q |
ndarray
|
关节角解 / joint configuration |
success |
bool
|
是否收敛 / convergence flag |
源代码位于: src/compliant_docking/planning/kinematics.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |