博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
wentao的日记
阅读量:3907 次
发布时间:2019-05-23

本文共 6598 字,大约阅读时间需要 21 分钟。

WENTAO的日记

自动驾驶——控制部分

汽车横向动力学模型

d d t [ y y ˙ ϕ ϕ ˙ ] = [ 0 1 0 0 0 − 2 C α f + 2 C α r m V x 0 − V x − 2 C α f l f − 2 C α r l r m V x 0 0 0 1 0 − 2 C α f l f − 2 C α r l r I z V x 0 − 2 C α f l f 2 + 2 C α r l r 2 I z V x ] [ y y ˙ ϕ ϕ ˙ ] + [ 0 2 C α f m 0 2 C α f l f I z ] δ \frac{d}{dt}\begin{bmatrix} y \\ \dot y \\ \phi \\ \dot \phi \end{bmatrix} = \begin{bmatrix} 0 & 1 & 0 & 0 \\ 0 & -\frac{2C_{\alpha f}+2C_{\alpha r}}{m V_x} & 0 & -V_x-\frac{2C_{\alpha f}l_f-2C_{\alpha r}l_r}{m V_x} \\ 0 & 0 & 0 & 1 \\ 0 & -\frac{2C_{\alpha f}l_f-2C_{\alpha r}l_r}{I_z V_x} & 0 & -\frac{2C_{\alpha f}l_f^2+2C_{\alpha r}l_r^2}{I_z V_x} \end{bmatrix} \begin{bmatrix} y \\ \dot y \\ \phi \\ \dot \phi \end{bmatrix} + \begin{bmatrix} 0 \\ \frac{2C_{\alpha f}}{m} \\ 0 \\ \frac{2C_{\alpha f}l_f}{I_z}\end{bmatrix} \delta dtdyy˙ϕϕ˙=00001mVx2Cαf+2Cαr0IzVx2Cαflf2Cαrlr00000VxmVx2Cαflf2Cαrlr1IzVx2Cαflf2+2Cαrlr2yy˙ϕϕ˙+0m2Cαf0Iz2Cαflfδ

状态空间定义

车辆状态几何推导

s t a t e = [ l a t e r a l   e r r o r l a t e r a l   e r r o r   r a t e h e a d i n g   e r r o r h e a d i n g   e r r o r   r a t e s t a t i o n   e r r o r s p e e d   e r r o r ] state = \begin{bmatrix} lateral\ error \\ lateral\ error\ rate \\ heading\ error \\ heading\ error\ rate \\ station\ error \\ speed\ error\end{bmatrix} state=lateral errorlateral error rateheading errorheading error ratestation errorspeed error
D e s i r e   P o i n t 纵 向 方 向 : ( c o s θ d e s , s i n θ d e s ) D e s i r e   P o i n t 横 向 方 向 : ( − s i n θ d e s , c o s θ d e s ) Desire\ Point纵向方向:(cos\theta_{des}, sin\theta_{des}) \quad \quad Desire\ Point横向方向:(-sin\theta_{des}, cos\theta_{des}) Desire Point(cosθdes,sinθdes)Desire Point(sinθdes,cosθdes)
R e a l   P o i n t 坐 标 : ( x , y )     D e s i r e   P o i n t 坐 标 : ( x d e s , y d e s ) Real\ Point坐标:(x,y) \qquad \qquad \qquad \qquad \quad \ \ \ Desire\ Point坐标:(x_{des},y_{des}) Real Point(x,y)   Desire Point(xdes,ydes)
D e s i r e   P o i n t 指 向 R e a l   P o i n t 的 向 量 : ( d x , d y ) = ( x , y ) − ( x d e s , y d e s ) Desire\ Point指向Real\ Point的向量:(dx, dy) = (x,y) - (x_{des},y_{des}) Desire PointReal Point(dx,dy)=(x,y)(xdes,ydes)

l a t e r a l   e r r o r = ( d x , d y ) ∗ ( − s i n θ d e s , c o s θ d e s ) = d y   c o s θ d e s − d x   s i n θ d e s lateral\ error=(dx, dy)*(-sin\theta_{des}, cos\theta_{des})=dy\ cos\theta_{des}-dx\ sin\theta_{des} lateral error=(dx,dy)(sinθdes,cosθdes)=dy cosθdesdx sinθdes

