Lab3(a): PID Controller - ece545au20/catkin_ws GitHub Wiki

PID Controller

image-20201028102651019

Watch this video: PID For Driving

MIT PID

PID controller in Mushur Car.

Let’s use function get_rot function to generate roation matrix:

import numpy as np
"""
    rotation matrix in 2D
"""
def get_rot(theta):
    rot = np.array([[np.cos(theta),  -np.sin(theta)]
                    [np.sin(theta),   np.cos(theta)]])
    return rot

Notation Note: (2D case, only considering rotation about z axis)

  • Pose: P = [x, y, θ]
  • Pose of car B: PB = [xB, yB, θB]
  • Pose of car B w.r.t world frame: wPB = [wxB, wyB, wθB], or PwA.
  • Rotation matrix of car B w.r.t world frame: wRB = get_rot(wθB) =
| cos(theta) -sin(theta) |
| sin(theta)  cos(theta) |

(theta here means: wθB)

  • Rotation matrix of world frame w.r.t car B: BRw = wRB-1 = get_rot(-wθB) =
| cos(theta)  sin(theta) |
| -sin(theta) cos(theta) |
  • Translation of car B w.r.t world frame: wtB = [wxB, wyB]

  • Transformation matrix of car B w.r.t world frame:

    wTA = image-20201028123259512

    ​ =image-20201028123359446

Steps to designing a controller

  1. Given a planned trajectory T(t) to track(eg. when t = 1, T(1) = [x1, y1, θ1]), w.r.t world frame. Given the current pose of our mushur car A, [xA, yB, θA]

  2. Pick a specific reference point(Say it’s reference car B) on trajectory

  3. Compute error to reference point

    • Translation: Cross track error

    image-20201028110225343

    • Rotation: Heading angle error, simply θA - θref
  4. Compute control law to minimize error

image-20201028104911793

image-20201028105137355

image-20201028115615876

image-20201028123033543

image-20201028120336854

⚠️ **GitHub.com Fallback** ⚠️