RO47017 HW03 Description

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

RO47017 Vehicle Dynamics & Control

Homework #3 – Due 07‐06‐2023

1) To use the provided template, you need to conduct the following actions:

 download acadotoolkit‐current‐stable.zip from Brightspace in Software folder


 follow these instructions to be sure that the ACADO is connected to your Matlab and functional
properly (the steps are copied from https://acado.github.io/matlab_overview.html):

ACADO & Compiler installation

Step 1 – Installing a compiler

a) Install Visual Studio 2017 Community

You can download it here:

https://docs.microsoft.com/en‐gb/visualstudio/releasenotes/vs2017‐relnotes

If you don’t have a Visual Studio Subscription, you can create one for free by clicking on “Create a
new Microsoft account” on the login page.

b) Check that you selected:

 Universal Windows Platform development


 Desktop development with C++

Note: it will require a large free space of your disk.

Step 2 – Configuring MATLAB

a) Once a compiler is installed it needs to be linked to MATLAB. Open MATLAB and run in
command window:

mex ‐setup
Note: Type this command and not copy‐paste!
MATLAB returns:
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n?
Type “y” and hit enter.

Step 3 – ACADO configuration

a) unzip the archive to the preferable folder. Note: a very long path of a folder can lead to some
issues. A shorter path is preferable.

b) Go to ACADO folder and run cd interfaces/matlab/

You are now ready to compile the ACADO interface. This compilation will take 10‐15 minutes but needs
to be done only once. Run the following command in your command window:

make clean all;

You will see:

Making ACADO...
and after a while when the compilation is finished:

ACADO successfully compiled.

Needed to compile XYZ file(s).

c) If you need to restart Matlab, run this make file again to set all paths or run savepath in your
console to save the current search path for future sessions.

ACADO has now been compiled. As the text indicated every time you restart MATLAB you need to run
“make” again to set all paths. When running “make” again no new files need to be compiled and the
process will only take a few seconds. However, it is easier to save your paths for future Matlab session.
Do so by running “savepath” in your command window (this step is optional).

savepath;

Step 4 ‐ Running ACADO demo example

cd examples/ocp/getting_started/

The file getting_started.m contains the ACADO syntax to setup and execute a simple Optimal Control
Problem. Run “getting_started” in your terminal to test the execution:

getting_started;

You should see a report similar to the following one:

1: KKT tolerance = 2.016e‐001 objective value = 6.4478e‐001


2: KKT tolerance = 2.074e+000 objective value = 4.3516e‐001
3: KKT tolerance = 1.484e‐001 objective value = ‐2.3787e+000
4: KKT tolerance = 9.130e‐002 objective value = ‐2.3441e+000
5: KKT tolerance = 1.035e‐001 objective value = ‐2.4338e+000
6: KKT tolerance = 5.587e‐002 objective value = ‐2.5326e+000
7: KKT tolerance = 2.741e‐002 objective value = ‐2.5766e+000
8: KKT tolerance = 1.839e‐002 objective value = ‐2.5959e+000
9: KKT tolerance = 1.543e‐002 objective value = ‐2.6105e+000
10: KKT tolerance = 1.494e‐002 objective value = ‐2.6258e+000
11: KKT tolerance = 5.624e‐003 objective value = ‐2.6404e+000
12: KKT tolerance = 1.584e‐004 objective value = ‐2.6456e+000
13: KKT tolerance = 1.214e‐008 objective value = ‐2.6456e+000
convergence achieved.
Assignment

Download the template from Brightspace and check that it is working. For this, you need to run the
file “HW03_template_run.m” to compile the solver. After this, you can open the Simulink file
“HW03_template.slx” and run it.

The implementation of template model describes the kinematic model representing by:
l 
  tan 1  r tan  
L 
u  0
u
  sin 
lr
x  u cos    
y  u sin    

2) Investigate the influence of weight tuning for lateral position and control input (default 5e‐3 and 1e‐
1 correspondingly) achieving better performance or MPC fails. Also, check how realistic is the steering
input from the controller (no chattering during the manoeuvre).
Note: The actual manoeuvre starts after 5s, therefore, the steering input chattering between 0 to 5
sec can be ignored.

3) Extend the controller plant model by implementing a bicycle model instead of a kinematic model
and add a constraint regarding steering rate.
Hints:
 Extra states are needed
 The control input will be steering rate d_delta and you need extra state equation:
 dot(delta) == d_delta

The linear bicycle model is described by:

x  t   Ax  t   Bu  t  , x  t0   x0
where A and B are matrices of appropriate dimensions describing LTI system of bicycle model with
constant speed.

4) Simulate both variants 2 and 3 and compare the tracking performance using RMS error for lateral
error and control input.

5) Comment on the behaviour of the controllers in terms of input demands and the tracking
performance and in terms of practical application.

6) Provide your self‐reflection regarding the learning elements and main challenges faced during the
controller design.

7) Prepare and upload via Brightspace the following files:


 a PDF report named “your family name_HW3” with the clear description of your answers (any
assumption that you made, block diagrams, equations, figures, and results analysis);
 the software realization itself with a well‐commented initialization file (it should be possible
to run the simulation and see the most important plots by simply executing a single script);
 Save your Simulink model in Matlab R2020b or below.

Grading policy:

 “Early bird submission”, 3 days in advance before the actual deadline: Bonus points (20% of
the final grade) will be provided.
 “Normal submission”, before the deadline: Regular assessment.
 “Delayed submission”, after the deadline: Reduction of the final grade by 20% for each day.

The report should contain the following elements:


‐ Title page
‐ Contents
‐ Introduction
‐ 1 Default MPC path‐follower
‐ 2 Designed MPC path‐follower
‐ 3 Comparison
‐ 4 Self reflection
‐ Conclusions
‐ References
‐ Appendix (e.g. Simulink block diagrams, vehicle parameters, etc.)

Note: deviation from the report structure may reflect on the grade.

You might also like