南科大高等机器人控制课程总结与project

July 29, 2024

现代机器人学: 旋量法推导机器人运动学与动力学方程

本文公式可能有误,欢迎评论指正

刚体构型描述,旋量方法

斜对称矩阵(Skew symmetric)

a×b=[a]ba\times b=[a]b

[a][0a3a2a30a1a2a10][a]\triangleq\begin{bmatrix}0&-a_3&a_2\\a_3&0&-a_1\\-a_2&a_1&0\end{bmatrix}

特殊正交群(Special Orthogonal Group)

SO(n)={RRn×n:RTR=I,det(R)=1}ARB: orientation of {B} relative to {A} expressed in {A} frame\begin{aligned}&SO(n)=\{R\in\mathbb{R}^{n\times n}:R^TR=I,\det(R)=1\}\\&^AR_B\text{: orientation of \{B\} relative to \{A\} expressed in \{A\} frame}\end{aligned}

对于绕轴旋转运动, 设单位转轴ω, 旋转矩阵R可以通过罗德里格斯公式计算:

由微分方程 q˙(t)=ω×q(t)=[ω]q(t)\dot{q}(t)=\omega\times q(t)=[\omega]q(t)

可得 q(t)=e[ω]tq(0)q(t)=e^{[\omega]t}q(0)

因而 Rot(ω,θ)=e[ω]θ==I+[ω]sinθ+[ω]2(1cosθ)Rot(\omega,\theta)=e^{[\omega]\theta}==I+[\omega]\sin\theta+[\omega]^2(1-\cos\theta)

[ωs(t)]=R˙s(t)Rs1(t)[\omega_s(t)]=\dot{R}_s(t)R_s^{-1}(t)

特殊欧几里得群(Special Euclidean Group)

se(3)={([ω],v):[ω]so(3),vR3}se(3)=\{([\omega],v):[\omega]\in so(3),v\in\mathbb{R}^3\}

Homogeneous Transformation Matrix: ATB=(R,p)=[ARBApB01]^AT_B= (R, p)=\begin{bmatrix}^AR_B&^Ap_B\\0&1\end{bmatrix}

T1=[Rp01]1=[RTRTp01]T^{-1}=\begin{bmatrix}R&p\\0&1\end{bmatrix}^{-1}=\begin{bmatrix}R^T&-R^Tp\\0&1\end{bmatrix}

R[w]RT=[Rw]R[w]R^T=[Rw]

[S]=(ω,v)=[[ω]v00][\mathcal{S}]=(\omega,v)=\begin{bmatrix}[\omega]&v\\0&0\end{bmatrix}

p~(t)=e[S]tp~(0),e[S]tSE(3)\tilde{p}(t)=e^{[\mathcal{S}]t}\tilde{p}(0) ,e^{[\mathcal{S}]t}\in SE(3)

正向运动学

运动旋量Twist

AV=AXBBV^AV=^AX_{B}^{B}V

AXB=[AdT][R0[p]RR]^AX_B=[Ad_T]\triangleq\begin{bmatrix}R&0\\{[p]}R&R\end{bmatrix}

[Vb]=T1T˙,[Vs]=T˙T1[V_b]=T^{-1}\dot{T} , [V_s]=\dot{T}T^{-1}

如果坐标系不动,则先求导再坐标变换与先坐标变换再求导等价: o[ddt(r)]=ddt(or)^o[\frac{d}{dt}(r)]=\frac{d}{dt}(^or) , 也即or˙=or˚^o\dot{r}=^o\mathring{r}

如果坐标系移动,则有: o[ddt(r)]=ddt(or)+BωB×or^o[\frac{d}{dt}(r)]=\frac{d}{dt}(^or)+^B\omega_B\times^or

PoE

PoE

PoE需要从end effector的位置和姿态开始,向base的位置和姿态推导, 这样可以避免靠近base的关节的运动影响到靠近end effector的轴的位置和姿态。

当然,前向和后向最后可以证明是一样的,没有区别,但是前向的PoE需要考虑到上面的问题,导致求解比较麻烦.

雅可比矩阵

Geometric Jacobian

对于n轴robot,令V为end-effector的twist, J为雅可比矩阵, J_i为第i个关节的雅可比矩阵, coordinate free形式下有:

V=J(θ)θ˙=J1(θ)θ1˙++Jn(θ)θ˙n\mathcal{V}=J(\theta)\dot{\theta}=J_1(\theta)\dot{\theta_1}+\cdots+J_n(\theta)\dot{\theta}_n

