来自系列:了解模型预测控制
Mathworks Melda Ulusoy
了解如何使用模型预测控制工具箱™设计用于自动车辆转向系统的MPC控制器。
此视频浏览MPC控制器的设计过程。使用带有型号预测控制工具箱的MPC设计器应用程序,您可以指定MPC设计参数,如控制器采样时间,预测和控制视野,以及约束和权重。然后,您可以微调控制器并评估其性能。对于在此视频中演示的自主转向车辆示例,使用驱动场景设计器应用程序创建自定义参考轨迹,该应用程序是自动化驾驶工具箱™的一部分。
查看这个参考例示例有关横向车辆动力学和MPC控制设计的更多信息。
在此视频中,我们将使用MPC Designer应用程序设计MPC控制器,可在车道更换机动方案中自主操纵汽车。让我们首先查看这个系统的参数。汽车的全局位置是关于x和y轴表示的。这些向量显示了汽车的纵向和横向速度。在这个控制问题中,我们希望汽车遵循参考轨迹。因此,我们需要控制的是横向位置和偏航角。我们将通过调整转向角来这样做。相对于水平轴计算横向位置和横摆角的参考值。在该示例中,我们假设恒定的纵向速度为15米/秒,并使用表示横向车辆动态的线性化汽车模型。有关更多信息,请查看视频描述中给出的链接,将您带到此模型预测控制工具箱示例。
让我们切换到Simulink以构万博1manbetx建自主转向控制系统。这是我们想要构建的标准MPC控制图。我们首先将工厂添加到我们的模型中。在这里,我有一个自定义库,其中包括先前创建的块。该工厂是其中之一,并且已成为代表横向车辆动态的状态空间模型。工厂的输入是转向角,两个输出是横向位置和横摆角。现在,我们将在模型预测控制工具箱下连接MPC控制器。该块的第一个输入是测量的输出。所以,我们在这里连接输出。第二个输入是参考。 In this example, we want to simulate a car changing lanes. To create a custom reference trajectory for such a scenario, I’m going to use the Driving Scenario Designer that is part of Automated Driving Toolbox. Using this app, I create a road with two lanes that are 4 meters wide, then add a car and add waypoints to generate the lane-change maneuver. You can adjust the waypoints manually from the side panel if needed. The car’s speed is set to 15 m/s. If I now simulate this scenario step by step, the app shows me how the yaw angle changes. I exported this scenario as a MATLAB function and created a block that outputs the reference lateral position and yaw angle values. I add this custom reference to my model and connect it to the controller. Here, we assume there are no measured disturbances, so we’ll remove the third input. Now that we connected all system components, we’ll continue designing the MPC controller. For this, we open the MPC block and click on “Design,” which opens up the MPC Designer. The MPC Designer is an interactive tool that lets you design MPC controllers and is shipped as part of Model Predictive Control Toolbox. Remember in the previous videos we talked about MPC design parameters such as sample time, prediction and control horizons, and constraints and weights. You can specify all these parameters in the MPC Designer, tune the controller, and then evaluate the controller’s performance. Now, we’ll go back to the MPC Designer and start by defining the MPC structure. We’ll enter the number of manipulated variables and measured outputs, and set the controller sample time to 0.1s. Then we click “define and linearize.” Remember that MPC uses an internal plant model to make predictions and an optimizer to find the optimal control action. Now, when we click “define and linearize,” the app imports and linearizes the plant from the Simulink model and uses it as the internal plant model. It also runs the default simulation scenario and displays the input and output responses. Next, we click on the I/O Attributes to type in the signal labels and units. Note that if these signals differ too much in magnitude, for example, say one is around 1 and the other one is around 1000, then you can use scale factors to bring them to similar scale. We’ll keep the default values for this example as the magnitude difference is not too much. Next, we’ll edit the default scenario. We can choose different types of reference signals from these options. The closest to our lane change scenario would be a ramp input for the lateral position reference and a constant reference of zero for the yaw angle to minimize it. We click OK and this updates the responses. Next, we’ll switch to the tuning tab where we can specify MPC design parameters. These are the default values for prediction and control horizons. Let’s see how the system behavior changes for a larger prediction horizon. For 15 and 20, the response looks more sluggish, so we will set it back to 10. Next, we’ll play with the control horizon. Increasing it to 3 provides a better control of the lateral position. If we increase it further, it doesn’t affect the response significantly, so we settle on a control horizon of 3.
接下来,我们将设置约束。输入约束由车辆的物理限制决定。在此示例中,我们假设转向可以最多30度,因此我们将输入PI / 6 Radians进行输入约束。而对于驾驶员舒适,我们将将转向角的变化率限制为15度/秒。请注意,默认情况下,所有输入约束都很难且输出约束柔软。我们将尝试在这些值之间保持输出。接下来,我们将指定权重。如果我们希望输入和输出有一个目标,我们需要将权重设置为非零值。对于转向角度,我们将保持默认重量为零,因为它不需要跟踪目标。我们还将保留输入速率的默认重量。 You can increase this weight if you want to have even smaller input increments. And for the outputs, we’ll set the weight for the lateral position to 1 and the yaw angle weight to 0.1, as position tracking is our primary objective. After setting all these parameters, you can fine tune your controller by using this slider. We’ll slide it right for a more aggressive control. And the response looks good.
现在我们对控制器性能感到满意,我们点击“导出控制器”,这更新了MPC控制器块并运行模拟。请注意,在我们的Simulink模万博1manbetx型中,我们使用之前为车道更改方案设计的自定义引用。现在我们可以看看模拟结果。对于两个输出,我们会得到满意的跟踪。并且转向角保持在控制器的极限范围内。
在此视频中,我们已经走过了MPC控制器的设计过程,但是让我也提到2018年发布中,有一个车道保持辅助系统块,有效简化了设计过程。查看视频描述中的链接,以了解更多信息。
我们展示设计的控制器表现良好,但请注意,我们使用的汽车动力学用于特定的操作条件,这是我们的纵向速度为15米/秒。然而,如果汽车的纵向速度随着传播而变化,则汽车的动态也会改变。因此,如果我们现在将速度更改为35米/秒,这将导致控制器降级。为了解决此问题,我们需要设计一个适度的MPC控制器,它将更新内部工厂模型以改变操作条件。这就是我们将在下一个视频中讨论的内容。
您还可以从以下列表中选择一个网站:
选择中国网站(以中文或英文)以获取最佳网站性能。其他MathWorks国家网站未优化您的位置。