Chapter IV: Directive-response Assume-guarantee Contracts for an Auto-
4.4 AVP Contracts
Table 4.4: Trackerdirective-response system.
Interval variables/constantsvarπ
πΏ Corridor map.
πmin, π ππ Minimum safety distance to other cars.
πmin, π ππ ππ π Minimum safety distance to pedestrians.
Outputsvarπ
TrackerβPlanner An output channel of type ΛB(Tracker).
TrackerβCustomerInterface An output channel of type ΛA(Tracker).
Inputsvarπ
TrackerβPlanner An input channel of type ΛA(Planner).
Constraintsconπ
Corridor constraints In our implementation, we define theπΏ-corridor for any pathπto be the open set containing points whose distance to the closest point inπdoes not exceed 3 meters.
πmin, π ππ,πmin, π ππ ππ π These values are determined based on the dynamics and the uncertaintyΞπΆ ππ.
l Figure 4.2: Contracts between the components of the AVP system.
Tracker
A Tracker system is responsible for the safe control of cars that are accepted into the garage by a Supervisor. It receives directives from a Planner consisting of executable paths to track and send responses based on the task status to aPlanner.
See Table 4.4.
Contract 1(CCustomerInterface). The following is the contract for theCustomerInter- face.
β’ Assumes
β If theCustomerInterfacesends a request to theSupervisor, then they will receive a response from theSupervisor:
βπ βC:: ( [π, π] βsendCustomerInterfaceβSupervisor {
βπ βB(Supervisor) ::[π , π] βreceiveCustomerInterfaceβSupervisor).
(4.10)
β If the car is healthy and accepted by the garage, it will be returned after being summoned:
βπβC:: (β₯0(π .πππ . βπ ππ π‘ β π¦)
β§( [Accepted, π] βreceiveCustomerInterfaceβSupervisorβ§ [Retrieve, π] βsendCustomerInterfaceβSupervisor) { [Returned, π] βreceiveCustomerInterfaceβSupervisor).
(4.11)
β’ Guarantees
β When the request is accepted, theCustomerInterfaceshould not tamper with the car controls until the car is returned (i.e., control signals should match the directive) :
βπβC::βπ‘::β(π£ , π) βI::
( [Accepted, π] βreceiveCustomerInterfaceβSupervisor(π‘)
β§Β¬( [Returned, π] βreceiveCustomerInterfaceβSupervisor(π‘)) β ( [(π£ , π), π] βreceiveCustomerInterfaceβTracker(π‘)
β§βπ‘0 < π‘:: [(π£ , π), π] βreceiveCustomerInterfaceβTracker(π‘0) β π .ππππ‘π ππ π .π£(π‘) =π£β§π .ππππ‘π ππ π . π(π‘) =π)).
(4.12)
β When the CustomerInterface is not receiving any new input signal, then it keeps the control inputs at zero:
βπ βC::βπ‘::
( [Accepted, π] βreceiveCustomerInterfaceβSupervisor(π‘)
β§Β¬( [Returned, π] βreceiveCustomerInterfaceβSupervisor(π‘)) β (β(π£ , π) βI::[(π£ , π), π] βreceiveCustomerInterfaceβTracker(π‘)
β βπ‘0 < π‘:: [(π£ , π), π] βreceiveCustomerInterfaceβTracker(π‘0)) β π .ππππ‘π ππ π .π£(π‘) =0β§π .ππππ‘π ππ π . π(π‘) =0))).
(4.13)
β From sending a request until receiving a response, the car must stay in the deposit area:
βπβC::β₯0( [Park, π] βsendCustomerInterfaceβSupervisor
β§[Accepted, π] βreceiveCustomerInterfaceβSupervisor
β§[Rejected, π] βreceiveCustomerInterfaceβSupervisor
βπ .πππ .π π‘ ππ‘ πβG.πππ‘π π¦_πππ π πππ’π ππ‘π πππ ).
(4.14)
β After the car is deposited, the customer will eventually summon it:
βπ βC::[Accepted, π] βreceiveCustomerInterfaceβSupervisor { [Retrieve, π] βsendCustomerInterfaceβSupervisor.
(4.15)
β Pedestrians will only walk on βwalkableβ area:
βπ βC::β₯0( (π .π₯ , π . π¦) βG.π€ ππ π π ππ π_ππ π π). (4.16)
β Pedestrians will not stay on crosswalks forever:
βπ βC::( (π .π₯ , π . π¦) βG.π€ ππ π π ππ π_ππ π πβ©G.ππ π π£ π ππ π_ππ π π { (π .π₯ , π . π¦)βG.π€ ππ π π ππ π_ππ π πβ©G.ππ π π£ π ππ π_ππ π π).
(4.17)
β If the car is not healthy and not towed, it cannot move:
βπ βC::β₯0(Β¬π .πππ . βπ ππ π‘ β π¦β§ Β¬π .πππ .π‘ ππ€ π π β π .ππππ‘π ππ π .π£=0β§π .ππππ‘π ππ π . π=0).
(4.18)
β Sending aRetrievemessage must always be preceded by receiving anAccepted message from theSupervisor:
βπ βC::[Accepted, π] βreceiveCustomerInterfaceβSupervisor
[Retrieve, π] βsendCustomerInterfaceβSupervisor.
(4.19)
β If a customer receivesRejectedorReturnedfrom theSupervisor, then they must leave the lot forever:
βπ βC::βπ‘ ::[Rejected, π] βreceiveCustomerInterfaceβSupervisor(π‘)
β¨[Returned, π] βreceiveCustomerInterfaceβSupervisor(π‘) β
βπ‘0> π‘ ::β₯π‘0( (π .πππ .π₯ , π .πππ . π¦) βG.πππ‘ ππ π ππ).
(4.20)
Contract 2(CSupervisor). The contract for theSupervisoris as follows.
β’ Assumes
β Towing eventually happens after theSupervisoris alerted of car failure:
βπ βC::βπ‘::[Failed, π] βreceiveSupervisorβPlanner(π‘) β
βπ‘0::β₯π‘0(π .πππ .π‘ ππ€ π πβ§ (π .πππ .π₯ , π .πππ . π¦) βG.πππ‘ ππ π ππ).
(4.21)
β If a car fails, then thePlannerreportsFailed:
βπ βC::Β¬π .πππ . βπ ππ π‘ β π¦ { [Failed, π] βreceiveSupervisorβPlanner. (4.22) β Cars making requests are deposited correctly by the customer:
βπ βC::β₯0( [Park, π] βreceiveSupervisorβCustomerInterface
β§( [Accepted, π] βsendSupervisorβCustomerInterface
β¨[Rejected, π] βsendSupervisorβCustomerInterface)
βπ .πππ .π π‘ ππ‘ πβG.πππ‘π π¦_πππ π πππ’π ππ‘π πππ ).
(4.23)
β If a car is healthy and summoned, then it will eventually appear at the return area and thePlannerwill send aCompletedsignal to theSupervisor:
βπβC:: (β₯0π .πππ . βπ ππ π‘ β π¦β§ [Retrieve, π] βreceiveSupervisorβPlanner {( [Completed, π] βreceiveSupervisorβPlannerβ§ π .πππ .π π‘ ππ‘ πβG.π ππ‘ π’π π_πππ π πππ’π ππ‘π πππ )).
(4.24)
β’ Guarantees
β All requests from customers will be replied:
βπβC:: ( [π, π] βreceiveSupervisorβCustomerInterface {
βπ βB(Supervisor):: [π , π] βsendSupervisorβCustomerInterface).
(4.25)
β The Supervisor cannot send a Returned message to the CustomerInterface unless it has received aCompletedmessage from thePlannerand the car is in the return area:
βπ βC::[Completed, π] βreceiveSupervisorβPlanner
β§π .πππ .π π‘ ππ‘ πβG.π ππ‘ π’π π_πππ π πππ’π ππ‘π πππ [Returned, π] βsendSupervisorβCustomerInterface.
(4.26)
β If a car is healthy and aRetrievemessage is received, then the last thing sent to thePlannershould be a directive to the return area (the second configuration
should be one of the return configurations).
βπ βC:: (β₯0π .πππ . βπ ππ π‘ β π¦ β [Retrieve, π] βreceiveSupervisorβPlannerβ§
βπ0, π1 βR3:: [(π0, π1), π] βsendSupervisorβPlanner β§ βπ0
0, π0
1βR3::
[(π0
0, π0
1), π] βsendSupervisorβPlanner [(π0, π1), π] βsendSupervisorβPlanner
β π1 βG.π ππ‘ π’π π_πππ π πππ’π ππ‘π πππ .
(4.27) β If the car is healthy and if it is ever summoned, then theSupervisorwill send a
Returnedmessage to its owner:
βπ βC::(β₯0π .πππ . βπ ππ π‘ β π¦ β [Retrieve, π] βreceiveSupervisorβCustomerInterface { [Returned, π] βsendSupervisorβCustomerInterface).
(4.28)
β If there is a not-yet-responded-toParkrequest and the parking lot capacity is not yet reached, then theSupervisorshould accept the request:
βπβC::βπ‘::β[Park, π] βreceiveSupervisorβCustomerInterface(π‘)
β§βπ‘0β€ π‘::[Rejected, π] βsendSupervisorβCustomerInterface(π‘0)
β§[Accepted, π] βsendSupervisorβCustomerInterface(π‘0)
β§ππ’π_π ππ‘π π£ π_ππ’ π π‘ ππ ππ π (π‘) <G. π ππ π πππ_π π ππ‘ π
β βπ‘00 > π‘:: [Accepted, π] βsendSupervisorβCustomerInterface(π‘00).
(4.29)
β For everyAcceptedto orRetrievefrom theCustomerInterfaceorBlocked from thePlanner, theSupervisorsends a pair of configurations to thePlanner, the first of which is the current configuration of the car and such that there exists a path of allowable curvature :
βπ βC:: [Accepted, π] βsendSupervisorβCustomerInterface
β¨[Retrieve, π] βreceiveSupervisorβCustomerInterface
β¨[Blocked, π] βreceiveSupervisorβPlanner {
βπ0, π1βR3:: [(π0, π1), π] =SupervisorβPlanner
β§π0 =π .πππ .π π‘ ππ‘ πβ§ βπ βP::π -feasible(π)
β§πΛ(0) =π0β§πΛ(1) =π1.
(4.30)
Contract 3(CPlanner). The contract for thePlanneris as follows:
β’ Assumes
β When theTrackercompletes its task according to the corridor mapπΏ, it should send a report to thePlanner:
βπ βC::βπ βP::βπ0 βP::
[π0, π] βsendPlannerβTracker [π, π] βsendPlannerβTrackerβ§ π .πππ .π π‘ ππ‘ πβΞπΏ(π,1) { [Completed, π] βreceivePlannerβTracker.
(4.31)
β If theTrackersees a failure, it should report to thePlanner:
βπ βC::Β¬π .πππ . βπ ππ π‘ β π¦ { [Failed, π] βreceivePlannerβTracker. (4.32)
β’ Guarantees
β When receiving a pair of configurations from theSupervisor, thePlannershould send a path to theTrackersuch that the starting and ending configurations of the path match the received configurations, or if this is not possible, sendBlocked to theSupervisor:
βπβC::β(π0, π1) βR6:: [(π0, π1), π] βreceivePlannerβSupervisor
{ (βπ βP:: Λπ(0)= π0β§πΛ(1) = π1β§ [π, π] βsendPlannerβTracker
β¨[Blocked, π] βsendPlannerβSupervisor).
(4.33)
β Only send safe paths withπ -feasible curvature:
βπ βC::βπ βP:: [π, π] βsendPlannerβTracker β π -feasible(π) β§ΞπΏ(π) βG.ππ π π£ π ππ π_ππ π π .
(4.34)
β If receiving a task status update from theTracker, eventually forward it to the Supervisor:
βπ βC::[π, π] βreceivePlannerβTracker
β§π β {Failed,Completed}{ [π, π] βsendPlannerβSupervisor.
(4.35)
β If thePlannerreceives aBlockedsignal from theTracker, it attempts to fix it, otherwise forwards it to theSupervisor:
βπ βC::βπ‘ ::[Blocked, π] βreceivePlannerβTracker(π‘) β
βπ βRβ₯0:: (βπ βP::[π, π] βsendPlannerβTracker(π‘+π)β§
βπ‘0 < π‘+π:: [π, π] βsendPlannerβTracker(π‘0)
β¨[Blocked, π] βsendPlannerβSupervisor(π‘+π)).
(4.36)
Contract 4(CTracker). The contract for the tracking component is as follows:
β’ Assumes
β Any path command from thePlanneris alwaysπ -feasible, the corresponding corridor is drivable, and the car configuration upon receiving the command is in the initial portion of the corridor:
βπ βC::βπ βP::βπ‘:: starts_at( [π, π] βreceiveTrackerβPlanner, π‘)β§
π -feasible(π) β§π .πππ .π π‘ ππ‘ π(π‘) βΞπΏ(π,0) β§ΞπΏ(π) βG.ππ π π£ π ππ π_ππ π π . (4.37) β Commands are not modified by theCustomerInterface:
See (4.12) and (4.13). (4.38)
β’ Guarantees
β Make sure car stays in the latest sentπβs corridorΞπΏ(π):
βπ βC::βπ‘::βπ βP::βπ0 βP::
( ( [π, π] βreceiveTrackerβPlanner(π‘) β§ [π0, π] βreceiveTrackerβPlanner(π‘)) β ( [π0, π] βreceiveTrackerβPlanner [π, π] βreceiveTrackerβPlanner)) β π .πππ .π π‘ ππ‘ π(π‘) βΞπΏ(π).
(4.39) β Tracking command inputs are compatible with cars:
βπ βC::β₯0( [(π£ , π), π] βsendTrackerβCustomerInterface β π£min β€π£β§π£ β€π£maxβ§πmin β€ πβ§π β€πmax).
(4.40)
β Never drive into a dynamic obstacle (customer or car):
βπ1, π2 βC::β₯0( (π1β π2β k (π1.πππ .π₯ , π1.πππ . π¦) β (π2.πππ .π₯ , π2.πππ . π¦) k β₯πmin, π ππ)β§
k (π1.πππ .π₯ , π1.πππ . π¦) β (π2.π₯ , π2. π¦) k β₯ πmin, π ππ ππ π)).
(4.41)
β If a car fails, it must report to thePlanner:
βπβC::Β¬π .πππ . βπ ππ π‘ β π¦ {[Failed, π] βsendTrackerβPlanner. (4.42) β If a car is healthy, then it must βtrackβ the last sent path from thePlanner:
βπβC::β₯0π .πππ . βπ ππ π‘ β π¦β§ βπ βP::βπ0 βP::
[π0, π] βreceiveTrackerβPlanner [π, π] βreceiveTrackerβPlanner
β βπ‘::π .πππ .π π‘ ππ‘ π(π‘) βΞπΏ(π,1).
(4.43)
Figure 4.3: Implementation of the Planner component.
β When theTrackercompletes its task according to a corridor mapπΏ, it should send a report to thePlannermodule:
See (4.31). (4.44)
β If a car is blocked (i.e., there is a failed car in its current corridor), then the Tracker must reportBlockedto thePlanner:
βπβC::βπ‘::βπ βP:: ( [π, π]receiveTrackerβPlanner(π‘)::
βπ0βP:: [π0, π] βreceiveTrackerβPlanner(π‘0)
β [π0, π] βreceiveTrackerβPlanner [π, π] βreceiveTrackerβPlanner) β (βπ0βC::π0β πβ§ Β¬π0.πππ . βπ ππ π‘ β π¦β§π0.πππ .π π‘ ππ‘ π(π‘) βΞπΏ(π) {[Blocked, π] βsendTrackerβPlanner).
(4.45)