车辆运动学模型的线性化及其离散化

一、数学基础:泰勒展开

从一元函数的泰勒展开说起

一元函数在 x 0 x_0 x0处的泰勒展开表达式为:
f ( x ) = f ( x 0 ) + f ( x 0 ) ′ ( x − x 0 ) + 1 2 ! f ( x 0 ) ′ ′ ( x − x 0 ) + o n f(x) = f(x_0) + {f(x_0)}'(x - x_0) + \frac{1}{2!}{f(x_0)}''(x - x_0) + o^n f(x)=f(x0)+f(x0)(xx0)+2!1f(x0)(xx0)+on
那么同理,二元函数的泰勒展开为:
f ( x , y ) = f ( x 0 , y 0 ) + f x ′ ( x 0 , y 0 ) ( x − x 0 ) + f y ′ ( x 0 , y 0 ) ( y − y 0 ) + 1 2 ! f x x ′ ′ ( x 0 , y 0 ) ( x − x 0 ) 2 + 1 2 ! f y y ′ ′ ( x 0 , y 0 ) ( y − y 0 ) 2 + o n f(x,y) = f(x_0,y_0) + f_{x}^{'}(x_0,y_0)(x-x_0) + f_{y}^{'}(x_0,y_0)(y-y_0) + \frac{1}{2!}f_{xx}^{''}(x_0,y_0)(x-x_0)^2 + \frac{1}{2!}f_{yy}^{''}(x_0,y_0)(y-y_0)^2 + o^n f(x,y)=f(x0,y0)+fx(x0,y0)(xx0)+fy(x0,y0)(yy0)+2!1fxx(x0,y0)(xx0)2+2!1fyy(x0,y0)(yy0)2+on
多元函数呢?
f ( x 1 , x 2 , . . . , x n ) = f ( x 0 1 , x 0 2 , . . . x 0 n ) + ∑ i = 1 n f x i ′ ( x 0 1 , x 0 2 , . . . x 0 n ) ( x i − x 0 i ) + 1 2 ! ∑ i , j = 1 n f x i x j ′ ′ ( x 0 1 , x 0 2 , . . . x 0 n ) ( x i − x 0 i ) ( x j − x 0 j ) + o n f(x^1,x^2,...,x^n) = f(x_{0}^{1},x_{0}^{2},...x_{0}^{n}) + \sum_{i=1}^{n}f_{x^i}^{'}(x_{0}^{1},x_{0}^{2},...x_{0}^{n})(x^i - x_{0}^{i}) + \frac{1}{2!}\sum_{i,j=1}^{n}f_{x^ix^j}^{''}(x_{0}^{1},x_{0}^{2},...x_{0}^{n})(x^i - x_{0}^{i})(x^j - x_{0}^{j}) + o^n f(x1,x2,...,xn)=f(x01,x02,...x0n)+i=1nfxi(x01,x02,...x0n)(xix0i)+2!1i,j=1nfxixj(x01,x02,...x0n)(xix0i)(xjx0j)+on
把泰勒展开式写成矩阵的形式:
f ( X ) = f ( X 0 ) + [ ∇ f ( X 0 ) ] T [ X − X 0 ] + 1 2 ! [ X − X 0 ] T H [ X − X 0 ] + o n f(X) = f(X_0) +[\nabla f(X_0)]^T[X - X_0] + \frac{1}{2!}[X - X_0]^TH[X - X_0] + o^n f(X)=f(X0)+[f(X0)]T[XX0]+2!1[XX0]TH[XX0]+on

为方便后续讲解,上式中 X X X是一个列向量为 X = [ x 1 , x 2 , . . . x n ] T X = [x_1, x_2,...x_n ]^T X=[x1,x2,...xn]T

是不是感觉突然变成矩阵形式就开始有点紧张了,大可不必,只需要牢牢的记住 d Y / d X dY/dX dY/dX矩阵求导的本质就是Y中的每个元素对X中的每个元素进行求导。这里只讲 Y X YX YX拉伸,需要记住以下两个要点
要点1:标量不变,向量拉伸
要点2:前面横向拉,后面纵向拉。
注意:这两点在后面的会用到。

如果还是感觉有点模棱两可,可以参考这个视频,讲得很详细。

二、车辆运动学模型线性化

有了上面的铺垫,这里看一个车辆运动学模型线性化的例子。这里直接给出车辆的运动学模型:
[ x ˙ y ˙ φ ˙ ] = [ c o s φ s i n φ t a n δ l ] v \begin{bmatrix} \dot{x}\\ \dot{y}\\ \dot{\varphi} \end{bmatrix} = \begin{bmatrix} cos\varphi\\ sin\varphi\\ \frac{tan\delta}{l} \end{bmatrix}v x˙y˙φ˙=cosφsinφltanδv

对上式进行简化为 X ˙ = f ( X , u ) \dot{X} = f(X,u) X˙=f(X,u),其中 X = [ x , y , φ ] T X = [x, y, \varphi]^T X=[x,y,φ]T u = [ v , δ ] T u = [v,\delta]^T u=[v,δ]T
X ˙ = [ x ˙ y ˙ φ ˙ ] = [ c o s φ s i n φ t a n δ l ] v = [ f 1 f 2 f 3 ] = f ( X , u ) \dot{X} = \begin{bmatrix} \dot{x}\\ \dot{y}\\ \dot{\varphi} \end{bmatrix} = \begin{bmatrix} cos\varphi\\ sin\varphi\\ \frac{tan\delta}{l} \end{bmatrix}v = \begin{bmatrix} f_1\\ f_2\\ f_3 \end{bmatrix} = f(X,u) X˙=x˙y˙φ˙=cosφsinφltanδv=f1f2f3=f(X,u)

对上式在参考点 X r = [ x r , y r , φ r ] T X_r = [x_r, y_r, {\varphi}_r]^T Xr=[xr,yr,φr]T进行一阶泰勒展开,可以得到:
X ˙ = X r ˙ + [ f X ′ ( X r , u r ) ] T [ X − X r ] + [ f u ′ ( X r , u r ) ] T [ u − u r ] \dot{X} = \dot{X_r} +[ f_{X}^{'}(X_r,u_r) ]^T[X - X_r] + [f_{u}^{'}(X_r,u_r)]^T[u - u_r] X˙=Xr˙+[fX(Xr,ur)]T[XXr]+[fu(Xr,ur)]T[uur]

关键的步骤来了

根据要点2 Y Y Y横向拉伸,即把 f ( X , u ) f(X,u) f(X,u)横向拉成一个行向量,可以得到:
f X ′ ( X , u ) = [ ∂ f 1 ∂ X ∂ f 2 ∂ X ∂ f 3 ∂ X ] f_{X}^{'}(X,u) = \begin{bmatrix} \frac{\partial f_1}{\partial X} & \frac{\partial f_2}{\partial X} & \frac{\partial f_3}{\partial X} \end{bmatrix} fX(X,u)=[Xf1Xf2Xf3]

X X X纵向拉伸,即把 X X X拉伸为一个列向量, X X X已经是一个列向量。根据要点1,标量不变,向量拉伸, f 1 , f 2 , f 3 f_1,f_2,f_3 f1f2f3不变,把 X X X进行拉伸,可以得到:
f X ′ ( X , u ) = [ ∂ f 1 ∂ x ∂ f 2 ∂ x ∂ f 3 ∂ x ∂ f 1 ∂ y ∂ f 2 ∂ y ∂ f 3 ∂ y ∂ f 1 ∂ φ ∂ f 2 ∂ φ ∂ f 3 ∂ φ ] f_{X}^{'}(X,u) = \begin{bmatrix} \frac{\partial f_1}{\partial x} & \frac{\partial f_2}{\partial x} & \frac{\partial f_3}{\partial x} \\ \frac{\partial f_1}{\partial y} & \frac{\partial f_2}{\partial y} & \frac{\partial f_3}{\partial y} \\ \frac{\partial f_1}{\partial \varphi} & \frac{\partial f_2}{\partial \varphi} & \frac{\partial f_3}{\partial \varphi} \end{bmatrix} fX(X,u)=xf1yf1φf1xf2yf2φf2xf3yf3φf3

结合泰勒展开式写成矩阵的形式,注意转置:
f ( X ) = f ( X 0 ) + [ ∇ f ( X 0 ) ] T [ X − X 0 ] f(X) = f(X_0) +[\nabla f(X_0)]^T[X - X_0] f(X)=f(X0)+[f(X0)]T[XX0]
可以得到:
[ x ˙ y ˙ φ ˙ ] = [ x r ˙ y r ˙ φ r ˙ ] + [ ∂ f 1 ∂ x ∂ f 1 ∂ y ∂ f 1 ∂ φ ∂ f 2 ∂ x ∂ f 2 ∂ y ∂ f 2 ∂ φ ∂ f 3 ∂ x ∂ f 3 ∂ y ∂ f 3 ∂ φ ] [ x − x r y − y r φ − φ r ] + [ ∂ f 1 ∂ v ∂ f 1 ∂ δ ∂ f 2 ∂ v ∂ f 2 ∂ δ ∂ f 3 ∂ v ∂ f 3 ∂ δ ] [ v − v r δ − δ r ] \begin{bmatrix} \dot{x}\\ \dot{y}\\ \dot{\varphi} \end{bmatrix} = \begin{bmatrix} \dot{x_r}\\ \dot{y_r}\\ \dot{\varphi_r} \end{bmatrix} + \begin{bmatrix} \frac{\partial f_1}{\partial x} & \frac{\partial f_1}{\partial y} & \frac{\partial f_1}{\partial \varphi} \\ \frac{\partial f_2}{\partial x} & \frac{\partial f_2}{\partial y} & \frac{\partial f_2}{\partial \varphi} \\ \frac{\partial f_3}{\partial x} & \frac{\partial f_3}{\partial y} & \frac{\partial f_3}{\partial \varphi} \end{bmatrix} \begin{bmatrix} x-x_r \\ y-y_r \\ \varphi - \varphi_r \end{bmatrix} + \begin{bmatrix} \frac{\partial f_1}{\partial v} & \frac{\partial f_1}{\partial \delta} \\ \frac{\partial f_2}{\partial v} & \frac{\partial f_2}{\partial \delta} \\ \frac{\partial f_3}{\partial v} & \frac{\partial f_3}{\partial \delta} \end{bmatrix} \begin{bmatrix} v - v_r \\ \delta - \delta_r \end{bmatrix} x˙y˙φ˙=xr˙yr˙φr˙+xf1xf2xf3yf1yf2yf3φf1φf2φf3xxryyrφφr+vf1vf2vf3δf1δf2δf3[vvrδδr]
带入计算可得:
[ x ˙ y ˙ φ ˙ ] = [ x r ˙ y r ˙ φ r ˙ ] + [ 0 0 − v r s i n φ r 0 0 v r c o s φ r 0 0 0 ] [ x − x r y − y r φ − φ r ] + [ c o s φ r 0 s i n φ r 0 t a n δ r l v r l c o s 2 δ r ] [ v − v r δ − δ r ] \begin{bmatrix} \dot{x}\\ \dot{y}\\ \dot{\varphi} \end{bmatrix} = \begin{bmatrix} \dot{x_r}\\ \dot{y_r}\\ \dot{\varphi_r} \end{bmatrix} + \begin{bmatrix} 0 & 0 & -v_r sin{\varphi_r} \\ 0 & 0 & v_r cos{\varphi_r} \\ 0 & 0 & 0 \end{bmatrix} \begin{bmatrix} x-x_r \\ y-y_r \\ \varphi - \varphi_r \end{bmatrix} + \begin{bmatrix} cos{ \varphi_r} & 0 \\ sin{ \varphi_r} & 0 \\ \frac{tan{\delta_r}}{l} & \frac{v_r}{lcos^2{\delta_r}} \end{bmatrix} \begin{bmatrix} v - v_r \\ \delta - \delta_r \end{bmatrix} x˙y˙φ˙=xr˙yr˙φr˙+000000vrsinφrvrcosφr0xxryyrφφr+cosφrsinφrltanδr00lcos2δrvr[vvrδδr]
至此完成了车辆运动学模型的线性化,至于如何将该连续系统状态空间方程离散化,可以参看这篇拙作。

你可能感兴趣的:(车辆控制,机器人算法,矩阵)