对于机器人位姿变换,将变化量(变换矩阵)乘在当前位姿的左边和右边并不是完全一样的,它们的物理意义不同。具体效果取决于你要实现的操作——是相对于全局坐标系变换,还是相对于局部坐标系变换。
公式表示:
T new = T current ⋅ Δ T T_{\text{new}} = T_{\text{current}} \cdot \Delta T Tnew=Tcurrent⋅ΔT
意义:
右乘表示变化量是相对于当前机器人自身的方向和位置的。例如:
公式表示:
T new = Δ T ⋅ T current T_{\text{new}} = \Delta T \cdot T_{\text{current}} Tnew=ΔT⋅Tcurrent
意义:
左乘表示变化量是相对于全局坐标系的。例如:
假设机器人当前的位姿 ( T_{\text{current}} ) 是:
T current = [ R t 0 1 ] T_{\text{current}} = \begin{bmatrix} R & t \\ 0 & 1 \end{bmatrix} Tcurrent=[R0t1]
T new = T current ⋅ Δ T T_{\text{new}} = T_{\text{current}} \cdot \Delta T Tnew=Tcurrent⋅ΔT
[
T_{\text{new}} = \Delta T \cdot T_{\text{current}}
]
假设当前位姿 ( T_{\text{current}} ):
T current = [ 1 0 0 5 0 1 0 0 0 0 1 0 0 0 0 1 ] T_{\text{current}} = \begin{bmatrix} 1 & 0 & 0 & 5 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} Tcurrent= 1000010000105001
表示机器人位于 ( (5, 0, 0) ),面向 ( X ) 轴方向。
变化量 ( \Delta T ) 是沿 ( X ) 轴移动 3 米:
Δ T = [ 1 0 0 3 0 1 0 0 0 0 1 0 0 0 0 1 ] \Delta T = \begin{bmatrix} 1 & 0 & 0 & 3 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} ΔT= 1000010000103001
T new = T current ⋅ Δ T = [ 1 0 0 5 0 1 0 0 0 0 1 0 0 0 0 1 ] ⋅ [ 1 0 0 3 0 1 0 0 0 0 1 0 0 0 0 1 ] ⋅ = [ 1 0 0 8 0 1 0 0 0 0 1 0 0 0 0 1 ] T_{\text{new}} = T_{\text{current}} \cdot \Delta T = \begin{bmatrix} 1 & 0 & 0 & 5 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} 1 & 0 & 0 & 3 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot= \begin{bmatrix} 1 & 0 & 0 & 8 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} Tnew=Tcurrent⋅ΔT= 1000010000105001 ⋅ 1000010000103001 ⋅= 1000010000108001
结果:机器人移动到了 ( (8, 0, 0) )。
T new = Δ T ⋅ T current = [ 1 0 0 3 0 1 0 0 0 0 1 0 0 0 0 1 ] ⋅ [ 1 0 0 5 0 1 0 0 0 0 1 0 0 0 0 1 ] ⋅ = [ 1 0 0 8 0 1 0 0 0 0 1 0 0 0 0 1 ] T_{\text{new}} = \Delta T \cdot T_{\text{current}} = \begin{bmatrix} 1 & 0 & 0 & 3 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot \begin{bmatrix} 1 & 0 & 0 & 5 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \cdot= \begin{bmatrix} 1 & 0 & 0 & 8 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} Tnew=ΔT⋅Tcurrent= 1000010000103001 ⋅ 1000010000105001 ⋅= 1000010000108001
结果:同样移动到了 ( (8, 0, 0) )。
此时效果看似一致,但这仅适用于纯平移。在旋转的情况下,结果会明显不同。
假设变化量 ( \Delta T ) 是绕 ( Z ) 轴旋转 90 度:
Δ T = [ 0 − 1 0 0 1 0 0 0 0 0 1 0 0 0 0 1 ] \Delta T = \begin{bmatrix} 0 & -1 & 0 & 0 \\ 1 & 0 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} ΔT= 0100−100000100001
T new = T current ⋅ Δ T T_{\text{new}} = T_{\text{current}} \cdot \Delta T Tnew=Tcurrent⋅ΔT
T new = Δ T ⋅ T current T_{\text{new}} = \Delta T \cdot T_{\text{current}} Tnew=ΔT⋅Tcurrent
根据场景选择合适的乘法顺序是关键: