Program Listing for File Utils.hpp
↰ Return to documentation for file (/tmp/ws/src/ros2_planning_system/plansys2_problem_expert/include/plansys2_problem_expert/Utils.hpp
)
// Copyright 2020 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__UTILS_HPP_
#define PLANSYS2_PROBLEM_EXPERT__UTILS_HPP_
#include <tuple>
#include <memory>
#include <string>
#include <map>
#include <vector>
#include <set>
#include <utility>
#include "plansys2_problem_expert/ProblemExpertClient.hpp"
#include "plansys2_domain_expert/DomainExpertClient.hpp"
#include "plansys2_msgs/msg/tree.hpp"
namespace plansys2
{
std::tuple<bool, bool, double> evaluate(
const plansys2_msgs::msg::Tree & tree,
std::shared_ptr<plansys2::ProblemExpertClient> problem_client,
std::vector<plansys2::Predicate> & predicates,
std::vector<plansys2::Function> & functions,
bool apply = false,
bool use_state = false,
uint8_t node_id = 0,
bool negate = false);
std::tuple<bool, bool, double> evaluate(
const plansys2_msgs::msg::Tree & tree,
std::shared_ptr<plansys2::ProblemExpertClient> problem_client,
bool apply = false,
uint32_t node_id = 0);
std::tuple<bool, bool, double> evaluate(
const plansys2_msgs::msg::Tree & tree,
std::vector<plansys2::Predicate> & predicates,
std::vector<plansys2::Function> & functions,
bool apply = false,
uint32_t node_id = 0);
bool check(
const plansys2_msgs::msg::Tree & tree,
std::shared_ptr<plansys2::ProblemExpertClient> problem_client,
uint32_t node_id = 0);
bool check(
const plansys2_msgs::msg::Tree & tree,
std::vector<plansys2::Predicate> & predicates,
std::vector<plansys2::Function> & functions,
uint32_t node_id = 0);
bool apply(
const plansys2_msgs::msg::Tree & tree,
std::shared_ptr<plansys2::ProblemExpertClient> problem_client,
uint32_t node_id = 0);
bool apply(
const plansys2_msgs::msg::Tree & tree,
std::vector<plansys2::Predicate> & predicates,
std::vector<plansys2::Function> & functions,
uint32_t node_id = 0);
std::pair<std::string, int> parse_action(const std::string & input);
std::string get_action_expression(const std::string & input);
int get_action_time(const std::string & input);
std::string get_action_name(const std::string & input);
std::vector<std::string> get_action_params(const std::string & action_expr);
} // namespace plansys2
#endif // PLANSYS2_PROBLEM_EXPERT__UTILS_HPP_