【具身智能基础】系列文章
一、坐标系与位姿变换
二、机器人轨迹规划
三、机器人运动学
提示:该文章为个人学习记录,如有错误请指出
文章目录
三、机器人运动学
一、运动学与动力学概念
运动学(Kinematics)
研究“运动本身”,不考虑产生运动的力。
主要关注:
- 位置 x \mathbf{x} x
- 速度 v = d x d t \mathbf{v} = \dfrac{d\mathbf{x}}{dt} v=dtdx
- 加速度 a = d v d t = d 2 x d t 2 \mathbf{a} = \dfrac{d\mathbf{v}}{dt} = \dfrac{d^2\mathbf{x}}{dt^2} a=dtdv=dt2d2x
机器人运动学(Robot Kinematics)研究机器人关节、连杆之间的几何关系。
- 正运动学(Forward Kinematics, FK):已知关节变量,求末端执行器位姿。
- 逆运动学(Inverse Kinematics, IK):已知末端执行器位姿,求关节变量。

动力学(Dynamics)
研究“力如何产生运动”,依据牛顿第二定律:
F
=
m
a
\mathbf{F} = m\mathbf{a}
F=ma
二、机械手臂的几何结构描述
1. 组成要素
- Link(连杆):刚体,用来连接各关节。
- Joint(关节):提供一个自由度(DOF)。
- 旋转关节(Revolute) → 变量为角度 θ \theta θ
- 移动关节(Prismatic) → 变量为位移 d d d
-
末端执行器(End Effector):机器人用于执行任务的末端装置(如机械手爪)。
-
姿态(Pose):包含位置与方向:
p = [ x , y , z ] T , R ∈ S O ( 3 ) \mathbf{p} = [x, y, z]^T, \qquad \mathbf{R} \in SO(3) p=[x,y,z]T,R∈SO(3)
2. 编号规则
- Link 0:基座(固定不动)
- Link 1:第一个活动杆
- 以此类推,最后一个为末端执行器。
二、正运动学(Forward Kinematics, FK)
2.1 定义
给定各关节变量,求出末端相对于基座的位姿:
T 0 n = f ( θ 1 , θ 2 , … , θ n ) \mathbf{T}_{0}^{n} = f(\theta_1, \theta_2, \dots, \theta_n) T0n=f(θ1,θ2,…,θn)
其中 T 0 n \mathbf{T}_{0}^{n} T0n 是齐次变换矩阵:
T = [ R p 0 1 ] \mathbf{T} = \begin{bmatrix} \mathbf{R} & \mathbf{p} \\ 0 & 1 \end{bmatrix} T=[R0p1]
2.2 D–H 参数法(Denavit–Hartenberg)

