22 #include "clips-executive-rest-api.h"
24 #include <core/threading/mutex_locker.h>
25 #include <webview/rest_api_manager.h>
38 :
Thread(
"ClipsWebviewThread",
Thread::OPMODE_WAITFORWAKEUP)
51 std::map<std::string, LockPtr<CLIPS::Environment>> envs =
clips_env_mgr->environments();
52 if (envs.find(
"executive") == envs.end()) {
53 throw Exception(
"No CLIPS environment named 'executive' found");
55 clips_ = envs[
"executive"];
60 WebRequest::METHOD_GET,
"/goals", std::bind(&ClipsExecutiveRestApi::cb_list_goals,
this));
63 std::bind(&ClipsExecutiveRestApi::cb_get_goal,
65 std::placeholders::_1));
67 WebRequest::METHOD_GET,
69 std::bind(&ClipsExecutiveRestApi::cb_list_domain_operators,
this));
71 WebRequest::METHOD_GET,
73 std::bind(&ClipsExecutiveRestApi::cb_list_domain_objects,
this));
75 WebRequest::METHOD_GET,
77 std::bind(&ClipsExecutiveRestApi::cb_list_domain_predicates,
this));
79 WebRequest::METHOD_GET,
81 std::bind(&ClipsExecutiveRestApi::cb_list_domain_facts,
this));
83 WebRequest::METHOD_GET,
"/plans", std::bind(&ClipsExecutiveRestApi::cb_list_plans,
this));
85 "/plans/{goal-id}/{id}",
86 std::bind(&ClipsExecutiveRestApi::cb_get_plan,
88 std::placeholders::_1));
90 WebRequest::METHOD_GET,
92 std::bind(&ClipsExecutiveRestApi::cb_list_pddl_groundings,
this));
94 WebRequest::METHOD_GET,
96 std::bind(&ClipsExecutiveRestApi::cb_list_pddl_predicates,
this));
98 WebRequest::METHOD_GET,
100 std::bind(&ClipsExecutiveRestApi::cb_list_pddl_formulas,
this));
102 WebRequest::METHOD_GET,
103 "/grounded-pddl-predicates",
104 std::bind(&ClipsExecutiveRestApi::cb_list_grounded_pddl_predicates,
this));
106 WebRequest::METHOD_GET,
107 "/grounded-pddl-formulas",
108 std::bind(&ClipsExecutiveRestApi::cb_list_grounded_pddl_formulas,
this));
111 "/pddl-groundings/{id}",
112 std::bind(&ClipsExecutiveRestApi::cb_get_pddl_groundings,
114 std::placeholders::_1));
116 "/pddl-predicates/{id}",
117 std::bind(&ClipsExecutiveRestApi::cb_get_pddl_predicates,
119 std::placeholders::_1));
121 "/pddl-formulas/{id}",
122 std::bind(&ClipsExecutiveRestApi::cb_get_pddl_formulas,
124 std::placeholders::_1));
126 WebRequest::METHOD_GET,
127 "/grounded-pddl-predicates/{id}",
128 std::bind(&ClipsExecutiveRestApi::cb_get_grounded_pddl_predicates,
130 std::placeholders::_1));
132 WebRequest::METHOD_GET,
133 "/grounded-pddl-groundings/{id}",
134 std::bind(&ClipsExecutiveRestApi::cb_get_grounded_pddl_formulas,
this, std::placeholders::_1));
156 template <
typename T>
158 get_value(
const CLIPS::Fact::pointer &fact,
const std::string &slot_name)
160 CLIPS::Values v = fact->slot_value(slot_name);
162 throw Exception(
"No value for slot '%s'", slot_name.c_str());
164 if (v[0].type() == CLIPS::TYPE_SYMBOL && v[0].as_string() ==
"nil") {
177 get_value(
const CLIPS::Fact::pointer &fact,
const std::string &slot_name)
179 CLIPS::Values v = fact->slot_value(slot_name);
181 throw Exception(
"No value for slot '%s'", slot_name.c_str());
183 if (v[0].type() != CLIPS::TYPE_SYMBOL) {
184 throw Exception(
"Value for slot '%s' is not a boolean", slot_name.c_str());
186 return (v[0].as_string() ==
"TRUE");
197 static std::vector<std::string>
198 get_values(
const CLIPS::Fact::pointer &fact,
const std::string &slot_name)
200 CLIPS::Values v = fact->slot_value(slot_name);
201 std::vector<std::string> rv(v.size());
202 for (
size_t i = 0; i < v.size(); ++i) {
203 switch (v[i].type()) {
204 case CLIPS::TYPE_FLOAT: rv[i] = std::to_string(
static_cast<double>(v[i]));
break;
205 case CLIPS::TYPE_INTEGER: rv[i] = std::to_string(
static_cast<long long int>(v[i]));
break;
206 case CLIPS::TYPE_SYMBOL:
207 case CLIPS::TYPE_STRING:
208 case CLIPS::TYPE_INSTANCE_NAME: rv[i] =
static_cast<std::string &
>(v[i]);
break;
209 default: rv[i] =
"CANNOT-REPRESENT";
break;
216 ClipsExecutiveRestApi::generate_goal(CLIPS::Fact::pointer fact)
221 g.
set_id(get_value<std::string>(fact,
"id"));
222 g.
set__class(get_value<std::string>(fact,
"class"));
223 g.
set_type(get_value<std::string>(fact,
"type"));
224 g.
set_sub_type(get_value<std::string>(fact,
"sub-type"));
225 g.
set_mode(get_value<std::string>(fact,
"mode"));
226 g.
set_parent(get_value<std::string>(fact,
"parent"));
227 g.
set_outcome(get_value<std::string>(fact,
"outcome"));
229 g.
set_message(get_value<std::string>(fact,
"message"));
232 g.
set_meta(get_values(fact,
"meta"));
236 CLIPS::Fact::pointer pfact = clips_->get_facts();
238 CLIPS::Template::pointer tmpl = pfact->get_template();
239 if (tmpl->name() ==
"plan") {
241 if (get_value<std::string>(pfact,
"goal-id") == *g.
id()) {
242 g.
addto_plans(std::move(get_value<std::string>(pfact,
"id")));
247 pfact = pfact->next();
254 ClipsExecutiveRestApi::cb_list_goals()
259 CLIPS::Fact::pointer fact = clips_->get_facts();
261 CLIPS::Template::pointer tmpl = fact->get_template();
262 if (tmpl->name() ==
"goal") {
264 rv.
push_back(std::move(generate_goal(fact)));
279 const std::string
id = params.
path_arg(
"id");
282 CLIPS::Fact::pointer fact = clips_->get_facts();
284 CLIPS::Template::pointer tmpl = fact->get_template();
285 if (tmpl->name() ==
"goal") {
287 if (get_value<std::string>(fact,
"id") ==
id) {
288 return generate_goal(fact);
302 ClipsExecutiveRestApi::cb_list_domain_operators()
307 std::map<std::string, std::list<std::pair<std::string, std::string>>> op_params;
309 CLIPS::Fact::pointer fact = clips_->get_facts();
311 CLIPS::Template::pointer tmpl = fact->get_template();
312 if (tmpl->name() ==
"domain-operator-parameter") {
313 std::string operator_name = get_value<std::string>(fact,
"operator");
314 if (op_params.find(operator_name) == op_params.end()) {
315 op_params[operator_name] = {};
317 op_params[operator_name].push_back(
318 std::make_pair(get_value<std::string>(fact,
"name"), get_value<std::string>(fact,
"type")));
323 fact = clips_->get_facts();
325 CLIPS::Template::pointer tmpl = fact->get_template();
326 if (tmpl->name() ==
"domain-operator") {
331 o.
set_name(get_value<std::string>(fact,
"name"));
333 if (op_params.find(*o.
name()) != op_params.end()) {
334 for (
const auto &p : op_params[*o.
name()]) {
355 ClipsExecutiveRestApi::cb_list_domain_objects()
360 CLIPS::Fact::pointer fact = clips_->get_facts();
362 CLIPS::Template::pointer tmpl = fact->get_template();
363 if (tmpl->name() ==
"domain-object") {
367 o.
set_name(get_value<std::string>(fact,
"name"));
368 o.
set_type(get_value<std::string>(fact,
"type"));
378 ClipsExecutiveRestApi::cb_list_domain_predicates()
383 CLIPS::Fact::pointer fact = clips_->get_facts();
385 CLIPS::Template::pointer tmpl = fact->get_template();
386 if (tmpl->name() ==
"domain-predicate") {
390 p.
set_name(get_value<std::string>(fact,
"name"));
391 p.
set_sensed(get_value<bool>(fact,
"sensed"));
403 ClipsExecutiveRestApi::cb_list_domain_facts()
408 CLIPS::Fact::pointer fact = clips_->get_facts();
410 CLIPS::Template::pointer tmpl = fact->get_template();
411 if (tmpl->name() ==
"domain-fact") {
415 f.
set_name(get_value<std::string>(fact,
"name"));
425 std::shared_ptr<PDDLGrounding>
426 ClipsExecutiveRestApi::gen_pddl_grounding(
const CLIPS::Fact::pointer fact)
428 auto grounding = std::make_shared<PDDLGrounding>();
429 grounding->set_kind(
"PDDLGrounding");
431 grounding->set_id(get_value<std::string>(fact,
"id"));
433 for (
const auto &pn : get_values(fact,
"param-names")) {
434 grounding->addto_param_names(std::move(pn));
437 for (
const auto &pv : get_values(fact,
"param-values")) {
438 grounding->addto_param_values(std::move(pv));
445 ClipsExecutiveRestApi::cb_list_pddl_groundings()
450 CLIPS::Fact::pointer fact = clips_->get_facts();
452 CLIPS::Template::pointer tmpl = fact->get_template();
453 if (tmpl->name() ==
"pddl-grounding") {
465 std::string
id = params.
path_arg(
"id");
470 CLIPS::Fact::pointer fact = clips_->get_facts();
472 CLIPS::Template::pointer tmpl = fact->get_template();
473 if (tmpl->name() ==
"pddl-grounding" && get_value<std::string>(fact,
"id") ==
id) {
474 ret = *gen_pddl_grounding(fact);
480 "No grounding with ID '%s' found",
486 std::shared_ptr<PDDLFormula>
487 ClipsExecutiveRestApi::gen_pddl_formula(
const CLIPS::Fact::pointer fact)
489 auto formula = std::make_shared<PDDLFormula>();
490 formula->set_kind(
"PDDLFormula");
492 formula->set_id(get_value<std::string>(fact,
"id"));
493 formula->set_type(get_value<std::string>(fact,
"type"));
494 formula->set_part_of(get_value<std::string>(fact,
"part-of"));
500 ClipsExecutiveRestApi::cb_list_pddl_formulas()
505 CLIPS::Fact::pointer fact = clips_->get_facts();
507 CLIPS::Template::pointer tmpl = fact->get_template();
508 if (tmpl->name() ==
"pddl-formula") {
520 std::string
id = params.
path_arg(
"id");
525 CLIPS::Fact::pointer fact = clips_->get_facts();
527 CLIPS::Template::pointer tmpl = fact->get_template();
528 if (tmpl->name() ==
"pddl-formula" && get_value<std::string>(fact,
"id") ==
id) {
529 ret = *gen_pddl_formula(fact);
535 "No formula with ID '%s' found",
541 std::shared_ptr<PDDLPredicate>
542 ClipsExecutiveRestApi::gen_pddl_predicate(
const CLIPS::Fact::pointer fact)
544 auto predicate = std::make_shared<PDDLPredicate>();
545 predicate->set_kind(
"PDDLPredicate");
547 predicate->set_id(get_value<std::string>(fact,
"id"));
548 predicate->set_part_of(get_value<std::string>(fact,
"part-of"));
549 predicate->set_predicate(get_value<std::string>(fact,
"predicate"));
551 for (
const auto &pn : get_values(fact,
"param-names")) {
552 predicate->addto_param_names(std::move(pn));
555 for (
const auto &pc : get_values(fact,
"param-constants")) {
556 predicate->addto_param_constants(std::move(pc));
563 ClipsExecutiveRestApi::cb_list_pddl_predicates()
568 CLIPS::Fact::pointer fact = clips_->get_facts();
570 CLIPS::Template::pointer tmpl = fact->get_template();
571 if (tmpl->name() ==
"pddl-predicate") {
583 std::string
id = params.
path_arg(
"id");
588 CLIPS::Fact::pointer fact = clips_->get_facts();
590 CLIPS::Template::pointer tmpl = fact->get_template();
591 if (tmpl->name() ==
"pddl-predicate" && get_value<std::string>(fact,
"id") ==
id) {
592 ret = *gen_pddl_predicate(fact);
598 "No predicate with ID '%s' found",
604 std::shared_ptr<GroundedPDDLFormula>
605 ClipsExecutiveRestApi::gen_grounded_pddl_formula(
const CLIPS::Fact::pointer fact)
607 auto formula = std::make_shared<GroundedPDDLFormula>();
608 formula->set_kind(
"GroundedPDDLFormula");
610 formula->set_id(get_value<std::string>(fact,
"id"));
611 formula->set_formula_id(get_value<std::string>(fact,
"formula-id"));
612 formula->set_grounding(get_value<std::string>(fact,
"grounding"));
613 formula->set_is_satisfied(get_value<bool>(fact,
"is-satisfied"));
619 ClipsExecutiveRestApi::cb_list_grounded_pddl_formulas()
624 CLIPS::Fact::pointer fact = clips_->get_facts();
626 CLIPS::Template::pointer tmpl = fact->get_template();
627 if (tmpl->name() ==
"grounded-pddl-formula") {
628 rv.
push_back(*gen_grounded_pddl_formula(fact));
639 std::string
id = params.
path_arg(
"id");
644 CLIPS::Fact::pointer fact = clips_->get_facts();
646 CLIPS::Template::pointer tmpl = fact->get_template();
647 if (tmpl->name() ==
"grounded-pddl-formula" && get_value<std::string>(fact,
"id") ==
id) {
648 ret = *gen_grounded_pddl_formula(fact);
654 "No grounded formula with ID '%s' found",
660 std::shared_ptr<GroundedPDDLPredicate>
661 ClipsExecutiveRestApi::gen_grounded_pddl_predicate(
const CLIPS::Fact::pointer fact)
663 auto predicate = std::make_shared<GroundedPDDLPredicate>();
664 predicate->set_kind(
"GroundedPDDLPredicate");
666 predicate->set_id(get_value<std::string>(fact,
"id"));
667 predicate->set_predicate_id(get_value<std::string>(fact,
"predicate-id"));
668 predicate->set_grounding(get_value<std::string>(fact,
"grounding"));
669 predicate->set_is_satisfied(get_value<bool>(fact,
"is-satisfied"));
675 ClipsExecutiveRestApi::cb_list_grounded_pddl_predicates()
680 CLIPS::Fact::pointer fact = clips_->get_facts();
682 CLIPS::Template::pointer tmpl = fact->get_template();
683 if (tmpl->name() ==
"grounded-pddl-predicate") {
684 rv.
push_back(*gen_grounded_pddl_predicate(fact));
693 ClipsExecutiveRestApi::cb_get_grounded_pddl_predicates(
WebviewRestParams ¶ms)
695 std::string
id = params.
path_arg(
"id");
700 CLIPS::Fact::pointer fact = clips_->get_facts();
702 CLIPS::Template::pointer tmpl = fact->get_template();
703 if (tmpl->name() ==
"grounded-pddl-predicate" && get_value<std::string>(fact,
"id") ==
id) {
704 ret = *gen_grounded_pddl_predicate(fact);
710 "No grounded predicate with ID '%s' found",
717 ClipsExecutiveRestApi::gen_plan_precompute(PlanMap & plans,
718 PlanActionMap & plan_actions,
719 PreCompoundMap & prec,
721 PDDLGroundingMap & pgm,
722 PDDLFormulaMap & pfm,
723 PDDLPredicateMap & ppm,
724 GroundedPDDLFormulaMap & gpfm,
725 GroundedPDDLPredicateMap &gppm)
727 CLIPS::Fact::pointer fact = clips_->get_facts();
729 CLIPS::Template::pointer tmpl = fact->get_template();
730 if (tmpl->name() ==
"plan") {
731 plans[std::make_pair(get_value<std::string>(fact,
"goal-id"),
732 get_value<std::string>(fact,
"id"))] = fact;
733 }
else if (tmpl->name() ==
"plan-action") {
734 plan_actions[std::make_pair(get_value<std::string>(fact,
"goal-id"),
735 get_value<std::string>(fact,
"plan-id"))]
737 }
else if (tmpl->name() ==
"pddl-grounding") {
738 pgm[get_value<std::string>(fact,
"id")] = fact;
739 }
else if (tmpl->name() ==
"pddl-formula") {
740 pfm[get_value<std::string>(fact,
"id")] = (fact);
741 }
else if (tmpl->name() ==
"pddl-predicate") {
742 ppm[get_value<std::string>(fact,
"id")] = (fact);
743 }
else if (tmpl->name() ==
"grounded-pddl-formula") {
744 gpfm[get_value<std::string>(fact,
"grounding")].push_back(fact);
745 }
else if (tmpl->name() ==
"grounded-pddl-predicate") {
746 gppm[get_value<std::string>(fact,
"grounding")].push_back(fact);
753 ClipsExecutiveRestApi::gen_plan_compute_precons(PDDLFormulaTreeNode node,
754 PDDLFormulaTreeMap tree,
755 PDDLGroundingMap groundings)
757 CLIPS::Fact::pointer node_fp = std::get<0>(node);
758 CLIPS::Fact::pointer node_g_fp = std::get<1>(node);
759 CLIPS::Template::pointer tmpl = node_fp->get_template();
763 if (tmpl->name() ==
"pddl-predicate") {
764 formula.
set_kind(
"GroundedPredicate");
765 formula.
set_name(get_value<std::string>(node_fp,
"predicate"));
767 std::vector<std::string> param_names =
768 get_values(groundings[get_value<std::string>(node_g_fp,
"grounding")],
"param-names");
769 std::vector<std::string> param_values =
770 get_values(groundings[get_value<std::string>(node_g_fp,
"grounding")],
"param-values");
771 std::vector<std::string> predicate_param_values;
772 for (
const auto ¶m : get_values(node_fp,
"param-names")) {
773 auto it = std::find(param_names.begin(), param_names.end(), param);
774 if (it != param_names.end()) {
775 auto index = std::distance(param_names.begin(), it);
776 predicate_param_values.push_back(param_values[index]);
782 }
else if (tmpl->name() ==
"pddl-formula") {
783 formula.
set_kind(
"GroundedFormula");
784 formula.
set_name(get_value<std::string>(node_fp,
"id"));
785 formula.
set_type(get_value<std::string>(node_fp,
"type"));
787 get_value<std::string>(node_g_fp,
"is-satisfied") ==
"TRUE" ? formula.
set_is_satisfied(
true)
790 for (
const auto &child_node : tree[get_value<std::string>(node_fp,
"id")]) {
791 auto child = get_value<std::string>(std::get<0>(child_node),
"id");
792 formula.
addto_child(gen_plan_compute_precons(child_node, tree, groundings));
799 ClipsExecutiveRestApi::gen_plan(
const PlanKey & plan_key,
800 const CLIPS::Fact::pointer fact,
801 PlanActionMap & plan_actions,
802 PreCompoundMap & prec,
804 PDDLGroundingMap & pgm,
805 PDDLFormulaMap & pfm,
806 PDDLPredicateMap & ppm,
807 GroundedPDDLFormulaMap & gpfm,
808 GroundedPDDLPredicateMap & gppm)
810 const std::string &goal_id = get_value<std::string>(fact,
"goal-id");
811 const std::string &plan_id = get_value<std::string>(fact,
"id");
818 p.
set_cost(get_value<double>(fact,
"cost"));
819 if (plan_actions.find(plan_key) != plan_actions.end()) {
820 std::vector<std::shared_ptr<PlanAction>> actions;
822 for (
auto &pai : plan_actions[plan_key]) {
823 auto pa = std::make_shared<PlanAction>();
825 int64_t action_id = get_value<int64_t>(pai,
"id");
826 std::string operator_name = get_value<std::string>(pai,
"action-name");
829 pa->set_kind(
"PlanAction");
831 pa->set_id(action_id);
832 pa->set_operator_name(operator_name);
833 for (
const auto &pv : get_values(pai,
"param-values")) {
834 pa->addto_param_values(std::move(pv));
836 pa->set_state(get_value<std::string>(pai,
"state"));
837 pa->set_executable(get_value<bool>(pai,
"executable"));
838 pa->set_duration(get_value<double>(pai,
"duration"));
839 pa->set_dispatch_time(get_value<double>(pai,
"dispatch-time"));
840 pa->set_precondition(gen_pddl_grounding(pgm[get_value<std::string>(pai,
"precondition")]));
843 std::string grnd_name = *(pa->precondition()->id());
844 std::string op_name = *(pa->operator_name());
845 PDDLFormulaTreeMap grounded_parent_map;
847 for (
const auto &p : gpfm[grnd_name]) {
848 PDDLFormulaTreeNode node = std::make_tuple(pfm[get_value<std::string>(p,
"formula-id")], p);
849 grounded_parent_map[get_value<std::string>(pfm[get_value<std::string>(p,
"formula-id")],
853 for (
const auto &p : gppm[grnd_name]) {
854 PDDLFormulaTreeNode node =
855 std::make_tuple(ppm[get_value<std::string>(p,
"predicate-id")], p);
856 grounded_parent_map[get_value<std::string>(ppm[get_value<std::string>(p,
"predicate-id")],
862 for (
const auto &rnode : grounded_parent_map[op_name]) {
863 CLIPS::Fact::pointer root_fp = std::get<0>(rnode);
864 std::string root = get_value<std::string>(root_fp,
"id");
867 pa->set_preconditions(std::make_shared<GroundedFormula>(
868 gen_plan_compute_precons(rnode, grounded_parent_map, pgm)));
871 actions.push_back(std::move(pa));
874 std::sort(actions.begin(),
876 [](std::shared_ptr<PlanAction> &a, std::shared_ptr<PlanAction> &b) {
877 return *a->id() < *b->id();
886 ClipsExecutiveRestApi::cb_list_plans()
891 std::map<PlanKey, CLIPS::Fact::pointer> plans;
892 std::map<PlanKey, ClipsFactList> plan_actions;
895 PDDLGroundingMap pgm;
897 PDDLPredicateMap ppm;
898 GroundedPDDLFormulaMap gpfm;
899 GroundedPDDLPredicateMap gppm;
901 gen_plan_precompute(plans, plan_actions, prec, prea, pgm, pfm, ppm, gpfm, gppm);
903 for (
auto &pi : plans) {
905 gen_plan(pi.first, pi.second, plan_actions, prec, prea, pgm, pfm, ppm, gpfm, gppm)));
914 std::string goal_id = params.
path_arg(
"goal-id");
915 std::string
id = params.
path_arg(
"id");
920 std::map<PlanKey, CLIPS::Fact::pointer> plans;
921 std::map<PlanKey, ClipsFactList> plan_actions;
924 PDDLGroundingMap pgm;
926 PDDLPredicateMap ppm;
927 GroundedPDDLFormulaMap gpfm;
928 GroundedPDDLPredicateMap gppm;
930 gen_plan_precompute(plans, plan_actions, prec, prea, pgm, pfm, ppm, gpfm, gppm);
932 const PlanKey plan_key{goal_id,
id};
933 if (plans.find(plan_key) == plans.end()) {
935 "No plan for goal '%s' with ID '%s' found",
940 return gen_plan(plan_key, plans[plan_key], plan_actions, prec, prea, pgm, pfm, ppm, gpfm, gppm);
~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.
DomainFact representation for JSON transfer.
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
void set_kind(const std::string &kind)
Set kind value.
static std::string api_version()
Get version of implemented API.
void set_name(const std::string &name)
Set name value.
void set_param_values(const std::vector< std::string > ¶m_values)
Set param-values value.
DomainObject representation for JSON transfer.
void set_name(const std::string &name)
Set name value.
void set_type(const std::string &type)
Set type value.
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
void set_kind(const std::string &kind)
Set kind value.
static std::string api_version()
Get version of implemented API.
DomainOperatorParameter representation for JSON transfer.
void set_type(const std::string &type)
Set type value.
void set_name(const std::string &name)
Set name value.
DomainOperator representation for JSON transfer.
void addto_parameters(const std::shared_ptr< DomainOperatorParameter > &¶meters)
Add element to parameters array.
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
void set_kind(const std::string &kind)
Set kind value.
static std::string api_version()
Get version of implemented API.
void set_name(const std::string &name)
Set name value.
void set_wait_sensed(const bool &wait_sensed)
Set wait-sensed value.
std::optional< std::string > name() const
Get name value.
DomainPredicate representation for JSON transfer.
static std::string api_version()
Get version of implemented API.
void set_sensed(const bool &sensed)
Set sensed value.
void set_param_types(const std::vector< std::string > ¶m_types)
Set param-types value.
void set_name(const std::string &name)
Set name value.
void set_param_names(const std::vector< std::string > ¶m_names)
Set param-names value.
void set_kind(const std::string &kind)
Set kind value.
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
Goal representation for JSON transfer.
void set_message(const std::string &message)
Set message value.
void set_acquired_resources(const std::vector< std::string > &acquired_resources)
Set acquired-resources value.
std::optional< std::string > id() const
Get id value.
void set_parameters(const std::vector< std::string > ¶meters)
Set parameters value.
void set_id(const std::string &id)
Set id value.
void set_mode(const std::string &mode)
Set mode value.
void set_sub_type(const std::string &sub_type)
Set sub-type value.
void set_meta(const std::vector< std::string > &meta)
Set meta value.
void set_parent(const std::string &parent)
Set parent value.
void set_required_resources(const std::vector< std::string > &required_resources)
Set required-resources value.
void set_outcome(const std::string &outcome)
Set outcome value.
void set__class(const std::string &_class)
Set class value.
void set_kind(const std::string &kind)
Set kind value.
static std::string api_version()
Get version of implemented API.
void addto_plans(const std::string &&plans)
Add element to plans array.
void set_priority(const int64_t &priority)
Set priority value.
void set_error(const std::vector< std::string > &error)
Set error value.
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
void set_type(const std::string &type)
Set type value.
GroundedPDDLPredicate representation for JSON transfer.
static std::string api_version()
Get version of implemented API.
PDDLGrounding representation for JSON transfer.
static std::string api_version()
Get version of implemented API.
PDDLPredicate representation for JSON transfer.
static std::string api_version()
Get version of implemented API.
static std::string api_version()
Get version of implemented API.
Plan representation for JSON transfer.
void set_id(const std::string &id)
Set id value.
void set_goal_id(const std::string &goal_id)
Set goal-id value.
static std::string api_version()
Get version of implemented API.
void set_kind(const std::string &kind)
Set kind value.
void set_actions(const std::vector< std::shared_ptr< PlanAction >> &actions)
Set actions value.
void set_cost(const float &cost)
Set cost value.
void set_apiVersion(const std::string &apiVersion)
Set apiVersion value.
Container to return array via REST.
void push_back(M &m)
Add item at the back of the container.
LockPtr< CLIPSEnvManager > clips_env_mgr
CLIPS environment manager.
Base class for exceptions in Fawkes.
virtual const char * what_no_backtrace() const noexcept
Get primary string (does not implicitly print the back trace).
Mutex * objmutex_ptr() const
Get object mutex.
virtual void log_warn(const char *component, const char *format,...)=0
Log warning message.
Logger * logger
This is the Logger member used to access the logger.
Thread class encapsulation of pthreads.
const char * name() const
Get name of thread.
WebviewRestApiManager * webview_rest_api_manager
Webview REST API manager.
void unregister_api(WebviewRestApi *api)
Remove a request processor.
void register_api(WebviewRestApi *api)
Add a REST API.
Webview REST API component.
void add_handler(WebRequest::Method method, std::string path, Handler handler)
Add handler function.
REST processing exception.
REST parameters to pass to handlers.
std::string path_arg(const std::string &what)
Get a path argument.
Fawkes library namespace.