Class SequentialBTBuilder

Inheritance Relationships

Base Type

Class Documentation

class SequentialBTBuilder : public plansys2::BTBuilder

Public Functions

SequentialBTBuilder()
virtual void initialize(const std::string &bt_action_1 = "", const std::string &bt_action_2 = "", int precision = 3)

Initialize the builder with behavior tree templates.

Parameters:
  • bt_action_1[in] XML template for regular actions, default empty.

  • bt_action_2[in] XML template for durative actions, default empty.

  • precision[in] Precision for time calculations, default 3.

virtual std::string get_tree(const plansys2_msgs::msg::Plan &current_plan)

Generate a behavior tree XML from a plan.

Parameters:

current_plan[in] The plan to transform into a behavior tree.

Returns:

std::string containing the behavior tree XML.

inline virtual plansys2::Graph::Ptr get_graph()

Get the internal graph representation.

Returns:

Shared pointer to the graph.

inline virtual bool propagate(plansys2::Graph::Ptr)

Propagate temporal constraints through the graph.

Parameters:

graph[inout] The graph to propagate constraints through.

Returns:

True if propagation was successful, false if inconsistencies were found.

virtual std::string get_dotgraph(std::shared_ptr<std::map<std::string, ActionExecutionInfo>> action_map, bool enable_legend = false, bool enable_print_graph = false)

Generate a DOT graph representation for visualization.

Parameters:
  • action_map[in] Map of action IDs to execution information.

  • enable_legend[in] Whether to include a legend in the graph, default false.

  • enable_print_graph[in] Whether to print the graph to console, default false.

Returns:

std::string containing the DOT graph representation.

std::string add_action_to_bt(const plansys2_msgs::msg::PlanItem &plan_item, const std::vector<plansys2_msgs::msg::PlanItem> &previous_items)

Protected Attributes

std::string bt_action_
std::shared_ptr<plansys2::DomainExpertClient> domain_client_
std::shared_ptr<plansys2::ProblemExpertClient> problem_client_