Autoware.Auto
linear_tire.snippet.hpp
Go to the documentation of this file.
1 // Copyright 2019 Christopher Ho
2 //
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
8 //
9 // Unless required by applicable law or agreed to in writing, software
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef COMMON__MOTION_COMMON__SCRIPTS__AUTOGENERATION_CODE_SNIPPETS__LINEAR_TIRE_SNIPPET_HPP_ // NOLINT
16 #define COMMON__MOTION_COMMON__SCRIPTS__AUTOGENERATION_CODE_SNIPPETS__LINEAR_TIRE_SNIPPET_HPP_ // NOLINT
17 // For help on getting random weird models to work, see:
19 // and
21
22 // Note: Order of variable declaration specifies order in C-arrays
23 //
24 // Variables
25 //
26
27 DifferentialState x, y, yaw; // pose
28 DifferentialState u, v, omega; // velocities
29 DifferentialState delta; // wheel angle
30 DifferentialState ax; // acceleration
31 Control jx, delta_dot;
32
33 // Vehicle parameters
34 OnlineData L_f, L_r; // front, rear wheelbase length
35 OnlineData C_f, C_r; // front, rear cornering stiffness
36 OnlineData m, I; // mass, moment of inertia
37
38 //
39 // Differential algebraic equation
40 //
41
42 // Using the linear model due to LaValle:
43 // http://planning.cs.uiuc.edu/node695.html
44 // Intermediate variables
45 IntermediateState F_f = C_f * (((v + (L_f * omega)) / u) + delta);
46 IntermediateState F_r = C_r * ((v - (L_r * omega)) / u);
47
48 DifferentialEquation f;
49
50 // Easy stuff
51 f << dot(x) == ((u * cos(yaw)) - (v * sin(yaw)));
52 f << dot(y) == ((u * sin(yaw)) + (v * cos(yaw)));
53 f << dot(yaw) == omega;
54 f << dot(u) == ax;
55 f << dot(v) == ((-u * omega) + ((F_f + F_r) / m));
56 f << dot(omega) == (((L_f * F_f) - (L_r * F_r)) / I);
57 f << dot(delta) == delta_dot;
58 f << dot(ax) == jx;
59 #endif // COMMON__MOTION_COMMON__SCRIPTS__AUTOGENERATION_CODE_SNIPPETS__LINEAR_TIRE_SNIPPET_HPP_ // NOLINT
L_r
OnlineData L_r
Definition: linear_tire.snippet.hpp:34
I
OnlineData I
Definition: linear_tire.snippet.hpp:36
F_r
IntermediateState F_r
Definition: linear_tire.snippet.hpp:46
omega
DifferentialState omega
Definition: linear_tire.snippet.hpp:28
jx
Control jx
Definition: linear_tire.snippet.hpp:31
ax
DifferentialState ax
Definition: linear_tire.snippet.hpp:30
delta_dot
Control delta_dot
Definition: linear_tire.snippet.hpp:31
m
OnlineData m
Definition: linear_tire.snippet.hpp:36
f
DifferentialEquation f
Definition: linear_tire.snippet.hpp:48
C_r
OnlineData C_r
Definition: linear_tire.snippet.hpp:35
C_f
OnlineData C_f
Definition: linear_tire.snippet.hpp:35
u
DifferentialState u
Definition: linear_tire.snippet.hpp:28
L_f
OnlineData L_f
Definition: linear_tire.snippet.hpp:34
yaw
DifferentialState yaw
Definition: linear_tire.snippet.hpp:27
y
DifferentialState y
Definition: linear_tire.snippet.hpp:27
F_f
IntermediateState F_f
Definition: linear_tire.snippet.hpp:45
x
DifferentialState x
Definition: linear_tire.snippet.hpp:27
delta
DifferentialState delta
Definition: linear_tire.snippet.hpp:29
v
DifferentialState v
Definition: linear_tire.snippet.hpp:28