.. _program_listing_file__tmp_ws_src_ros2_planning_system_plansys2_problem_expert_include_plansys2_problem_expert_ProblemExpert.hpp: Program Listing for File ProblemExpert.hpp ========================================== |exhale_lsh| :ref:`Return to documentation for file ` (``/tmp/ws/src/ros2_planning_system/plansys2_problem_expert/include/plansys2_problem_expert/ProblemExpert.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp // Copyright 2019 Intelligent Robotics Lab // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef PLANSYS2_PROBLEM_EXPERT__PROBLEMEXPERT_HPP_ #define PLANSYS2_PROBLEM_EXPERT__PROBLEMEXPERT_HPP_ #include #include #include #include #include "plansys2_msgs/msg/node.hpp" #include "plansys2_msgs/msg/param.hpp" #include "plansys2_msgs/msg/tree.hpp" #include "plansys2_pddl_parser/Utils.h" #include "plansys2_problem_expert/ProblemExpertInterface.hpp" #include "plansys2_domain_expert/DomainExpert.hpp" namespace plansys2 { class ProblemExpert : public ProblemExpertInterface { public: explicit ProblemExpert(std::shared_ptr & domain_expert); std::vector getInstances(); bool addInstance(const plansys2::Instance & instance); bool removeInstance(const plansys2::Instance & instance); std::optional getInstance(const std::string & name); std::vector getPredicates(); bool addPredicate(const plansys2::Predicate & predicate); bool removePredicate(const plansys2::Predicate & predicate); bool existPredicate(const plansys2::Predicate & predicate); std::optional getPredicate(const std::string & expr); std::vector getFunctions(); bool addFunction(const plansys2::Function & function); bool removeFunction(const plansys2::Function & function); bool existFunction(const plansys2::Function & function); bool updateFunction(const plansys2::Function & function); std::optional getFunction(const std::string & expr); plansys2::Goal getGoal(); bool setGoal(const plansys2::Goal & goal); bool isGoalSatisfied(const plansys2::Goal & goal); bool clearGoal(); bool clearKnowledge(); std::string getProblem(); bool addProblem(const std::string & problem_str); bool existInstance(const std::string & name); bool isValidType(const std::string & type); bool isValidPredicate(const plansys2::Predicate & predicate); bool isValidFunction(const plansys2::Function & function); bool isValidGoal(const plansys2::Goal & goal); private: bool checkPredicateTreeTypes( const plansys2_msgs::msg::Tree & tree, std::shared_ptr & domain_expert_, uint8_t node_id = 0); void removeInvalidPredicates( std::vector & predicates, const plansys2::Instance & instance); void removeInvalidFunctions( std::vector & functions, const plansys2::Instance & instance); void removeInvalidGoals(const plansys2::Instance & instance); std::vector instances_; std::vector predicates_; std::vector functions_; plansys2::Goal goal_; std::shared_ptr domain_expert_; }; } // namespace plansys2 #endif // PLANSYS2_PROBLEM_EXPERT__PROBLEMEXPERT_HPP_