日本无码免费高清在线|成人日本在线观看高清|A级片免费视频操逼欧美|全裸美女搞黄色大片网站|免费成人a片视频|久久无码福利成人激情久久|国产视频一二国产在线v|av女主播在线观看|五月激情影音先锋|亚洲一区天堂av

  • 手機站
  • 小程序

    汽車測試網(wǎng)

  • 公眾號
    • 汽車測試網(wǎng)

    • 在線課堂

    • 電車測試

首頁 > 汽車技術 > 正文

基于MPC的設施保持系統(tǒng)設計

2022-01-08 11:45:13·  來源:智能運載裝備研究所  作者:杜志彬  
 
一、車輛動力學模型不同程度保持(LKA)算法將車輛的橫向動力進行解耦,在考慮橫向周期時,確定模型的速度為常態(tài),并基于模型自由度進行建模,在如下情況中控制
一、車輛動力學模型
不同程度保持(LKA)算法將車輛的橫向動力進行解耦,在考慮橫向周期時,確定模型的速度為常態(tài),并基于模型自由度進行建模, 如下情況中控制的應用,則車輛所呈現(xiàn)的狀態(tài)方程:




設置期望的橫擺角速度為rdes,構造增廣系統(tǒng)




為最后的 LKA 功能,利用其車載檢測檢測線信息,假設輸出 1 和 E2 分別為車輛檢測與設備中心線的偏差及側面檢測模型,則傳感器檢測模型


其中,rho為曲率半徑。將其寫入成狀態(tài)空間模型





將系統(tǒng)增廣可得新的狀態(tài)空間模型





MPC是一種離散量算法,因此,首先需要將其離散化,化驗可參考公眾號:文章二自由度動力學模型模型及其離散化應用,離散化后的系統(tǒng)為:



其中,Ak=A3*T+I,Bk=B4*T,其中,T=0.1s為時間。
二.MPC控制器設計
模型預測控制(MPC)包括三大部分,分別是模型預測、滾動優(yōu)化及反饋校正,關于MPC的詳細知識可參考公眾號文章:無人駕駛控制算法之MPC控制、基于二自由度模型的MPC在車輛橫向控制中的應用、模型預測控制系統(tǒng)總結。首先建立性能指標函數(shù):




考慮車輛的物理約束(硬約束),前輪轉角被限制在[-0.5,0.5] rad/s。由上述可得最終的MPC問題模型如下所示:



為了求解上述MPC問題,構造增廣的狀態(tài)向量為



則得到一個增廣的狀態(tài)空間模型



其中,系統(tǒng)矩陣為



則模型預測結果為


新的狀態(tài)空間方程的系統(tǒng)輸出量如下:


為了使得上述關系表述的更加明確,將系統(tǒng)未來時刻的輸出以矩陣的形式表達,具體如下:



其中,


在預測時域內(nèi)的狀態(tài)量和輸出量都可以通過系統(tǒng)當前的狀態(tài)量
和控制時域內(nèi)的狀態(tài)增量
計算得到,這也就是MPC中的預測功能的實現(xiàn)。
定義參考輸出向量為


,將其代入性能指標函數(shù),得:


其中最后三項為常數(shù),在優(yōu)化求解時可以忽略不計,則性能評價函數(shù)可以進一步表示為:






則性能指標函數(shù)可寫成如下形式


至此,MPC問題轉化為一個二次規(guī)劃問題。進而可以使用Matlab中提供的QP問題求解器quadprog進行求解,從而得到在控制時域內(nèi)的一系列控制輸入增量,具體表示如下:



將QP求解的最優(yōu)控制序列的第一個元素
作為實際的控制輸入增量作用于線控轉向系統(tǒng),即


系統(tǒng)執(zhí)行這一控制量直到下一時刻。在新的時刻,系統(tǒng)根據(jù)狀態(tài)信息重新預測下一段時域的輸出,通過優(yōu)化過程得到一個新的控制增量序列。如此將預測域和控制域依次向下一個時刻進行滾動優(yōu)化,如下圖所示。



