TuLiP: A Software Toolbox for Receding Horizon Temporal...

16
TuLiP: A Software Toolbox for Receding Horizon Temporal Logic Planning Nok Wongpiromsarn Singapore-MIT Alliance for Research and Technology Richard M. Murray and Ufuk Topcu California Institute of Technology EECI, 26 April 2012 Outline Key Features of TuLiP Embedded control software synthesis Receding horizon temporal logic planning Computer Lab

Transcript of TuLiP: A Software Toolbox for Receding Horizon Temporal...

Page 1: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

TuLiP: A Software Toolbox for Receding Horizon Temporal Logic Planning

Nok WongpiromsarnSingapore-MIT Alliance for Research and Technology

Richard M. Murray and Ufuk TopcuCalifornia Institute of Technology

EECI, 26 April 2012

Outline•Key Features of TuLiP

•Embedded control software synthesis•Receding horizon temporal logic planning

•Computer Lab

Monday, August 22, 2011

Page 2: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

TuLiP for receding horizon temporal logic planning

2

Hierarchical control architectureDifferent views

“short-horizonspecification”

“long-horizonspecification”

continuousdynamics&constraints

W0 ≺ . . . ≺WL−1 ≺WL

W0WL WL−1

min

� T

t0

L(x, u)dt

s.t. x = f(x, u)

g(x, u) ≤ 0

Multi-scale modelsAlice’s navigationstack

MissionPlanner

TrafficPlanner

PathPlanner

VehicleActuation

Inputs: •Models for evolution of discrete/continuous system states•Assumptions on (discrete) environment state

Outputs: • “Strategy” to be implemented in each layer

Page 3: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

Digital design synthesis (middle layer)

3

•TuLiP interfaces to a game solver in JTLV to solve discrete, two-player, GR[1] games

JTLV: Java-based framework for developing formal verification algorithms

ϕ =�

ψeinit����

assumptions oninitial condition

∧ �ψes ∧

i∈If

�♦ψef,i

� �� �assumptions onenvironment

�=⇒

�ψs

init ∧�ψss ∧

i∈Ig

�♦ψsg,i

� �� �desired

behavior

•prob = generateJTLVInput(env_vars, sys_disc_vars, spec, disc_props, disc_dynamics, smv_file, spc_file)

•realizability = checkRealizability(smv_file, spc_file, aut_file, heap_size)

•realizability = computeStrategy(smv_file, spc_file, aut_file, heap_size)•aut = Automaton(aut_file)

Page 4: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

System model: Robot can move to the cells which share a face with the current cell.

Desired Properties- Visit the blue cell infinitely often- Eventually go to the red cell when a

PARK signal is received

Assumption- Infinitely often, PARK signal is not

receivedϕ = �♦(¬park) =⇒ (�♦(s ∈ C5) ∧

�(park =⇒ ♦(s ∈ C0)))

4

Example: discrete synthesis using TuLiP

Link to the tutorial: http://goo.gl/uOH8Q

The specification is not a GR[1] formula- Introduce an auxiliary variable X0reach that starts with True- - �♦X0reach

�(�X0reach = ((s ∈ C0 ∨X0reach) ∧ ¬park))

Page 5: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

5

smv and spc files for robot_discrete_simple.pyspc

smvϕ = �♦(¬park) =⇒ (�♦(s ∈ C5) ∧

�(park =⇒ ♦(s ∈ C0)))

�(�X0reach = ((s ∈ C0 ∨X0reach) ∧ ¬park))�♦X0reach

Page 6: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

6

Results for robot_discrete_simple.pyaut file (partial)

ϕ = �♦(¬park) =⇒ (�♦(s ∈ C5) ∧�(park =⇒ ♦(s ∈ C0)))

�(�X0reach = ((s ∈ C0 ∨X0reach) ∧ ¬park))�♦X0reach

Sample simulation from grsim with inputs:• park signal • initial value of X0reach

Page 7: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

Interface the discrete planner and continuous controller

7

