无人驾驶——模型预测算法MPC

Overall of the MPC

模型预测控制(Model Predictive Control)指一类算法,周期性基于当帧测量信息在线求解一个有限时间开环优化问题,并将结果的前部分控制序列作用于被控对象。根据所用模型不同,分为动态矩阵控制(DMC),模型算法控制(MAC)、广义预测控制(GPC)。在智能驾驶方向,重点在于基于状态空间模型的模型预测控制。

如下图,MPC控制器在智能驾驶的应用


MPC应用

如下为Udacity对于Model、Cost Function、Constraints的Setup


MPC Setup

如何得到最优解?
Udacity给出的方案是基于CppAD的ipopt控制器(第三方库)进行二次规划求解最优解。

Vehicel Models

Kinematic Models

Kinematic models are simplifications of dynamic models that ignore tire forces, gravity, and mass.

Dynamic Models

Dynamic models aim to embody the actual vehicle dynamics as closely as possible. They might encompass tire forces, longitudinal and lateral forces, inertia, gravity, air resistance, drag, mass, and the geometry of the vehicle.
Vehicle Model

各State的解释如下
Explanation of x y psi v

关于CTE(车道偏离)和eψ(横摆角偏离)的解释如下:
Cross Track Error
Orientation Error

More Studying:
Dynamic Model Forces
Tire Slip Angle滑移角: Alpha = arctan(wheel lateral velocity / wheel longitudinal velocity)
Tire Slip Ratio滑移率: s = Radius of Wheel * Angular Velocity / Longitudinal Velocity
Tire Models

Additional resources: Kinematic and Dynamic Vehicle Models for Autonomous Driving Control Design presents a comparison between a kinematic and dynamic model.

Cost Function

包括CTE(车道偏离)和eψ(横摆角偏离)等。
我认为实际应用过程中,可以根据规划trajectory符合度和平顺性等评估,包括车速偏离、碰撞cost、纵向加速度、横向加速度、向心加速度等。

Constraints

包括Acceleration加速度和Yaw Rate横摆角加速度的极限约束。

Length and Duration 预测Step数和步长

MPC预测的control inputs [δ,a]仅限于一定范围的时间,包括N = Number of Timesteps 和 dt = Timestep Duration。
期望N越大越好,dt越小越好。

Latency系统执行延迟

In a real car, an actuation command won't execute instantly - there will be a delay as the command propagates through the system. A realistic delay might be on the order of 100 milliseconds.

This is a problem called "latency", and it's a difficult challenge for some controllers - like a PID controller - to overcome. But a Model Predictive Controller can adapt quite well because we can model this latency in the system.

最优解求解器

以上阐述了智驾MPC应用的整体思路和架构。但是到算法层面,如何得到最优解是最核心的。当然对于工程应用,可以选择第三方最优化求解器,当前这是一个非线性规划问题

Ipopt

关于Cppad::ipopt算法核心可见Interior Point OPTimizer 内点法
Ipopt is the tool we'll be using to optimize the control inputs [δ1​,a1​,…,δN−1​,aN−1​]. It's able to find locally optimal values (non-linear problem!) while keeping the constraints set directly to the actuators and the constraints defined by the vehicle model. Ipopt requires we give it the jacobians and hessians directly - it does not compute them for us. Hence, we need to either manually compute them or have a library do this for us. Luckily, there is a library called CppAD which does exactly this.

CppAD

CppAD is a library we'll use for automatic differentiation. By using CppAD we don't have to manually compute derivatives, which is tedious and prone to error.
Given a C++ algorithm that computes function values, CppAD generates an algorithm that computes corresponding derivative values (of arbitrary order using either forward or reverse mode).
我把CppAD理解为基于Ipopt的应用。

More Learning:
Use Ipopt to Solve a Nonlinear Programming Problem
Nonlinear Programming Using CppAD and Ipopt: Example and Test
IPOPT和CppAD简介

参考文献:
1.Udacity无人驾驶课程
2.https://blog.csdn.net/qq_42258099/article/details/95353986

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 157,298评论 4 360
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 66,701评论 1 290
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 107,078评论 0 237
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 43,687评论 0 202
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 52,018评论 3 286
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 40,410评论 1 211
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 31,729评论 2 310
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 30,412评论 0 194
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 34,124评论 1 239
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 30,379评论 2 242
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 31,903评论 1 257
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 28,268评论 2 251
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 32,894评论 3 233
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 26,014评论 0 8
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 26,770评论 0 192
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 35,435评论 2 269
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 35,312评论 2 260