三.程序概述
%% Lane Keeping Assist System Using Model Predictive Control
% This example shows how to use the block in
% Simulink(R) and demonstrates the control objectives and constraints of
% this block.
% Add example file folder to MATLAB(R) path.
addpath(fullfile(matlabroot,'examples','mpc','main'));
%% Lane Keeping Assist System
% A vehicle (ego car) equipped with a lane-keeping assist (LKA) system has
% a sensor, such as camera, that measures the lateral deviation and
% relative yaw angle between the centerline of a lane and the ego car. The
% sensor also measures the current lane curvature and curvature derivative.
% Depending on the curve length that the sensor can view, the curvature in
% front of the ego car can be calculated from the current curvature and
% curvature derivative.
%帶有LKA功能的車輛配備有傳感器,如攝像頭,用以測量本車與車道中心線的橫向偏差及相
%對橫擺角(偏航角)。該傳感器還可測量當前位置的曲率及曲率的變化率?;趥鞲衅骺?/span>
%視的車道范圍,位于本車前方的曲率可以通過當前位置的曲率及曲率變化率計算得到。
%%
% The LKA system keeps the ego car travelling along the centerline of the
% lanes on the road by adjusting the front steering angle of the ego car.
% The goal for lane keeping control is to drive both lateral deviation and
% relative yaw angle close to zero.
%通過調(diào)整本車的前輪轉角,LKA系統(tǒng)可以讓本車沿著車道中心線行駛。車道保持控制的目標
%是使得橫向偏差及偏航角趨近于零。
%% Simulink Model for Ego Car
% The dynamics for ego car are modeled in Simulink. Open the Simulink model.
mdl = 'mpcLKAsystem';
open_system(mdl)
% Define the sample time, |Ts|, and simulation duration, |T|, in seconds.
Ts = 0.1;
T = 15;
% To describe the lateral vehicle dynamics, this example uses a _bicycle
% model_ with the following parameters:
%為了描述車輛的橫向動力學特性,本算法使用了車輛的二自由度(單車)模型,具體參數(shù)
%如下所示:
% * |m| is the total vehicle mass (kg)
% * |Iz| is the yaw moment of inertia of the vehicle (mNs^2).
% * |lf| is the longitudinal distance from the center of gravity to the
% front tires (m).
% * |lr| is the longitudinal distance from center of gravity to the rear
% tires (m).
% * |Cf| is the cornering stiffness of the front tires (N/rad).
% * |Cr| is the cornering stiffness of the rear tires (N/rad).
m = 1575;
Iz = 2875;
lf = 1.2;
lr = 1.6;
Cf = 19000;
Cr = 33000;
% You can represent the lateral vehicle dynamics using a linear
% time-invariant (LTI) system with the following state, input, and output
% variables. The initial conditions for the state variables are assumed to
% be zero.
%車輛的橫向動力學特性可以使用LTI系統(tǒng)來表示,系統(tǒng)的狀態(tài)、輸入及輸出變量在上面有
%具體說明。狀態(tài)變量的初始條件假定為零。
% * State variables: Lateral velocity $V_y$ and yaw angle rate $r$
% * Input variable: Front steering angle $\delta$
% * Output variables: Same as state variables
%%
%狀態(tài)變量:橫向速度Vy、橫擺角速度r
%輸入變量:前輪轉角δ
%輸出變量:橫向速度Vy、橫擺角速度r
% In this example, the longitudinal vehicle dynamics are separated from the
% lateral vehicle dynamics. Therefore, the longitudinal velocity is assumed
% to be constant. In practice, the longitudinal velocity can vary and the
% Lane Keeping Assist System Block uses adaptive MPC to adjust the model of
% the lateral dynamics accordingly.
%在本算法中,將車輛縱向動力學與橫向動力學解耦。因此,縱向車速假定為常數(shù)。實際上
%來說,車輛的縱向速度是可以變化的,LKA系統(tǒng)模塊將使用自適應模型預測控制來相應得調(diào)
%整車輛的橫向動力學模型。
% Specify the longitudinal velocity in m/s.
Vx = 15;
%確定縱向車速的:Vx = 15m/s
% Specify a state-space model, |G(s)|, of the lateral vehicle dynamics.
A = [-(2*Cf+2*Cr)/m/Vx, -Vx-(2*Cf*lf-2*Cr*lr)/m/Vx;...
-(2*Cf*lf-2*Cr*lr)/Iz/Vx, -(2*Cf*lf^2+2*Cr*lr^2)/Iz/Vx];
B = [2*Cf/m, 2*Cf*lf/Iz]';
C = eye(2);
G = ss(A,B,C,0);
%% Sensor Dynamics and Curvature Previewer
% In this example, the Sensor Dynamics block outputs the lateral deviation
% and relative yaw angle. The dynamics for relative yaw angle are
% $$\dot{e}_2 = r-V_x\rho$, where $\rho$ denotes the curvature. The
% dynamics for lateral deviation are $\dot{e}_1 = V_x e_2+V_y$.
%傳感器動力學及曲率預瞄
%在本算法中,傳感器動力學模塊輸出橫向偏差e1及角度偏差(偏航角)e2。
%rho為曲率半徑。其中e1和e2滿足動力學方程




