+ All Categories
Home > Documents > pid pure pursuit - courses.cs.washington.edu

pid pure pursuit - courses.cs.washington.edu

Date post: 18-Dec-2021
Category:
Upload: others
View: 1 times
Download: 0 times
Share this document with a friend
79
1 Sanjiban Choudhury PID and Pure Pursuit Control TAs: Matthew Rockett, Gilwoo Lee, Matt Schmittle
Transcript

1

Sanjiban Choudhury

PID and Pure Pursuit Control

TAs: Matthew Rockett, Gilwoo Lee, Matt Schmittle

The Control API

2

Input OutputControl

Law

The Control API

2

Input Output

x(⌧), y(⌧), ✓(⌧), v(⌧)

1. Reference path Control Law

The Control API

2

Input Output

x(⌧), y(⌧), ✓(⌧), v(⌧)

1. Reference path 2. Current state

2

4x

y

3

5

Control Law

The Control API

2

Input Output

x(⌧), y(⌧), ✓(⌧), v(⌧)

1. Reference path 2. Current state

2

4x

y

3

5

Control action

Control Law

Steps to designing a controller

3

1. Get a reference path / trajectory to track

2. Pick a point on the reference

3. Compute error to reference point

4. Compute control law to minimize error

Rough idea of what happens across timesteps

4

Robot is trying to track a desired state on the reference path

(Take an action to drive down error between desired and current state)

Rough idea of what happens across timesteps

4

Robot is trying to track a desired state on the reference path

(Take an action to drive down error between desired and current state)

Rough idea of what happens across timesteps

4

Robot is trying to track a desired state on the reference path

(Take an action to drive down error between desired and current state)

Rough idea of what happens across timesteps

4

Robot is trying to track a desired state on the reference path

(Take an action to drive down error between desired and current state)

Rough idea of what happens across timesteps

4

Robot is trying to track a desired state on the reference path

(Take an action to drive down error between desired and current state)

Rough idea of what happens across timesteps

4

Robot is trying to track a desired state on the reference path

(Take an action to drive down error between desired and current state)

Steps to designing a controller

5

1. Get a reference path / trajectory to track

2. Pick a point on the reference

3. Compute error to reference point

4. Compute control law to minimize error

Step 1: Get a reference path

6

x(⌧), y(⌧), ✓(⌧), v(⌧)

2

4x

y

3

5

Step 2: Pick a reference (desired) state

7

E.g. Pick nearest state / pick state L distance ahead

2

4xref

yref

✓ref

3

52

4x

y

3

5

Step 3: Compute error to this state

8

Error is simply the state of the car expressed in the frame of the reference (desired) state

2

4x

y

3

5

2

4eatect✓e

3

5

Step 3: Compute error to this state

9

2

4xref

yref

✓ref

3

52

4x

y

3

5

Step 3: Compute error to this state

9

2

4xref

yref

✓ref

3

52

4x

y

3

5

Step 3: Compute error to this state

9

2

4xref

yref

✓ref

3

52

4x

y

3

5

Step 3: Compute error to this state

9

2

4xref

yref

✓ref

3

52

4x

y

3

5

Step 3: Compute error to this state

10

Step 3: Compute error to this state

10

Step 3: Compute error to this state

11

A

Ae =

x

y

��

xref

yref

�Position in frame A

Step 3: Compute error to this state

12

AB

We want position in frame B

Be =BA R Ae

(rotation of A w.r.t B)

Step 3: Compute error to this state

12

AB

We want position in frame B

Be =BA R Ae

(rotation of A w.r.t B)

= R(�✓ref )

✓x

y

��xref

yref

�◆

(rotation of A w.r.t B)

Step 3: Compute error to this state

13

AB

We want position in frame B

Be =BA R Aee =

cos(✓ref ) sin(✓ref )

� sin(✓ref ) cos(✓ref )

�✓x

y

��

xref

yref

�◆eatect

�=

Step 3: Compute error to this state

14

AB

We heading in frame B

✓e = ✓ � ✓ref

Step 3: Compute error to this state

15

ect = � sin(✓ref )(x� xref ) + cos(✓ref )(y � yref )

eat = cos(✓ref )(x� xref ) + sin(✓ref )(y � yref )

{ eat {

ect

✓e = ✓ � ✓ref

✓e

(Along-track)

(Cross-track)

(Heading)

Some things to note

16

{ eat {

ect

✓e

1. We will only control steering angle; speed set to reference speed

2. Hence, no real control on along-track error. Ignore for now.

3. Some control laws will only minimize cross-track error, others both heading and cross-track error.

Step 4: Compute control law

17

errorcontrol

Compute control action based on instantaneous error

Different laws have different trade-offs, make different assumptions,

look at different errors

u = K(e)

Different control laws

18

1. PID control

2. Pure-pursuit control

3. Lyapunov control

4. LQR

5. MPC

19

Proportional–integral–derivative (PID) controller

Used widely in industrial control from 1900s Do not try this

with PID!!!Regulate temp, press, speed etc

PID control overview

20

ectu

Select a control law that tries to drive error to zero (and keep it there)

PID control overview

20

ectu

Select a control law that tries to drive error to zero (and keep it there)

Proportional Integral Derivative

u = �✓Kpect +Ki

Zect(t)dt+Kdect

(current) (past) (future)

Some intuition …

21

Proportional Integral Derivative

u = �✓Kpect +Ki

Zect(t)dt+Kdect

(current) (past) (future)

Proportional - get rid of the current error!

Integral - if I am accumulating error, try harder!

Derivative - if I am going to overshoot, slow down!

Proportional control

22

ect

u = �Kpect(Gain)

Proportional control

22

ect

u = �Kpect

ect < 0, u > 0

(Gain)

Proportional control

22

ect

u = �Kpect

ect < 0, u > 0

ect > 0, u < 0

(Gain)

The proportional gain matters!

23

ect

What happens when gain is low?

The proportional gain matters!

23

ect

What happens when gain is low?

The proportional gain matters!

23

ect

What happens when gain is low?

What happens when gain is high?

The proportional gain matters!

23

ect

What happens when gain is low?

What happens when gain is high?

Proportional term

24

What happens when gain is too high?

ect

� umax

Kp

Proportional term

24

What happens when gain is too high?

ect

� umax

Kp

Proportional derivative control

25

ect

u = � (Kpect +Kd ˙ect)

Proportional derivative control

25

ect

u = � (Kpect +Kd ˙ect)

Proportional derivative control

25

ect

u = � (Kpect +Kd ˙ect)

ect << 0, ect ⇡ 0, u >> 0

Proportional derivative control

25

ect

u = � (Kpect +Kd ˙ect)

ect << 0, ect ⇡ 0, u >> 0

ect < 0, ect > 0, u ⇡ 0

Proportional derivative control

25

ect

u = � (Kpect +Kd ˙ect)

ect << 0, ect ⇡ 0, u >> 0

ect < 0, ect > 0, u ⇡ 0

ect ⇡ 0, ect > 0, u < 0

How do you evaluate the derivative term?

26

How do you evaluate the derivative term?

26

Terrible way: Numerically differentiate error. Why is this a bad idea?

How do you evaluate the derivative term?

26

Terrible way: Numerically differentiate error. Why is this a bad idea?

Smart way: Analytically compute the derivative of the cross track error

How do you evaluate the derivative term?

26

Terrible way: Numerically differentiate error. Why is this a bad idea?

Smart way: Analytically compute the derivative of the cross track error

ect = � sin(✓ref )(x� xref ) + cos(✓ref )(y � yref )

How do you evaluate the derivative term?

26

Terrible way: Numerically differentiate error. Why is this a bad idea?

Smart way: Analytically compute the derivative of the cross track error

ect = � sin(✓ref )x+ cos(✓ref )y

= � sin(✓ref )V cos(✓) + cos(✓ref )V sin(✓)

= V sin(✓ � ✓ref ) = V sin(✓e)

ect = � sin(✓ref )(x� xref ) + cos(✓ref )(y � yref )

How do you evaluate the derivative term?

26

Terrible way: Numerically differentiate error. Why is this a bad idea?

Smart way: Analytically compute the derivative of the cross track error

ect = � sin(✓ref )x+ cos(✓ref )y

= � sin(✓ref )V cos(✓) + cos(✓ref )V sin(✓)

= V sin(✓ � ✓ref ) = V sin(✓e)

ect = � sin(✓ref )(x� xref ) + cos(✓ref )(y � yref )

u = � (Kpect +KdV sin ✓e)New control law! Penalize error in cross track and in heading

Proportional integral control

27

ect

u = �✓Kpect +Ki

Zect(t)dt

Proportional integral control

27

ect

u = �✓Kpect +Ki

Zect(t)dt

Only Proportional cannot overcome wind!

Proportional integral control

27

ect

u = �✓Kpect +Ki

Zect(t)dt

Only Proportional cannot overcome wind!

Zect(t)dt � 0, u � 0

Different control laws

28

1. PID control

2. Pure-pursuit control

3. Lyapunov control

4. LQR

5. MPC

29

Pure Pursuit Control

 Aerial combat in which aircraft pursues another aircraft by pointing its nose directly towards it

Similar to carrot on a stick!

30

Key Idea:

The car is always moving in a circular arc

31

L

Consider a reference at a lookahead distance

Problem: Can we solve for a steering angle that guarantees that the car will pass through the reference?

����

x

y

��xref

yref

����� = L

Solution: Compute a circular arc

32

We can always solve for a arc that passes through a lookahead point

Note: As the car moves forward, the point keeps moving

Pure pursuit: Keep chasing looakahead

33

1. Find a lookahead and compute arc

2. Move along the arc

3. Go to step 1

Pure pursuit: Keep chasing looakahead

33

1. Find a lookahead and compute arc

2. Move along the arc

3. Go to step 1

Pure pursuit: Keep chasing looakahead

33

1. Find a lookahead and compute arc

2. Move along the arc

3. Go to step 1

Pure pursuit: Keep chasing looakahead

33

1. Find a lookahead and compute arc

2. Move along the arc

3. Go to step 1

Pure pursuit: Keep chasing looakahead

33

1. Find a lookahead and compute arc

2. Move along the arc

3. Go to step 1

Pure pursuit: Keep chasing looakahead

33

1. Find a lookahead and compute arc

2. Move along the arc

3. Go to step 1

Pure pursuit: Keep chasing looakahead

33

1. Find a lookahead and compute arc

2. Move along the arc

3. Go to step 1

Control law derivation: Solve for arc

34

R

Control law derivation: Solve for arc

34

R

L

2

Control law derivation: Solve for arc

34

R

L

2

↵ = tan�1

✓yref � y

xref � x

◆� ✓

Control law derivation: Solve for arc

34

R

L

2

sin↵ =L

2R

↵ = tan�1

✓yref � y

xref � x

◆� ✓

Control law derivation: Solve for arc

34

R

L

2

sin↵ =L

2R

R =L

2 sin↵

↵ = tan�1

✓yref � y

xref � x

◆� ✓

35

u = tan�1

✓2B sin↵

L

Control law derivation

R

L

2

✓ =V

Btanu

w =V

R=

2V sin↵

L✓ = ! =

Question: How do I choose L?

36

Question: How do I choose L?

36

Question: How do I choose L?

36


Recommended