因此有Ji(θ)=Si(θ)J_i(\theta)=\mathcal{S}_i(\theta)

考虑到坐标变换有 J(θ)=[S1,[AdT(θ1)]Sˉ2]J(\theta)=[S_1,[Ad_T(\theta_1)]\bar{S}_2]

也即0Ji(θ)=0Xi(θ)iSi^0J_i(\theta)=^0X_i(\theta)^iS_i

Analytical Jacobian

定义:对于一个机器人,其末端执行器的位置和姿态可以用一个向量表示,这个向量的每个元素是末端执行器的位置和姿态的一个分量。这个向量的导数就是机器人的雅可比矩阵。

注意:x可能为6维向量,分别为位置和姿态的三个分量,也可能仅仅是位置的三维向量。

对于末端执行器位置与姿态向量p(θ), J=[pxθApxθBpxθCpyθApyθBpyθCpzθApzθBpzθC]J=\left[\begin{matrix}{\frac{\partial p_{x}}{\partial\theta_{A}}}&{\frac{\partial p_{x}}{\partial\theta_{B}}}&{\frac{\partial p_{x}}{\partial\theta_{C}}}\\{\frac{\partial p_{y}}{\partial\theta_{A}}}&{\frac{\partial p_{y}}{\partial\theta_{B}}}&{\frac{\partial p_{y}}{\partial\theta_{C}}}\\{\frac{\partial p_{z}}{\partial\theta_{A}}}&{\frac{\partial p_{z}}{\partial\theta_{B}}}&{\frac{\partial p_{z}}{\partial\theta_{C}}}\\\end{matrix}\right]

动力学

加速度的旋量表示

对于q¨(t)v˙o(t)\ddot{q}(t)\neq\dot{v}_o(t)的证明:

q˙(t)=v0(t)+w(t)×q(t)\dot{q}(t)=v_0(t)+w(t)\times\overrightarrow{q}(t)

求导可得,q¨(t)=v˙0(t)+w˙(t)×oq(t)+w(t)×q˙(t)\ddot{q}(t)=\dot{v}_{0}(t)+\dot{w}(t)\times\vec{oq}(t)+w(t)\times\dot{q}(t),证得结论.

AXB=[AdT][R0[p]RR]^AX_B=[Ad_T]\triangleq\begin{bmatrix}R&0\\{[p]}R&R\end{bmatrix},

可得AXB˙=ddt([R0[p]RR])^A\dot{X_B}=\frac{d}{dt}(\begin{bmatrix}R&0\\{[p]}R&R\end{bmatrix})

其中,([p]R)=[p˙]R+[p]R˙([p]R)^{\prime}=[\dot{p}]R+[p]\dot{R}

[p˙]=[v0+w×p]=[v0]+[w×p]=[v0]+[w][p][p][w]\begin{aligned}[\dot{p}]&=[v_{0}+w\times p]\\&=[v_{0}]+[{w\times p}]\\&=[v_{0}]+[w][p]-[p][w]\end{aligned}

其中,对于, [w×p]=[w][p][p][w][w\times p]=[w][p]-[p][w]部分, 李括号性质的分析与证明中有详细证明

因此有AXB˙=[[w]R0[v0]R+[w][p]R[w]R]=[[w]0[v0][w]]AXB^A\dot{X_B} = [\begin{matrix}[w]R&0\\{[v_0]}R+[w][p]R&[w]R\end{matrix}] = \begin{bmatrix}[w]&0\\{[v_{0}]}&[w]\end{bmatrix}{}^A{X_B}

对于V1×V2\mathcal{V}_1\times\mathcal{V}_2,令其等于[V1×]V2[\mathcal{V}_1\times]\mathcal{V}_2(一种李括号)

则有[V1×][[w]0[v][w]][V_{1}\times] \triangleq [\begin{matrix}{[w]}&0\\{[v]}&[w]\end{matrix}]

代入之前的式子,有AXB˙=[VB×]AXB^A\dot{X_B} = [V_{B}\times]{}^A{X_B}

空间加速度(spatial acceleration): A=V˙=[ω˙v˙o]A=\dot{\mathcal{V}}=\left[\begin{array}{c}\dot{\omega}\\\dot{v}_o\end{array}\right]

