24#include "model/DomainFact.h"
25#include "model/DomainObject.h"
26#include "model/DomainOperator.h"
27#include "model/DomainPredicate.h"
28#include "model/Goal.h"
29#include "model/GroundedFormula.h"
30#include "model/GroundedPDDLFormula.h"
31#include "model/GroundedPDDLPredicate.h"
32#include "model/PDDLFormula.h"
33#include "model/PDDLGrounding.h"
34#include "model/PDDLPredicate.h"
35#include "model/Plan.h"
37#include <aspect/logging.h>
38#include <aspect/webview.h>
39#include <clipsmm/fact.h>
40#include <core/threading/thread.h>
41#include <core/utils/lockptr.h>
42#include <plugins/clips/aspect/clips_manager.h>
43#include <webview/rest_api.h>
44#include <webview/rest_array.h>
64 typedef std::pair<std::string, std::string> PlanKey;
65 typedef std::tuple<std::string, std::string, int64_t> PlanActionKey;
66 typedef std::tuple<std::string, std::string> GroundedPDDLKey;
67 typedef std::list<CLIPS::Fact::pointer> ClipsFactList;
68 typedef std::map<PlanActionKey, ClipsFactList> PreCompoundMap;
69 typedef std::map<PlanActionKey, ClipsFactList> PreAtomMap;
70 typedef std::map<PlanKey, CLIPS::Fact::pointer> PlanMap;
71 typedef std::map<PlanKey, ClipsFactList> PlanActionMap;
72 typedef std::map<std::string, CLIPS::Fact::pointer> PDDLGroundingMap;
73 typedef std::map<std::string, CLIPS::Fact::pointer> PDDLFormulaMap;
74 typedef std::map<std::string, CLIPS::Fact::pointer> PDDLPredicateMap;
75 typedef std::map<std::string, ClipsFactList> GroundedPDDLFormulaMap;
76 typedef std::map<std::string, ClipsFactList> GroundedPDDLPredicateMap;
77 typedef std::tuple<CLIPS::Fact::pointer, CLIPS::Fact::pointer> PDDLFormulaTreeNode;
78 typedef std::list<PDDLFormulaTreeNode> PDDLFormulaTreeLevel;
79 typedef std::map<std::string, PDDLFormulaTreeLevel> PDDLFormulaTreeMap;
80 typedef std::map<std::string, std::shared_ptr<GroundedFormula>> GroundedFormulaMap;
103 Goal generate_goal(CLIPS::Fact::pointer fact);
104 void gen_plan_precompute(std::map<PlanKey, CLIPS::Fact::pointer> &plans,
105 std::map<PlanKey, ClipsFactList> & plan_actions,
106 PreCompoundMap & prec,
108 PDDLGroundingMap & pgm,
109 PDDLFormulaMap & pfm,
110 PDDLPredicateMap & ppm,
111 GroundedPDDLFormulaMap & gpfm,
112 GroundedPDDLPredicateMap & gppm);
114 PDDLFormulaTreeMap tree,
115 PDDLGroundingMap groundings);
117 Plan gen_plan(
const PlanKey & plan_key,
118 const CLIPS::Fact::pointer fact,
119 PlanActionMap & plan_actions,
120 PreCompoundMap & prec,
122 PDDLGroundingMap & pgm,
123 PDDLFormulaMap & pfm,
124 PDDLPredicateMap & ppm,
125 GroundedPDDLFormulaMap & gpfm,
126 GroundedPDDLPredicateMap & gppm);
128 std::shared_ptr<PDDLGrounding> gen_pddl_grounding(
const CLIPS::Fact::pointer fact);
130 std::shared_ptr<PDDLFormula> gen_pddl_formula(
const CLIPS::Fact::pointer fact);
132 std::shared_ptr<PDDLPredicate> gen_pddl_predicate(
const CLIPS::Fact::pointer fact);
134 std::shared_ptr<GroundedPDDLFormula> gen_grounded_pddl_formula(
const CLIPS::Fact::pointer fact);
136 std::shared_ptr<GroundedPDDLPredicate>
137 gen_grounded_pddl_predicate(
const CLIPS::Fact::pointer fact);
REST API backend for the CLIPS executive.
~ClipsExecutiveRestApi()
Destructor.
virtual void finalize()
Finalize the thread.
virtual void init()
Initialize the thread.
virtual void loop()
Code to execute in the thread.
ClipsExecutiveRestApi()
Constructor.
Environment representation for JSON transfer.
Goal representation for JSON transfer.
GroundedPDDLPredicate representation for JSON transfer.
PDDLGrounding representation for JSON transfer.
PDDLPredicate representation for JSON transfer.
Plan representation for JSON transfer.
Container to return array via REST.
Thread aspect access the CLIPS environment manager.
Thread aspect to log output.
Thread class encapsulation of pthreads.
Thread aspect to provide web pages via Webview.
Webview REST API component.
REST parameters to pass to handlers.