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

Control: Truck Backer-Upper

Statement of Problem
To back the truck to a loading bay, The truck should approach the bay at 90 degree angle

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Truck Backer-Upper

The truck is making a right turn in backing.


Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Truck Backer-Upper

Starting Zone

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Truck Backer-Upper


INPUT
Horizontal position Fuzzy Sets
Far left, left, center, right, far right
Far left left Center right Far right

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Truck Backer-Upper


INPUT
Truck Angle Fuzzy Sets
0, 60, 120, 180, 240, 300, 360

60 120 180 240 300 360

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Truck Backer-Upper


OUTPUT
Steering Angle Fuzzy Sets
Hard left, left, soft left, center, soft right, right, hard right

Hard L

Leftr

Soft L

center

Soft R

Right

Hard R

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Truck Backer-Upper

Truck backing rules

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Truck Backer-Upper


MATLAB Rule definition
A = table(1:5,1:7); C = [5; 6; 6; 7; 7;
3; 5; 6; 7; 7; 3; 3; 6; 6; 7; 2; 2; 4; 6; 6; 1; 2; 2; 5; 5; 1; 1; 2; 3; 3; 1; 1; 2; 2; 3;];
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Truck Backer-Upper


MATLAB
Z = group(xposS, xposG, angleS, angleG, SteeringS, SteeringG); S = [xpos; ypos; phi]; Theta = frule(A,C,Z, [S(1);S(3)]);

Note: frule calculates the steering angle based on the current values of the xpos and phi
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Simulating the Truck


Assumption: Truck travel at constant velocity V and truck length is L. State Variables: x,y, = horizontal coordinate/angle of the truck
= steering angle

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Simulating the Truck


Nonlinear equations describe the behavior of truck

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Simulating the Truck


function ds=trukmod(s,u) % s(1) =x, s(2)=y,s(3)=, u = L = 1; % Length of truck. (Distance between wheels.) v = 1; % Velocity of truck. % STATES pos = s(1) + sqrt(-1)*s(2); angle = s(3); % DERIVATIVES dpos = v*cos(u)*exp(j*(angle-pi/2)); dangle = v*sin(u)/L; ds = [real(dpos); imag(dpos); dangle];

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Simulating the Truck


% assume time step = 0.2 second dt = 0.2; For I=1:100 if rem(I,5) == 1 % Evaluate controller once a second % (5 time steps *0.2 seconds) theta = frule(A,C,Z,[s(1);s(3)]); end s = s + dt * truckmod (s,theta); end
Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Simulating the Controlled Truck


0 -10 -20 -30 -40 -50 -60 -70 -80 -90 -100 0 20 40 60 80 100

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Simulating the Controlled Truck


Horizontal Position Response 50 45 Horizontal Position (Meters) 40

35

30

25 20

15 0

10

20

30

40 50 60 Time (Seconds)

70

80

90

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Simulating the Controlled Truck


Vertical Position Response 10 0 -10 -20 -30 -40 -50 -60 -70

Vertical Position (Meters)

10

20

30

40 50 Time (Seconds)

60

70

80

90

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Simulating the Controlled Truck


Truck Angle Response 400 350

Truck Angle (Degrees)

300

250

200

150

100

50

10

20

30

40 50 Time (Seconds)

60

70

80

90

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Simulating the Controlled Truck


Steering Angle Response 10 5 0 -5 -10 -15 -20 -25 -30 0 Steering Angle (Degrees)

10

20

30

40 50 60 Time (Seconds)

70

80

90

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Improving the truck controller


Universe of Discourse for Horizontal Position 1 0.9 0.8 0.7 0.6
Grade

0.5 0.4 0.3 0.2 0.1 0 0 20 40 60 Horizontal Position in meters 80 100

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Improving the truck controller


0 -10 -20 -30 -40 -50 -60 -70 -80 -90 -100 0 20 40 60 80 100

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Improving the truck controller


Horizontal Position Response 55 50 Horizontal Position (Meters) 45 40 35 30 25 20 15 0

20

40

60 80 Time (Seconds)

100

120

140

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Improving the truck controller


Vertical Position Response 10 0 -10 Vertical Position (Meters) -20 -30 -40 -50 -60 -70 -80 0 20 40 60 80 Time (Seconds) 100 120 140

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Improving the truck controller


Truck Angle Response 400 350 300 Truck Angle (Degrees) 250 200 150 100 50 0 0

20

40

60 80 Time (Seconds)

100

120

140

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

Control: Improving the truck controller


Steering Angle Response 10 5 0 -5 -10 -15 -20 -25 -30

Steering Angle (Degrees)

20

40

60 80 Time (Seconds)

100

120

140

Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

You might also like