为每个连杆定义 4 个参数:
| 参数 | 含义 | 类型 |
|---|---|---|
| a i a_i ai | 连杆长度 | 位移 |
| α i \alpha_i αi | 连杆扭角 | 旋转 |
| d i d_i di | 连杆偏距 | 位移 |
| θ i \theta_i θi | 连杆转角 | 旋转 |
单个连杆的齐次变换(从
i
−
1
i-1
i−1 到
i
i
i):
A
i
=
[
cos
θ
i
−
sin
θ
i
cos
α
i
sin
θ
i
sin
α
i
a
i
cos
θ
i
sin
θ
i
cos
θ
i
cos
α
i
−
cos
θ
i
sin
α
i
a
i
sin
θ
i
0
sin
α
i
cos
α
i
d
i
0
0
0
1
]
\mathbf{A}_i = \begin{bmatrix} \cos\theta_i & -\sin\theta_i\cos\alpha_i & \sin\theta_i\sin\alpha_i & a_i\cos\theta_i \\ \sin\theta_i & \cos\theta_i\cos\alpha_i & -\cos\theta_i\sin\alpha_i & a_i\sin\theta_i \\ 0 & \sin\alpha_i & \cos\alpha_i & d_i \\ 0 & 0 & 0 & 1 \end{bmatrix}
Ai=
cosθisinθi00−sinθicosαicosθicosαisinαi0sinθisinαi−cosθisinαicosαi0aicosθiaisinθidi1
整体变换为:
T 0 n = A 1 A 2 ⋯ A n \mathbf{T}_{0}^{n} = \mathbf{A}_1 \mathbf{A}_2 \cdots \mathbf{A}_n T0n=A1A2⋯An
2.3 二维双连杆机械臂示例
已知两关节转角 θ 1 , θ 2 \theta_1, \theta_2 θ1,θ2,连杆长度 l 1 , l 2 l_1, l_2 l1,l2,则末端坐标为:
{ x = l 1 cos θ 1 + l 2 cos ( θ 1 + θ 2 ) y = l 1 sin θ 1 + l 2 sin ( θ 1 + θ 2 ) \begin{cases} x = l_1\cos\theta_1 + l_2\cos(\theta_1 + \theta_2) \\ y = l_1\sin\theta_1 + l_2\sin(\theta_1 + \theta_2) \end{cases} {x=l1cosθ1+l2cos(θ1+θ2)y=l1sinθ1+l2sin(θ1+θ2)
示意图(Mermaid):
三、逆运动学(Inverse Kinematics, IK)
3.1 定义
已知末端位姿 T 0 n \mathbf{T}_{0}^{n} T0n,求各个关节变量:
Given T 0 n , find θ i \text{Given } \mathbf{T}_{0}^{n}, \quad \text{find } \theta_i Given T0n,find θi
3.2 特点
- 非唯一性:可能有多个解(如肘上/肘下姿态)。
- 可能无解:目标点在工作空间之外。
- 高非线性:方程复杂,常需数值迭代法。
3.3 几何法求解(二维双连杆示例)
先求 θ 2 \theta_2 θ2:
cos θ 2 = x 2 + y 2 − l 1 2 − l 2 2 2 l 1 l 2 \cos\theta_2 = \frac{x^2 + y^2 - l_1^2 - l_2^2}{2 l_1 l_2} cosθ2=2l1l2x2+y2−l12−l22
θ 2 = arccos ( cos θ 2 ) \theta_2 = \arccos(\cos\theta_2) θ2=arccos(cosθ2)
再求 θ 1 \theta_1 θ1:
θ 1 = atan2 ( y , x ) − atan2 ( l 2 sin θ 2 , ; l 1 + l 2 cos θ 2 ) \theta_1 = \operatorname{atan2}(y, x) - \operatorname{atan2}\bigl(l_2\sin\theta_2,; l_1 + l_2\cos\theta_2\bigr) θ1=atan2(y,x)−atan2(l2sinθ2,;l1+l2cosθ2)
条件: ∣ cos θ 2 ∣ ≤ 1 |\cos\theta_2| \le 1 ∣cosθ2∣≤1,即目标点在可达范围内。
3.4 数值法(Jacobian 迭代法)
雅可比关系:
x ˙ = J ( θ ) θ ˙ \dot{\mathbf{x}} = \mathbf{J}(\theta)\dot{\theta} x˙=J(θ)θ˙
伪逆求解增量:
θ ˙ = J + ( θ ) x ˙ \dot{\theta} = \mathbf{J}^{+}(\theta)\dot{\mathbf{x}} θ˙=J+(θ)x˙
迭代更新:
θ k + 1 = θ k + Δ t J + ( θ k ) ( x target − x ( θ k ) ) \theta_{k+1} = \theta_k + \Delta t\mathbf{J}^{+}(\theta_k)\bigl(\mathbf{x}_{\text{target}} - \mathbf{x}(\theta_k)\bigr) θk+1=θk+ΔtJ+(θk)(xtarget−x(θk))
四、FK 与 IK 对比总结
| 项目 | 正运动学 (FK) | 逆运动学 (IK) |
|---|---|---|
| 输入 | 关节变量 θ i \theta_i θi | 末端位姿 T 0 n \mathbf{T}_{0}^{n} T0n |
| 输出 | 末端位姿 T 0 n \mathbf{T}_{0}^{n} T0n | 关节变量 θ i \theta_i θi |
| 计算难度 | 简单(矩阵乘积) | 复杂(非线性方程) |
| 解的数量 | 唯一 | 多解 / 无解 |
| 应用场景 | 仿真、验证 | 规划、控制 |
五、Q&A
1.正运动学和逆运动学的输入和输出是什么?
正运动学:
1)输入
各个关节变量(旋转角或平移量):
θ
1
,
θ
2
,
…
,
θ
n
\theta_1, \theta_2, \dots, \theta_n
θ1,θ2,…,θn
2)输出
末端执行器的位姿(位置 + 姿态):
T 0 n = [ R p 0 1 ] \mathbf{T}_0^n = \begin{bmatrix} \mathbf{R} & \mathbf{p} \\\\ 0 & 1 \end{bmatrix} T0n= R0p1
其中:
-
位置:末端的坐标 ( x , y , z ) (x, y, z) (x,y,z)
-
姿态:末端的方向(用旋转矩阵、欧拉角或四元数表示)
逆运动学:
1)输入
目标末端位姿(期望的目标位置与方向):
T target = [ R target p target 0 1 ] \mathbf{T}_{\text{target}} = \begin{bmatrix} \mathbf{R}_{\text{target}} & \mathbf{p}_{\text{target}} \\\\ 0 & 1 \end{bmatrix} Ttarget= Rtarget0ptarget1
2)输出
关节变量:
θ 1 , θ 2 , … , θ n \theta_1, \theta_2, \dots, \theta_n θ1,θ2,…,θn
2.一个平面两关节机械臂去到同一个目标点,可能会有几种解?为什么?
1)场景:
平面上一个两关节旋转机械臂(2R),每个连杆长度为 l 1 , l 2 l_1, l_2 l1,l2,目标点为 ( x , y ) (x, y) (x,y)。
2)可能的解
通常有 两种几何解:
- 肘上(elbow-up)构型
- 肘下(elbow-down)构型
这两个解的区别在于第二个关节的弯曲方向不同
3)数学解释
由几何法可得第二关节角度:
cos θ 2 = x 2 + y 2 − l 1 2 − l 2 2 2 l 1 l 2 \cos\theta_2 = \frac{x^2 + y^2 - l_1^2 - l_2^2}{2 l_1 l_2} cosθ2=2l1l2x2+y2−l12−l22
当 ∣ cos θ 2 ∣ ≤ 1 |\cos\theta_2| \le 1 ∣cosθ2∣≤1 时,有两个可能的解:
θ 2 = arccos ( cos θ 2 ) \theta_2 = \arccos(\cos\theta_2) θ2=arccos(cosθ2)
和
θ 2 ′ = − arccos ( cos θ 2 ) \theta_2' = -\arccos(\cos\theta_2) θ2′=−arccos(cosθ2)
这对应两种不同的构型(即“肘上/肘下”)。
3.如果目标点超出了机械臂的最大工作范围,会怎样?
1)最大可达范围
末端与基座的最大、最小距离为:
r max = l 1 + l 2 r_{\max} = l_1 + l_2 rmax=l1+l2
r min = ∣ l 1 − l 2 ∣ r_{\min} = |l_1 - l_2| rmin=∣l1−l2∣
2)超出范围时
如果目标点 ( x , y ) (x, y) (x,y) 满足:
x 2 + y 2 > r max \sqrt{x^2 + y^2} > r_{\max} x2+y2>rmax
或
x 2 + y 2 < r min \sqrt{x^2 + y^2} < r_{\min} x2+y2<rmin
则机械臂 无实解(不可达),在计算中会出现:
∣ cos θ 2 ∣ > 1 |\cos\theta_2| > 1 ∣cosθ2∣>1
导致 arccos() 无实数解。
3)物理意义
- 机械臂无法到达目标点。
- 控制系统通常会返回“不可达”或“超出工作空间”错误。
- 在规划算法中会直接排除这些点。
1077

被折叠的 条评论
为什么被折叠?



