19 printf(
"Converting string: \"%s\"\n", str.data() );
23 if (parts.size() != 2)
47 setOutput(
"goal", mygoal);
52 return { OutputPort<Position2D>(
"goal") };
66 auto res = getInput<Position2D>(
"target");
69 throw RuntimeError(
"error reading port [target]:", res.error() );
72 printf(
"Target positions: [ %.1f, %.1f ]\n", goal.x, goal.y );
79 const char* description =
"Simply print the target on console...";
80 return { InputPort<Position2D>(
"target", description) };
104 <root main_tree_to_execute = "MainTree" > 105 <BehaviorTree ID="MainTree"> 106 <Sequence name="root"> 107 <CalculateGoal goal="{GoalPosition}" /> 108 <PrintTarget target="{GoalPosition}" /> 109 <SetBlackboard output_key="OtherGoal" value="-1;3" /> 110 <PrintTarget target="{OtherGoal}" />
void registerNodeType(const std::string &ID)
Position2D convertFromString(StringView str)
static PortsList providedPorts()
NodeStatus tick() override
Method to be implemented by the user.
CalculateGoal(const std::string &name, const NodeConfiguration &config)
static PortsList providedPorts()
NodeStatus tick() override
Method to be implemented by the user.
PrintTarget(const std::string &name, const NodeConfiguration &config)
std::vector< StringView > splitString(const StringView &strToSplit, char delimeter)
The SyncActionNode is an ActionNode that explicitly prevents the status RUNNING and doesn't require a...
The BehaviorTreeFactory is used to create instances of a TreeNode at run-time.
nonstd::string_view StringView
Tree createTreeFromText(const std::string &text, Blackboard::Ptr blackboard=Blackboard::create())
static const char * xml_text
std::unordered_map< std::string, PortInfo > PortsList
virtual NodeStatus executeTick() override
throws if the derived class return RUNNING.
double convertFromString< double >(StringView str)