Use the finite-state abstraction procedure to write the problem in terms of the inputs to digital design synthesis

s ∈ Rn, U ⊆ Rm, D ⊆ Rp

s(t + 1) = As(t) + Bu(t) + Ed(t))u(t) ∈ U

d(t) ∈ D

Discreteplanner

Continuouscontroller

noiseu

sdδu

env

Continuous dynamics:

Main steps:•Partition the continuous state space

•Propositions shall preserve their meanings

•Establish transitions between the cells in the partition•Call the routines for digital design synthesis

Page 8: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

Finite transition system

Systemspec

Continuous State Space

Discretization

Systemmodel

Propositionpreserving partition

Continuous controller

Digital Design

Synthesis

Continuous State Space Partition

Discrete Planner

•Generate a proposition preserving partition of the continuous state space•cont_partition = prop2part2(state_space, cont_props)

•Discretize the continuous state space based on the evolution of the continuous state•disc_dynamics = discretizeM(cont_partition, ssys, N=10)

•Digital design synthesis: generateJTLVInput, checkRealizability, computeStrategy, Automaton,...

Workflow: discrete planner + continuous controller

8

Page 9: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

System model:

Desired Properties- Visit the blue cell infinitely often- Eventually go to the red cell when a

PARK signal is received

Assumption- Infinitely often, PARK signal is not

received

ϕ = �♦(¬park) =⇒ (�♦(s ∈ C5) ∧�(park =⇒ ♦(s ∈ C0)))

The specification is not a GR[1] formula- Introduce an auxiliary variable X0reach that starts with True- - �♦X0reach

�(�X0reach = ((s ∈ C0 ∨X0reach) ∧ ¬park))

9

Example: incorporating continuous dynamics

x = ux, y = uy where ux, uy ∈ [−1, 1] difference from the previous example

Link to the tutorial: http://goo.gl/6FsM0

Page 10: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

Defining a synthesis problem: SynthesisProb class

Useful methods:• checkRealizability(heap_size='-Xmx128m', pick_sys_init=True, verbose=0):

checks whether the problem is realizable• getCounterExamples(recompute=False, heap_size='-Xmx128m',

pick_sys_init=True, verbose=0) returns the set of initial states from which the system cannot satisfy the spec• synthesizePlannerAut(heap_size='-Xmx128m', priority_kind=3, init_option=1,

verbose=0) synthesizes the planner that ensures system correctness

10

Combine the three steps of digital design synthesis:

generateJTLVInputcomputeStrategy

Automaton

synthesizeSynthesisProb

Fields of SynthesisProb:• env_vars• sys_vars• spec• disc_cont_var• disc_dynamics

Link to an example: http://goo.gl/fNZxS

Page 11: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

Receding Horizon Framework for LTL Specifications

Idea: Reduce the synthesis problem to a set of smaller problems of short horizon

- Consider a specification of the form

ϕ =

ψinit ∧�ψee ∧

i∈If

� � ψef,i

=⇒�

i∈Is

�ψs,i ∧� � ψg

- Organize cells into a partially ordered set where is the set of “goal states,” i.e., all cells in satisfy

W0

W0 ψg

- describes receding horizon invariants- defines intermediate goal for

starting in - Partial order condition guarantees that we move closer

to goal

ΦF(Wj) ≺Wj ,∀j �= 0

Wj

- Assume that for each j, there exist a proposition and a mapping such that the following short-horizon specification is realizable

Φ F

Ψj =

(ς ∈Wj) ∧ Φ ∧�ψee ∧

k∈If

� � ψef,k

=⇒�

k∈Is

�ψs,k ∧� � (ς ∈ F(Wj)) ∧�Φ

F(W4) =W2,F(W3) =W1,F(W2) =W0,F(W1) =W0,F(W0) =W0

W0 ≺W1 ≺ . . . ≺W4

ν1ν2

ν3ν4

ν5

ν6

ν7

ν8ν9

ν10W0

W1

W2

W3

W4

!"#"$%&'()*+&")

