主要内容

lateralControllerStanley

Compute steering angle command for path following by using Stanley method

描述

example

引导=外侧controllerstanley(refpose,Currpose,咖喱)鉴于车辆的当前速度,计算以程度的转向角命令,该命令调节车辆的当前姿势以匹配参考姿势。默认情况下,该功能假设车辆正在向前运动。

The controller computes the steering angle command using the Stanley method[1], whose control law is based on a kinematic bicycle model. Use this controller for path following in low-speed environments, where inertial effects are minimal.

example

引导=外侧controllerstanley(refpose,Currpose,咖喱,名称,价值)specifies options using one or more name-value pairs. For example,侧面Concontrollerstanley(Refpose,Currpose,Currvelocity,“方向”, - 1)computes the steering angle command for a vehicle in reverse motion.

例子

全部收缩

Compute the steering angle command that adjusts the current pose of a vehicle to a reference pose along a driving path. The vehicle is in forward motion.

In this example, you compute a single steering angle command. In path-following algorithms, compute the steering angle continuously as the pose and velocity of the vehicle change.

在路径上设置参考姿势。姿势处于位置(4.8 m,6.5 m),其方向角为2度。

refpose = [4.8,6.5,2];% [meters, meters, degrees]

设置车辆的当前姿势。姿势处于位置(2 m,6.5 m),其方向角为0度。将车辆的当前速度设置为每秒2米。

curpose = [2,6.5,0];% [meters, meters, degrees]咖喱= 2;%米 /秒

Compute the steering angle command. For the vehicle to match the reference pose, the steering wheel must turn 2 degrees counterclockwise.

SteercMD =侧面controllerstanley(refpose,currpose,咖喱)
引导= 2.0000

Compute the steering angle command that adjusts the current pose of a vehicle to a reference pose along a driving path. The vehicle is in reverse motion.

In this example, you compute a single steering angle command. In path-following algorithms, compute the steering angle continuously as the pose and velocity of the vehicle change.

在路径上设置参考姿势。The pose is at position (5 m, 9 m) and has an orientation angle of 90 degrees.

refpose= [5, 9, 90];% [meters, meters, degrees]

设置车辆的当前姿势。The pose is at position (5 m, 10 m) and has an orientation angle of 75 degrees.

Currpose= [5, 10, 75];% [meters, meters, degrees]

将车辆的当前速度设置为–2米 /秒。由于车辆正在反向运动,因此速度必须为负。

Currvelocity = -2;%米 /秒

Compute the steering angle command. For the vehicle to match the reference pose, the steering wheel must turn 15 degrees clockwise.

SteercMD =侧面Concontrollerstanley(Refpose,Currpose,Currvelocity,'方向',-1)
SteercMD = -15.0000

输入参数

全部收缩

参考姿势,指定为[x,y,θ]矢量。xy在米中,θ是一级。

xy指定引导车辆朝向的参考点。θspecifies the orientation angle of the path at this reference point and is positive in the counterclockwise direction.

  • 对于向前运动的车辆,参考点是路径上最接近车辆前轴中心的路径上的点。

    Vehicle in forward motion with reference point on path marked. Units are in world coordinates.

  • 对于反向运动的车辆,参考点是路径最接近车辆后轴中心的路径上的点。

    反向运动的车辆在路径上带有参考点。单位在世界坐标中。

Data Types:single|双倍的

车辆的当前姿势,指定为[x,y,θ]矢量。xy在米中,θ是一级。

xy指定车辆的位置,该位置定义为车辆后桥的中心。

θspecifies the orientation angle of the vehicle at location (x,y) and is positive in the counterclockwise direction.

带有姿势的车辆。单位在世界坐标中。

有关车辆姿势的更多详细信息,请参阅Coordinate Systems in Automated Driving Toolbox.

Data Types:single|双倍的

当前的纵向速度of the vehicle, specified as a real scalar. Units are in meters per second.

  • If the vehicle is in forward motion, then this value must be greater than 0.

  • If the vehicle is in reverse motion, then this value must be less than 0.

  • 值为0表示不在运动的车辆。

Data Types:single|双倍的

Name-Value Arguments

将可选的参数对Name1=Value1,...,NameN=ValueN, 在哪里Nameis the argument name and价值是相应的值。名称值参数必须在其他参数之后出现,但是对的顺序并不重要。

Before R2021a, use commas to separate each name and value, and encloseNamein quotes.

例子:“ MaxSteeringAngle”,25

车辆的驾驶方向,指定为逗号分隔对'方向'两者1用于远期运动或-1用于反向运动。驱动方向确定用于计算转向角命令的位置误差和角度误差。有关更多详细信息,请参阅算法.

获得车辆的位置,specified as the comma-separated pair consisting of“位置”和一个积极的真实标量。该值确定位置误差影响转向角度的程度。典型值在[1,5]范围内。增加此值以增加转向角的大小。

车辆前轴和后轴之间的距离,分别为米,指定为逗号分隔对'Wheelbase'和a real scalar. This value applies only when the vehicle is in forward motion.

车辆的最大允许转向角度为程度,指定为逗号分隔对'MaxSteeringAngle'以及该范围内的真实标量(0,180)。

The引导值已饱和到范围[-maxSteeringAngle,MaxSteeringAngle].

  • 值以下- maxSteeringAngleare set to- maxSteeringAngle.

  • 价值s aboveMaxSteeringAngleare set toMaxSteeringAngle.

Output Arguments

全部收缩

转向角度命令,作为一个真正的标量返回。该值在逆时针方向上为正。

带有前轮的车辆转弯并标记转向角度

有关更多详细信息,请参阅Coordinate Systems in Automated Driving Toolbox.

算法

To compute the steering angle command, the controller minimizes the position error and the angle error of the current pose with respect to the reference pose. The driving direction of the vehicle determines these error values.

When the vehicle is in forward motion ('方向'名称配对是1):

  • The位置错误是从前桥的中心到路径上的参考点的横向距离。

  • The角度误差是前轮相对于参考路径的角度。

当车辆反向运动时('方向'名称配对是-1):

  • The位置错误is the lateral distance from the center of the rear axle to the reference point on the path.

  • The角度误差是后轮相对于参考路径的角度。

有关控制器如何最小化这些错误的详细信息,请参见[1].

参考

[1] Hoffmann,Gabriel M.,Claire J. Tomlin,Michael Montemerlo和Sebastian Thrun。“越野驾驶的自动驾驶汽车轨迹跟踪:控制器设计,实验验证和赛车。”美国控制会议. 2007, pp. 2296–2301. doi:10.1109/ACC.2007.4282788

Extended Capabilities

C/C ++代码生成
使用MATLAB®CODER™生成C和C ++代码。

Version History

Introduced in R2018b