Truck

download Truck

of 24

description

Truck simulation

Transcript of Truck

  • 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

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    The truck is making a right turn in backing.

  • Control: Truck Backer-Upper

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    Starting Zone

  • Control: Truck Backer-Upper

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    INPUT Horizontal position Fuzzy Sets

    Far left, left, center, right, far right

    Far left left

    Center

    right Far right

  • Control: Truck Backer-Upper

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    INPUT Truck Angle Fuzzy Sets

    0, 60, 120, 180, 240, 300, 360

    0 60 120 180 240 300 360

  • Control: Truck Backer-Upper

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    OUTPUT Steering Angle Fuzzy Sets

    Hard left, left, soft left, center, soft right, right, hard right

    centerSoft LLeftr Soft R RightHard L Hard R

  • Control: Truck Backer-Upper

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    Truck backing rules

  • Control: Truck Backer-Upper

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    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;];

  • Control: Truck Backer-Upper

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    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 anglebased on the current values of the xposand phi

  • Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

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

  • Control: Simulating the Truck

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    Nonlinear equationsdescribe the behavior

    of truck

  • Control: Simulating the Truck

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    function ds=trukmod(s,u) % s(1) =x, s(2)=y,s(3)= f, u = q

    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];

  • Control: Simulating the Truck

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    % assume time step = 0.2 seconddt = 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

  • Control: Simulating theControlled Truck

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    0 20 40 60 80 100-100

    -90

    -80

    -70

    -60

    -50

    -40

    -30

    -20

    -10

    0

  • Control: Simulating theControlled Truck

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    0 10 20 30 40 50 60 70 80 9015

    20

    25

    30

    35

    40

    45

    50Horizontal Position Response

    Time (Seconds)

    Hori

    zonta

    l Posi

    tion (

    Mete

    rs)

  • Control: Simulating theControlled Truck

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

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

    -60

    -50

    -40

    -30

    -20

    -10

    0

    10Vertical Position Response

    Time (Seconds)

    Vert

    ical P

    osi

    tion (M

    ete

    rs)

  • Control: Simulating theControlled Truck

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    0 10 20 30 40 50 60 70 80 9050

    100

    150

    200

    250

    300

    350

    400Truck Angle Response

    Time (Seconds)

    Tru

    ck A

    ngle

    (D

    egre

    es)

  • Control: Simulating theControlled Truck

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

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

    -25

    -20

    -15

    -10

    -5

    0

    5

    10Steering Angle Response

    Time (Seconds)

    Ste

    eri

    ng A

    ngle

    (D

    egre

    es)

  • Control: Improving the truckcontroller

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    0 20 40 60 80 100

    0

    0.1

    0.2

    0.3

    0.4

    0.5

    0.6

    0.7

    0.8

    0.9

    1

    Universe of Discourse for Horizontal Position

    Horizontal Position in meters

    Gra

    de

  • Control: Improving the truckcontroller

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    0 20 40 60 80 100-100

    -90

    -80

    -70

    -60

    -50

    -40

    -30

    -20

    -10

    0

  • Control: Improving the truckcontroller

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    0 20 40 60 80 100 120 14015

    20

    25

    30

    35

    40

    45

    50

    55Horizontal Position Response

    Time (Seconds)

    Hori

    zonta

    l Posi

    tion (M

    ete

    rs)

  • Control: Improving the truckcontroller

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    0 20 40 60 80 100 120 140-80

    -70

    -60

    -50

    -40

    -30

    -20

    -10

    0

    10Vertical Position Response

    Time (Seconds)

    Vert

    ical P

    osi

    tion (M

    ete

    rs)

  • Control: Improving the truckcontroller

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    0 20 40 60 80 100 120 1400

    50

    100

    150

    200

    250

    300

    350

    400Truck Angle Response

    Time (Seconds)

    Tru

    ck A

    ngle

    (D

    egre

    es)

  • Control: Improving the truckcontroller

    Fuzzy Systems ToolBox, Mark Beale and Howard Demuth

    0 20 40 60 80 100 120 140-30

    -25

    -20

    -15

    -10

    -5

    0

    5

    10Steering Angle Response

    Time (Seconds)

    Ste

    eri

    ng Angle

    (De

    gre

    es)