l a t e r a l   e r r o r   r a t e = V ∗ s i n   ( ϕ − ϕ d e s ) lateral\ error\ rate=V*sin\ (\phi -\phi_{des}) lateral error rate=Vsin (ϕϕdes)
h e a d i n g   e r r o r = ϕ − ϕ d e s heading\ error=\phi -\phi_{des} heading error=ϕϕdes
h e a d i n g   e r r o r   r a t e = ϕ ˙ − ϕ ˙ d e s heading\ error\ rate=\dot \phi -\dot \phi_{des} heading error rate=ϕ˙ϕ˙des
s t a t i o n   e r r o r = − ( d x , d y ) ∗ ( c o s θ d e s , s i n θ d e s ) = − ( d x   c o s θ d e s + d y   s i n θ d e s ) station\ error=-(dx, dy)*(cos\theta_{des}, sin\theta_{des})=-(dx\ cos\theta_{des}+dy\ sin\theta_{des}) station error=(dx,dy)(cosθdes,sinθdes)=(dx cosθdes+dy sinθdes)
s p e e d   e r r o r = V d e s − V ∗ c o s ( △ ϕ ) / k speed\ error=V_{des}-V*cos( \triangle \phi)/k speed error=VdesVcos(ϕ)/k

方向盘模型

d d t [ e 1 e ˙ 1 e 2 e ˙ 2 ] = [ 0 1 0 0 0 − 2 C α f + 2 C α r m V x 2 C α f + 2 C α r m − 2 C α f l f + 2 C α r l r m V x 0 0 0 1 0 − 2 C α f l f − 2 C α r l r I z V x 2 C α f l f − 2 C α r l r I z − 2 C α f l f 2 + 2 C α r l r 2 I z V x ] [ e 1 e ˙ 1 e 2 e ˙ 2 ] + [ 0 2 C α f m 0 2 C α f l f I z ] δ + [ 0 − 2 C α f l f − 2 C α r l r m V x − V x 0 − 2 C α f l f 2 + 2 C α r l r 2 I z V x ] ϕ ˙ d e s + [ 0 0 0 1 ] ϕ ¨ d e s \frac{d}{dt}\begin{bmatrix} e_1 \\ \dot e_1 \\ e_2 \\ \dot e_2 \end{bmatrix} = \begin{bmatrix} 0 & 1 & 0 & 0 \\ 0 & -\frac{2C_{\alpha f}+2C_{\alpha r}}{m V_x} & \frac{2C_{\alpha f}+2C_{\alpha r}}{m} & -\frac{2C_{\alpha f}l_f+2C_{\alpha r}l_r}{m V_x} \\ 0 & 0 & 0 & 1 \\ 0 & -\frac{2C_{\alpha f}l_f-2C_{\alpha r}l_r}{I_z V_x} & \frac{2C_{\alpha f}l_f-2C_{\alpha r}l_r}{I_z} & -\frac{2C_{\alpha f}l_f^2+2C_{\alpha r}l_r^2}{I_z V_x} \end{bmatrix} \begin{bmatrix} e_1 \\ \dot e_1 \\ e_2 \\ \dot e_2 \end{bmatrix} + \begin{bmatrix} 0 \\ \frac{2C_{\alpha f}}{m} \\ 0 \\ \frac{2C_{\alpha f}l_f}{I_z}\end{bmatrix}\delta + \begin{bmatrix} 0 \\ -\frac{2C_{\alpha f}l_f-2C_{\alpha r}l_r}{m V_x}-V_x \\ 0 \\ -\frac{2C_{\alpha f}l_f^2+2C_{\alpha r}l_r^2}{I_z V_x}\end{bmatrix}\dot \phi_{des} + \begin{bmatrix} 0 \\ 0 \\ 0 \\ 1 \end{bmatrix} \ddot \phi_{des} dtde1e˙1e2e˙2=00001mVx2Cαf+2Cαr0IzVx2Cαflf2Cαrlr0m2Cαf+2Cαr0Iz2Cαflf2Cαrlr0mVx2Cαflf+2Cαrlr1IzVx2Cαflf2+2Cαrlr2e1e˙1e2e˙2+0m2Cαf0Iz2Cαflfδ+0mVx2Cαflf2CαrlrVx0IzVx2Cαflf2+2Cαrlr2ϕ˙des+0001ϕ¨des