根据定义o(Abody)=ddt(oVbody)=ddt(oXBoVbody)=oX˙BBVbody+oXBBV˚body^{o}(A_{body})=\frac{d}{dt}(^{o}V_{body})=\frac{d}{dt}(^{o}X_{B}^{o}V_{body})={}^o\dot{X}_{B}{}^BV_{body}+^{o}X_{B}{}^{B}\mathring{V}_{body}

因此o(Abody)=[oVB×]oXBBVbody+oXBBV˚body^{o}(A_{body})=[^oV_{B}\times]{}^o{X_B}{}^BV_{body}+^{o}X_{B}{}^{B}\mathring{V}_{body}

加速度坐标变换: BA=BX0A{}^{B}A={}^{B}X_{0}^{\circ}A

力的旋量表示

对于O点力矩nOn_O, 有n0=iopi×fin_{0}=\sum_{i}\vec{op_{i}}\times f_{i}

空间力(Spatial Force),也称力旋量(Wrench): F=[nOf]\mathcal{F}=\left[\begin{array}{c}n_O\\f\end{array}\right]

frame A下有AF=[AnoAAf]{}^A\mathcal{F}=\left[\begin{array}{c}{}^An_{o_A}\\{}^Af\end{array}\right]

空间力坐标变换: AF=AXBBF{}^A\mathcal{F}={}^AX_B^*{}^B\mathcal{F}, 其中AXB=BXAT^AX_B^*={}^BX_A{}^T的证明:

又易证X˙B=[V×]XB\dot{X}_{B}^{*}=[\mathcal{V}\times^{*}]X_{B}^{*},其中[V×]=[[w][v]0[w]][\mathcal{V}\times^{*}]=[\begin{matrix}[w]&[v]\\0&[w]\end{matrix}]

可推导空间力的导数: A[ddtF]=ddt(AF)+[AV×]AF^A\left[\frac d{dt}\mathcal{F}\right]=\frac d{dt}\left(^A\mathcal{F}\right)+[^A\mathcal{V}\times^*]{}^{A}\mathcal{F}

[AnOAAf]=[ARBARB[BPA]0ARB][BnOBBf]\left[\begin{matrix}^A{n_{OA}}\\^A{f}\end{matrix}\right]=[\begin{matrix}{^AR_{B}} & {-^AR_{B}[^BP_{A}]}\\ {0} & {^AR_{B}}\end{matrix}]\left[\begin{matrix}^B{n_{OB}}\\^B{f}\end{matrix}\right]

[ARBARB[BPA]0ARB]=[BRA0[BPA]BRABRA]T=BXAT[\begin{matrix}{^AR_{B}} & {-^AR_{B}[^BP_{A}]}\\ {0} & {^AR_{B}}\end{matrix}] = [\begin{matrix}{^BR_{A}} & {0}\\ {[^BP_{A}]{}^BR_{A}} & {^BR_{A}}\end{matrix}]^T = {}^BX_A{}^T

power: P=(AV)TAFP=\left({}^A\mathcal{V}\right)^T{}^A\mathcal{F}

V=S^θ˙\mathcal{V}={\hat{\mathcal{S}}}\dot{\theta}(S^\hat{\mathcal{S}}为screw axis of the joint)

并定义torque,τ=S^TF=FTS^\tau=\hat{\mathcal{S}}^T\mathcal{F}=\mathcal{F}^T\hat{\mathcal{S}}(由几何雅可比J(θ)=S(θ)J(\theta)=\mathcal{S}(\theta)可得τ=J(θ)^TF=FTJ(θ)^\tau=\hat{J(\theta)}^T\mathcal{F}=\mathcal{F}^T\hat{J(\theta)})

可得,P=VTF=(S^TF)θ˙τθ˙P=\mathcal{V}^T\mathcal{F}=(\hat{\mathcal{S}}^T\mathcal{F})\dot{\theta}\triangleq\tau\dot{\theta}

转动惯量Iˉ=Vρ(r)[r][r]Tdr\bar{I}=\int_V\rho(r)[r][r]^Tdr,特别地,对于原点恰在质心的情况,转动惯量为常量

对于线性动量(linear momentum),L=mvL=mv

可推得角动量(angluar momentum):ϕ=r×L=r×(mω×r)=m[r][r]ω=Iˉω\phi=r\times L=r\times(m\omega \times r)=m[r][-r]\omega =\bar{I}\omega

空间动量(spatial momentum):h[ϕnL]h\triangleq\left[\begin{array}{c}\phi_n\\L\end{array}\right]

