Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions eplansys_demo/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,26 @@ target_link_libraries(survey_mission
)
target_compile_definitions(survey_mission PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")

add_executable(survey_sites_actions src/survey_sites_actions.cpp)
target_link_libraries(survey_sites_actions
plansys2_executor::plansys2_executor
rclcpp::rclcpp
)
target_compile_definitions(survey_sites_actions PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")

add_executable(survey_sites_mission src/survey_sites_mission.cpp)
target_link_libraries(survey_sites_mission
plansys2_executor::plansys2_executor
plansys2_planner::plansys2_planner
plansys2_problem_expert::plansys2_problem_expert
plansys2_domain_expert::plansys2_domain_expert
${plansys2_msgs_TARGETS}
rclcpp::rclcpp
)
target_compile_definitions(survey_sites_mission PUBLIC "PLUGINLIB__DISABLE_BOOST_FUNCTIONS")

install(TARGETS corridor_actions corridor_mission survey_actions survey_mission
survey_sites_actions survey_sites_mission
RUNTIME DESTINATION lib/${PROJECT_NAME}
)

Expand Down
68 changes: 68 additions & 0 deletions eplansys_demo/epddl/survey-sites-problem.epddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
(define (problem two-site-survey)

;; Four robots at the depot. `north` and `south` are the two scouts, `relay`
;; is the team member the findings have to reach, and `observer` is the
;; machine the team does not control and the mission excludes.
;;
;; Neither site's state is given. Two atoms are left open, so the model
;; designates four worlds and the policy branches twice.
;;
;; Each scout carries the instrument its own site needs, and only the site's
;; instrument reads it. That is what keeps the two halves in different hands:
;; without it the cheapest policy sends one robot to both sites, which is a
;; correct answer to the mission and not the one this problem is posed to
;; produce.

(:domain survey-sites)

(:requirements
:equality :list-comprehensions
:finitary-S5-theories :modal-goals :knowing-whether
:multi-pointed-models :negative-preconditions
)

(:agents north south relay observer)

(:init
(:and
;; Who carries what, settled and common knowledge. Every agent is named
;; for every instrument: an atom the initial state leaves out is an atom
;; the model has to be uncertain about, and eight such atoms would
;; designate two hundred and fifty-six worlds to say what four say here.
([C. All] (instrument-north north))
([C. All] (not (instrument-north south)))
([C. All] (not (instrument-north relay)))
([C. All] (not (instrument-north observer)))
([C. All] (instrument-south south))
([C. All] (not (instrument-south north)))
([C. All] (not (instrument-south relay)))
([C. All] (not (instrument-south observer)))
(:forall (?i - agent)
([C. All] (not (on-north ?i))))
(:forall (?i - agent)
([C. All] (not (on-south ?i))))
(:forall (?i - agent)
([C. All] (<Kw. ?i> (contaminated-north))))
(:forall (?i - agent)
([C. All] (<Kw. ?i> (contaminated-south))))
)
)

;; Six conjuncts, three per site, and the two triples share nothing. Each
;; site has to be visited, its finding has to reach `relay` over a channel
;; the observer cannot hear, and the observer has to end ignorant of it.
;;
;; The two halves are what this problem is for. They are independent in the
;; model --- no action of one appears in a precondition of the other --- so
;; any serial policy for the mission is twice as long as the work requires.
(:goal
(and
([Kw. north] (contaminated-north))
([Kw. relay] (contaminated-north))
(<Kw. observer> (contaminated-north))
([Kw. south] (contaminated-south))
([Kw. relay] (contaminated-south))
(<Kw. observer> (contaminated-south))
)
)
)
297 changes: 297 additions & 0 deletions eplansys_demo/epddl/survey-sites.epddl
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
(define (domain survey-sites)

;; Two sites, and a team large enough to survey both at once.
;;
;; This is `survey-team` with the site made plural. Everything that domain
;; says about audiences holds here unchanged: a scanning robot learns the
;; answer, the others learn only that it scanned, the open channel reaches
;; the observer and the team link does not.
;;
;; What the second site adds is independence. Nothing a robot does at the
;; north site bears on the south one: the two findings are separate atoms,
;; the two drives are separate effects, and no action at one site appears in
;; any precondition at the other. A policy for this mission therefore holds
;; two halves that could run at the same time and, dispatched a node at a
;; time, do not.
;;
;; EPDDL parameters are agents, so a site cannot be one. The two halves are
;; written out instead of quantified, which is verbose and exact.

(:requirements
:equality :partial-observability :list-comprehensions :lists
:ontic-actions :group-modalities
:negative-preconditions :modal-preconditions :knowing-whether
)

(:action-type-libraries intermediate)

(:predicates
(contaminated-north) ; the north site is contaminated
(contaminated-south) ; the south site is contaminated
(on-north ?i - agent) ; ?i is close enough to scan the north site
(on-south ?i - agent) ; ?i is close enough to scan the south site
(instrument-north ?i - agent); ?i carries the instrument the north site needs
(instrument-south ?i - agent); ?i carries the instrument the south site needs
)

(:event nil)

;--------------------DRIVE TO A SITE------------------
;
; Ontic and public, as in the one-site mission: the team tracks its members
; and the observer watches them move.

(:event e-goto-north
:parameters (?i - agent)
:precondition (not (on-north ?i))
:effects (on-north ?i)
)

(:action goto-north
:parameters (?i - agent)
:action-type (public-ontic (e-goto-north ?i))
:observability-conditions (default Fully)
)

(:event e-goto-south
:parameters (?i - agent)
:precondition (not (on-south ?i))
:effects (on-south ?i)
)

(:action goto-south
:parameters (?i - agent)
:action-type (public-ontic (e-goto-south ?i))
:observability-conditions (default Fully)
)

;--------------------SCAN A SITE------------------
;
; Semi-private sensing. The scanning robot learns whether that site is
; contaminated; everyone else learns that it scanned.

(:event e-scan-north-dirty
:parameters (?i - agent)
:precondition
(and
(instrument-north ?i)
(on-north ?i)
(contaminated-north)
(<Kw. ?i> (contaminated-north)) )
)

(:event e-scan-north-clean
:parameters (?i - agent)
:precondition
(and
(instrument-north ?i)
(on-north ?i)
(not (contaminated-north))
(<Kw. ?i> (contaminated-north)) )
)

(:action scan-north
:parameters (?i - agent)
:action-type (semi-private-sensing
(e-scan-north-dirty ?i)
(e-scan-north-clean ?i) )
:observability-conditions
(:and
(?i Fully)
(default Partially) )
)

(:event e-scan-south-dirty
:parameters (?i - agent)
:precondition
(and
(instrument-south ?i)
(on-south ?i)
(contaminated-south)
(<Kw. ?i> (contaminated-south)) )
)

(:event e-scan-south-clean
:parameters (?i - agent)
:precondition
(and
(instrument-south ?i)
(on-south ?i)
(not (contaminated-south))
(<Kw. ?i> (contaminated-south)) )
)

(:action scan-south
:parameters (?i - agent)
:action-type (semi-private-sensing
(e-scan-south-dirty ?i)
(e-scan-south-clean ?i) )
:observability-conditions
(:and
(?i Fully)
(default Partially) )
)

;--------------------REPORT ON THE OPEN CHANNEL------------------
;
; The trap, once per site: it informs the team in one step and hands the
; finding to the observer, which the goal forbids.

(:event e-open-north-dirty
:parameters (?i - agent)
:precondition ([?i] (contaminated-north))
)

(:event e-not-open-north-dirty
:parameters (?i - agent)
:precondition (not ([?i] (contaminated-north)))
)

(:action broadcast-north-dirty
:parameters (?i - agent)
:action-type (public-announcement
(e-open-north-dirty ?i)
(e-not-open-north-dirty ?i) )
:observability-conditions (default Fully)
)

(:event e-open-north-clean
:parameters (?i - agent)
:precondition ([?i] (not (contaminated-north)))
)

(:event e-not-open-north-clean
:parameters (?i - agent)
:precondition (not ([?i] (not (contaminated-north))))
)

(:action broadcast-north-clean
:parameters (?i - agent)
:action-type (public-announcement
(e-open-north-clean ?i)
(e-not-open-north-clean ?i) )
:observability-conditions (default Fully)
)

(:event e-open-south-dirty
:parameters (?i - agent)
:precondition ([?i] (contaminated-south))
)

(:event e-not-open-south-dirty
:parameters (?i - agent)
:precondition (not ([?i] (contaminated-south)))
)

(:action broadcast-south-dirty
:parameters (?i - agent)
:action-type (public-announcement
(e-open-south-dirty ?i)
(e-not-open-south-dirty ?i) )
:observability-conditions (default Fully)
)

(:event e-open-south-clean
:parameters (?i - agent)
:precondition ([?i] (not (contaminated-south)))
)

(:event e-not-open-south-clean
:parameters (?i - agent)
:precondition (not ([?i] (not (contaminated-south))))
)

(:action broadcast-south-clean
:parameters (?i - agent)
:action-type (public-announcement
(e-open-south-clean ?i)
(e-not-open-south-clean ?i) )
:observability-conditions (default Fully)
)

;--------------------REPORT ON THE TEAM CHANNEL------------------
;
; The action the mission needs, once per site and per polarity: the speaker
; and the named listener learn, and nobody else learns that anything was
; said.

(:event e-team-north-dirty
:parameters (?i - agent)
:precondition
(and
(on-north ?i)
([?i] (contaminated-north)) )
)

(:action relay-north-dirty
:parameters (?i ?j - agent)
:action-type (private-announcement
(e-team-north-dirty ?i)
(nil) )
:observability-conditions
(:and
(?i Fully)
(?j Fully)
(default Oblivious) )
)

(:event e-team-north-clean
:parameters (?i - agent)
:precondition
(and
(on-north ?i)
([?i] (not (contaminated-north))) )
)

(:action relay-north-clean
:parameters (?i ?j - agent)
:action-type (private-announcement
(e-team-north-clean ?i)
(nil) )
:observability-conditions
(:and
(?i Fully)
(?j Fully)
(default Oblivious) )
)

(:event e-team-south-dirty
:parameters (?i - agent)
:precondition
(and
(on-south ?i)
([?i] (contaminated-south)) )
)

(:action relay-south-dirty
:parameters (?i ?j - agent)
:action-type (private-announcement
(e-team-south-dirty ?i)
(nil) )
:observability-conditions
(:and
(?i Fully)
(?j Fully)
(default Oblivious) )
)

(:event e-team-south-clean
:parameters (?i - agent)
:precondition
(and
(on-south ?i)
([?i] (not (contaminated-south))) )
)

(:action relay-south-clean
:parameters (?i ?j - agent)
:action-type (private-announcement
(e-team-south-clean ?i)
(nil) )
:observability-conditions
(:and
(?i Fully)
(?j Fully)
(default Oblivious) )
)
)
Loading
Loading