Apollo LQR控制器原理

  • 微分方程: x ˙ = A 0 x + B 0 u \dot x=A_0x+B_0u x˙=A0x+B0u
  • 离散处理: x k + 1 = A x k + B u k x_{k+1}=Ax_k+Bu_k xk+1=Axk+Buk
  • 构建优化目标: J = ∑ k = 1 N ( X T Q X + u T R u ) J=\sum_{k=1}^N(X^TQX+u^TRu) J=k=1N(XTQX+uTRu)
  • 最优控制: u = − [ ( R + B T P B ) − 1 B T P A ] X = − K X u=-[(R+B^TPB)^{-1}B^TPA]X=-KX u=[(R+BTPB)1BTPA]X=KX
    其中: P = A T P A − A T P B ( R + B T P B ) − 1 B T P A + Q P=A^TPA-A^TPB(R+B^TPB)^{-1}B^TPA+Q P=ATPAATPB(R+BTPB)1BTPA+Q

注:LQR只能给出横向的控制

附录

1、latex中的希腊字母:

https://blog.csdn.net/xxzhangx/article/details/52778539

2、latex编写矩阵:

0 1 1 0 ( 0 − i i 0 ) [ 0 − 1 1 0 ] { 1 0 0 − 1 } ∣ a b c d ∣ ∥ i 0 0 − i ∥ \begin{gathered} \begin{matrix} 0 & 1 \\ 1 & 0 \end{matrix} \begin{pmatrix} 0 & -i \\ i & 0 \end{pmatrix} \begin{bmatrix} 0 & -1 \\ 1 & 0 \end{bmatrix} \begin{Bmatrix} 1 & 0 \\ 0 & -1 \end{Bmatrix} \begin{vmatrix} a & b \\ c & d \end{vmatrix} \begin{Vmatrix} i & 0 \\ 0 & -i \end{Vmatrix} \end{gathered} 0110(0ii0)[0110]{
1001}
acbdi00i
3、github下载repo中特定文件夹: http://kinolien.github.io/gitzip/#
4、typedef Matrix<double ,Dynamic,Dynamic > MatrixXd;
5、LQR求解原理: https://blog.csdn.net/datase/article/details/78487126
6、Frenet坐标变换:

  • https://blog.csdn.net/l898985121/article/details/109048855
  • https://blog.csdn.net/weixin_37395438/article/details/112973098?utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromMachineLearnPai2%7Edefault-1.control

7、LQR求解原理:https://blog.csdn.net/datase/article/details/78487126

C++ debug

1. override关键字:

Override是伪代码,所以是可写可不写的.它表示方法重写,写上会给我们带来好处.

  • 可以当注释用,方便阅读.
  • 告诉阅读你代码的人,这是方法的复写.
  • 编译器可以给你验证@Override下面的方法名是否是你父类中所有的,如果没有则报错

2. static 函数:

声明该函数的文件能用,其他文件不能用。

3. C++的三角函数:

C++中cos,sin,asin,acos这些三角函数操作的是弧度,而非角度,

你可能感兴趣的文章
Code Vs 1014 装箱
查看>>
循环队列,队链的实现
查看>>
HDU 2602 Bone Collector (01背包)
查看>>
POJ 1837 Blance (01背包)
查看>>
HDU 2456 饭卡 (01背包)
查看>>
HDU 1559 最大子矩阵
查看>>
Open Judge 4010 :2011
查看>>
百练OJ-2815 城堡问题【DFS】
查看>>
CODE[VS] 1025 选菜 【背包】
查看>>
POJ 1724 ROADS【DFS+剪枝】
查看>>
AOJ 847 整数拆段
查看>>
AOJ 848 分数拆分
查看>>
UVA 133 The Dole Queue 【约瑟夫环】
查看>>
XDOJ 1208 B.笑爷买房 【DFS】
查看>>
部门年度工作总结的内容
查看>>
pandas学习笔记
查看>>
Numpy笔记
查看>>
正则表达式
查看>>
python线程进程笔记
查看>>
TensorFlow初学者必须了解的55个经典案例
查看>>