% The Curvature Previewer block outputs the previewed curvature with a
% look-ahead time one second. Therefore, given a sample time $Ts = 0.1$,
% the prediction horizon |10| steps. The curvature used in this example is
% calculated based on trajectories for a double lane change maneuver.
%曲率預瞄模塊輸出前視時間為1s的預測曲率。因此,給定的采樣時間為Ts=0.1,
%預測域為10步。本算法所使用的曲率是基于雙移線工況的軌跡計算所得。
% Specify the prediction horizon and obtain the previewed curvature.
PredictionHorizon = 10;
time = 0:0.1:15;
md = getCurvature(Vx,time);
%% Configuration of the Lane Keeping Assist System Block
% The LKA system is modeled in Simulink using the Lane Keeping Assist
% System block. The inputs to the LKA system block are:
% * Previewed curvature (from lane detections)
% * Ego longitudinal velocity
% * Lateral deviation (from lane detections)
% * Relative yaw angle (from lane detections)
%the Lane Keeping Assist System模塊的結構
%LKA系統(tǒng)在simulink中的建模是使用了the Lane Keeping Assist System block。該模塊的
%輸入如下:
%預瞄曲率、本車縱向速度、橫向偏差及相對橫擺角(偏航角)
% The output of the LKA system is the front steering angle of the ego car.
% Considering the physical limitations of the ego car, the steering angle
% is constrained to the range [-0.5,0.5] rad/s.
u_min = -0.5;
u_max = 0.5;
%該LKA系統(tǒng)的輸出是本車的前輪轉角??紤]到本車的物理約束(硬約束),前輪轉角被限制
%在[-0.5,0.5] rad/s。
% 對于這個例子,車道保持輔助的默認參數(shù)
% 系統(tǒng)塊匹配仿真參數(shù)。如果你的模擬
% 參數(shù)與默認值不同,然后更新塊
% 參數(shù)。
%對于本算法, 車道保持輔助系統(tǒng)模塊的默認參數(shù)即為仿真參數(shù)。如果你的
%仿真參數(shù)與默認值參數(shù),因此請相應地對相關進行更新。
%% 模擬分析
% 運行模型。
模擬(MDL)
% 繪制模擬結果。
mpcLKAplot(注銷)
% 橫向偏差和相對偏航角都收斂到零。
% 即ego汽車根據(jù)預覽圖緊跟道路
% 曲率。
% 從 MATLAB 路徑中刪除示例文件夾,并關閉 Simulink 模型。
rmpath(fullfile(matlabroot, 'examples' , 'mpc' , 'main' ));
bdclose(mdl) 
分享到:
 
反對 0 舉報 0 收藏 0 評論 0
滬ICP備11026917號-25