空间动量坐标变换:Ah=AXBBh{}^Ah={}^AX_{{B}}^*{}^{{B}}h

同空间力的推导一样,也可以推导空间动量的导数: A[ddth]=ddt(Ah)+[AV×]h^A\left[\frac d{dt}h\right]=\frac d{dt}\left({}^Ah\right)+[^A\mathcal{V}\times^*]h

h=IV{h}={\mathcal{I}\mathcal{V}},其中I\mathcal{I}为空间惯量矩阵

对于frame C,如果原点恰为质心,则空间惯量CI=[cIˉc00mI3]{^C\mathcal{I}}=\left[\begin{array}{cc}{^c\bar{I}_c}&0\\0&{mI_3}\end{array}\right]

空间惯量坐标变换:AI=AXCCICXA{}^A\mathcal{I}={}^AX_C^*{}^C\mathcal{I}^CX_A

newton-euler方程

newton-euler方程: F=ddth=IA+V×IV\mathcal{F}=\frac d{dt}h=\mathcal{I}\mathcal{A}+\mathcal{V}\times^*\mathcal{I}\mathcal{V}

证明: oF=o(ddth)=ddt(oh)=ddt(oIoV)^o\mathcal{F}=^o(\frac d{dt}h)=\frac d{dt}(^oh)=\frac d{dt}(^o\mathcal{I}{}^o\mathcal{V}) =oI˙V+oIoA=^o{\dot{\mathcal{I}}}^{\circ}V+{}^o\mathcal{I}^{o}A =ddt(oXBBIBX0)oV+oIoA=\frac{d}{dt}(^oX_{B}^{*B}\mathcal{I}^{B}X_{0})^{o}V+^{o}I^{o}A

其中,ddt(oXBBIBX0)oV\frac{d}{dt}(^oX_{B}^{*B}\mathcal{I}^{B}X_{0})^{o}V =oXB˙BIBXooV+oXBBIBXo˙oV=^o\dot{X_{B}}^{*}{}^B \mathcal{I}{}^BX_o{}^{o}\mathcal{V}+^o{X_{B}}^{*}{}^B \mathcal{I}{}^B\dot{X_o}{}^{o}\mathcal{V}

由于oXBBXo=I^oX_{B}{}^{B}X_{o}=I(I为单位矩阵)

oXB˙BXo+oXBBXo˙=0^o\dot{X_{B}}{}^{B}X_{o}+^oX_{B}{}^{B}\dot{X_{o}}=0

因此有oXB˙=oXBBXo˙oXBB^o\dot{X_{B}}=-{}^oX_{B}{}^{B}\dot{X_{o}}{}^oX_{B}{}^{B}

因此ddt(oXBBIBX0)oV\frac{d}{dt}(^oX_{B}^{*B}\mathcal{I}^{B}X_{0})^{o}V

=[oVB×]oXBBIBXooVoXBBIBXo[oVB×]0V=\left[^oV_{B}\times^{*}\right]^oX_{B}^{*}{}^B \mathcal{I}{}^BX_o{}^{o}\mathcal{V}-{}^oX_{B}^{*}{}^B\mathcal{I} {}^BX_{o}[^o\mathcal{V}_{B}\times]^{0}\mathcal{V}

=[oVB×]oXBBIBXooV0=\left[^oV_{B}\times^{*}\right]^oX_{B}^{*}{}^B \mathcal{I}{}^BX_o{}^{o}\mathcal{V}-0

于是证得newton-euler方程

Recursive Newton-Euler:

Recursive Newton-Euler.png

拉格朗日方程

τ=M(θ)θ¨+c~(θ,θ˙)\boldsymbol{\tau}=M(\theta)\ddot{\theta}+\tilde{c}(\theta,\dot{\theta})

证明如下图: Lagrangian.png

参考

南科大高等机器人控制 课程官网

知乎: 控制门下一走狗

刚体运动与旋量入门


pybullet仿真与轨迹显示

使用多项式方式平滑轨迹

控制方式基于Raibert's formula

τhip=kp(ϕdesϕ)+kν(ϕ˙desp˙hi)\tau_{hip}=k_p(\phi_{des}-\phi)+k_\nu(\dot{\phi}_{des}-\dot{p}hi)

trajectory

trajectory-line


Profile picture

Written by Prosumer , an undergraduate student at ShanghaiTech.
Welcome to my GitHub:)