!"#"$%&'()*+&")!"#!$%& !"#!$%&

P = ({Wj},�ψg )

Page 12: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

Key ElementsOriginal specification:

Short horizon specification:

• Partially ordered set

-

- is the set of “goal states,” i.e., all cells in satisfy

-

• Receding horizon invariant

- is a tautology

• Mapping

-

Wi0 ∪Wi

1 ∪ . . . ∪Wip = V

Wi0

Wi0 ψg,i

Wi0 ≺ψg,i Wi

j ,∀j �= 0

Pi = ({Wi0, . . . ,Wi

p},�ψg,i)

Φψinit =⇒ Φ

F i : {Wi0, . . . ,Wi

p}→ {Wi0, . . . ,Wi

p}F i(Wi

j) ≺ψg,i Wij ,∀j �= 0

ϕ =

ψinit ∧�ψee ∧

i∈If

� � ψef,i

=⇒

i∈Is

�ψs,i ∧�

i∈Ig

� � ψg,i

Wi1p

Wi1j1

Wi11

Wi10

Wi2p

Wi2j2

Wi21

Wi20

Wi3p

Wi3j3

Wi31

Wi30

Winp

Winjn

Win1

Win0

Ψij =

�ς ∈Wi

j

�∧ Φ ∧�ψe

e ∧�

k∈If

� � ψef,k

=⇒�

k∈Is

�ψs,k ∧� ��ς ∈ F i(Wi

j)�∧�Φ

12

Page 13: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

SynthesisProb

- system model

- system spec

ShortHorizonProb

-

-

-

Wj

Φj

RHTLPProb

- shprobs

- ΦF

ShortHorizonProb• A class for defining a short horizon problem• Useful methods

- computeLocalPhi(): automatically compute that makes this short horizon problem realizable.

RHTLPProb• A class for defining a receding horizon temporal logic planning problem• Contains a collection of short-horizon problems• Useful methods

- computePhi(): automatically compute for this receding horizon temporal logic planning problem if one exists.

- validate(): check whether all the sufficient conditions for doing receding horizon temporal logic planning are satisfied

Receding Horizon Temporal Logic Planning Problem

13

Φ

Φ

Page 14: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

Traffic rules•No collision•Stay in the travel lane unless there is an obstacle blocking the lane

Progress requirement•Reach the end of the road

Autonomous vehicle navigating an urban environment

Assumptions•Obstacle may not block a road•Obstacle is detected before the vehicle gets too close to it•Limited sensing range•Obstacle does not disappear when the vehicle is in its vicinity

RHTLP example

14

Link to an example: http://goo.gl/oyHvg

Page 15: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

Computer exercise 1

15

Desired Properties•Visit the blue cell (C8) infinitely often•Eventually go to the green cell (C0) when a PARK signal is received•Avoid an obstacle (red cell) which can be one of the C1, C4, C7 cells and can move arbitrarily

C0 C1 C2

C3 C4 C5

C6 C7 C8Synthesize a reactive planner with the following specifications

Constraints (or discrete dynamics)•The robot can only move to an adjacent cell, i.e., a cell that shares an edge with the current cell

Assumption• Infinitely often, PARK signal is not received•The obstacle always moves to an adjacent cell

Page 16: TuLiP: A Software Toolbox for Receding Horizon Temporal ...cds.caltech.edu/~murray/courses/afrl-sp12/C2_tulip-26Apr12.pdf · •Visit the blue cell (C8) infinitely often •Eventually

Synthesize intersection logic for the car with the following specification

Desired Properties- Eventually go to C6

- If there is a car at one of theC3, C4, C7 cells at initial state,need to wait until it disappearsbefore going through the intersection

- Go through the intersection only when C2 and C5 are clear- No collision with other cars

Assumption- ?? (find a set of “non-trivial” assumptions that render the problem realizable)

Constraint- The robot can only move forward to an adjacent cell, i.e., a cell that shares an

edge with the current cell

Computer exercise 2

16

C2 C5

C3

C1

C6

C4

C7