Main Content

Lateral Control Tutorial

此示例显示了如何控制遵循计划路径的车辆时的车辆转向角度的转向角度Lateral Controller Stanley堵塞。

概述

Vehicle control is the final step in a navigation system and is typically accomplished using two independent controllers:

  • Lateral Controller:调整转向角,使车辆遵循参考路径。控制器最小化当前车辆位置与参考路径之间的距离。

  • Longitudinal Controller:在遵循参考路径时,通过控制节气门和制动器来保持所需的速度。控制器最小化车辆的标题角度与参考路径的方向之间的差。

此示例重点是在持续纵向速度方案中路径下文中的横向控制。在示例中,您将:

  1. Learn about the algorithm behind theLateral Controller Stanley堵塞。

  2. Create a driving scenario using theDriving Scenario Designer应用程序并生成一条参考路径供车辆遵循。

  3. 使用闭环Simulink®模型在场景中测试横向控制器。万博1manbetx

  4. 可视化场景和相关的仿真结果Bird's-Eye Scope

Lateral Controller

Stanley横向控制器[1]使用非线性控制定律,以最大程度地减少前轮相对于参考路径的前轮的横向轨道误差和前轮的标题。这Lateral Controller Stanley块计算转向角命令,该命令调整车辆的电流姿势以匹配参考姿势。

Depending on the vehicle model used in deriving the control law, the Lateral Controller Stanley block has two configurations [1]:

  • Kinematic bicycle model:运动学模型假设车辆可以忽略不计。这种配置主要适用于惯性效果最小的低速环境。转向命令是根据参考姿势,当前姿势和车辆速度计算的。

  • Dynamic bicycle model: The dynamic model includes inertia effects: tire slip and steering servo actuation. This more complicated, but more accurate, model allows the controller to handle realistic dynamics. In this configuration, the controller also requires the path curvature, the current yaw rate of the vehicle, and the current steering angle to compute the steering command.

您可以通过车辆型号parameter in the block dialog box.

Scenario Creation

该方案是使用Driving Scenario Designer应用程序。这种情况包括一条单车道和自我车辆。有关添加道路,车道和车辆的详细步骤,请参阅交互创建驾驶场景并生成合成传感器数据。在这种情况下,车辆:

  1. 从中间车道开始。

  2. Switches to the left lane after entering the curved part of the road.

  3. Changes back to the middle lane.

Throughout the simulation, the vehicle runs at a constant velocity of 10 meters/second. This scenario was exported from the app as a MATLAB® function using the导出>导出MATLAB功能按钮。导出功能命名HelpreatrivingsCenario。这roads and actors from this scenario were saved to the scenario file侧面control.mat

Model Setup

打开Simulin万博1manbetxk教程模型。

open_system('LateralControlTutorial'

该模型包含以下主要组件:

  • 一个Lateral Controller变体子系统,变体模型(万博1manbetxSimulink)which contains twoLateral Controller Stanleyblocks, one configured with a kinematic bicycle model and the other one with a dynamic bicycle model. They both can control the steering angle of the vehicle. You can specify the active one from the command line. For example, to select the Lateral Controller Stanley Kinematic block, use the following command:

变体=“侧面controltutorial/横向控制器”;set_param(变体,'LabelModeActivechoice',,,,'Kinematic');
  • 一个Helphathanalyzerblock, which provides the reference signal for the lateral controller. Given the current pose of the vehicle, it determines the reference pose by searching for the closest point to the vehicle on the reference path.

  • 一个Vehicle and Environmentsubsystem, which models the motion of the vehicle using aVehicle Body 3DOF(Vehicle Dynamics Blockset)堵塞。这subsystem also models the environment by using a方案阅读器封锁以阅读横向control.mat方案文件的道路和演员。

Opening the model also runs thehelperLateralControlTutorialSetup脚本,初始化模型使用的数据。该脚本加载了Simulink模型所需的某些常数,例如车辆参数,控制器参数,道路方案和参考姿势。万博1manbetx特别是,脚本调用先前导出的函数HelpreatrivingsCenarioto build the scenario. The script also sets up the buses required for the model by callinghelperCreateLaneSensorBuses

You can plot the road and the planned path using:

helpplotoardoadpath(场景,refpops)

Simulate Scenario

When simulating the model, you can open theBird's-Eye Scopeto analyze the simulation. After opening the scope, clickFind Signalsto set up the signals. Then run the simulation to display the vehicle, the road boundaries, and the lane markings. The image below shows the Bird's-Eye Scope for this example at 25 seconds. At this instant, the vehicle has switched to the left lane.

You can run the full simulation and explore the results using the following command:

sim('LateralControlTutorial');

您也可以使用Simulink®万博1manbetx范围(万博1manbetxSimulink)in theVehicle and Environmentsubsystem to inspect the performance of the controller as the vehicle follows the planned path. The scope shows the maximum deviation from the path is less than 0.3 meters and the largest steering angle magnitude is less than 3 degrees.

scope =“外侧controltorial/车辆和环境/范围”;open_system(范围)

为了减少转向命令中的横向偏差和振荡,请使用横向控制器Stanley动态块并再次模拟模型:

set_param(变体,'LabelModeActivechoice',,,,'Dynamic');sim('LateralControlTutorial');

结论

该示例显示了如何使用Simulink在车道更改场景中模拟车辆的横向控制。万博1manbetx与横向控制器Stanley运动学块相比,横向控制器Stanley动态块在路径中提供了改进的性能,随着参考路径的横向偏差较小。

References

[1] Hoffmann, Gabriel M., Claire J. Tomlin, Michael Montemerlo, and Sebastian Thrun. "Autonomous Automobile Trajectory Tracking for Off-Road Driving: Controller Design, Experimental Validation and Racing."一个merican Control Conference。2007, pp. 2296-2301.

万博1manbetx支持功能

HelperPlotRoad和Path绘制道路和参考路径

functionHelperPlotRoad和Path(scenario,refPoses)%helpplotoardoardath和Path的道路和参考路径h =图('Color',,,,'白色的');ax1 = axes(h,'盒子',,,,'上');
plot(scenario,'Parent',,,,ax1) holdonplot(ax1,refPoses(:,1),refPoses(:,2),'b')xlim([150,300])ylim([0 150])ax1.title = text(0.5,0.5,“道路和参考路径”);结尾

也可以看看

应用

Blocks

Related Topics