Lab3(a): PID Controller - ece545au20/catkin_ws GitHub Wiki
Watch this video: PID For Driving
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 =
=
-
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 carA
, [xA, yB, θA] -
Pick a specific reference point(Say it’s reference car
B
) on trajectory -
Compute error to reference point
- Translation: Cross track error
- Rotation: Heading angle error, simply θA - θref
-
Compute control law to minimize error