-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vehicle_Kin_Cloning.m
48 lines (40 loc) · 1017 Bytes
/
Vehicle_Kin_Cloning.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
%% State declaration
syms x %x-coordinate
syms y %y-coordinate
syms psi %yaw
syms x_s %
syms y_s %stationary copy
syms psi_s %
X=[x;y;psi;x_s;y_s;psi_s];
Xs=[0;0;0;0;0;0];
N=length(X);
%% Input declaration
syms V_n %Normal Speed
syms V_e %Lateral Speed
syms psi_dot %Steering angle
U=[V_n;V_e;psi_dot];
Us=[1;5000;0];
%% Parameter declaration
m=1292.2; %Vehicle mass
I=2380.7; %Vehicle inertia
a=1.006; %CG to front axle
b=1.534; %CG to rear axle
h=0.3; %CG to ground
g=9.81; %gravity
mu=0.85; %friction coeff
c=20000; %cornering stiffness
p=[m I a b h g mu c].';
syms m I a b h g mu c
P=[m I a b h g mu c].';
%% ODE definition
F= [V_n*cos(psi)-V_e*sin(psi);
V_n*sin(psi)+V_e*cos(psi);
psi_dot;
0;
0;
0
]; %a=lf, b=lr
h=[ cos(psi_s)*(x - x_s) + sin(psi_s)*(y - y_s);
-sin(psi_s)*(x - x_s) + cos(psi_s)*(y - y_s);
psi - psi_s];
generate_c_functions;