Go to the documentation of this file.
19 const int number = getInput<int>(
"value").value();
20 if(
auto any_ptr = getLockedPortContent(
"vector"))
30 std::vector<int> vect = { number };
32 std::cout <<
"We created a new vector, containing value [" << number <<
"]\n";
34 else if(
auto* vect_ptr = any_ptr->castPtr<std::vector<int>>())
37 vect_ptr->push_back(number);
38 std::cout <<
"Value [" << number
39 <<
"] pushed into the vector. New size: " << vect_ptr->size() <<
"\n";
51 return { BT::BidirectionalPort<std::vector<int>>(
"vector"), BT::InputPort<int>(
"valu"
60 <root BTCPP_format="4" >
61 <BehaviorTree ID="TreeA">
63 <PushIntoVector vector="{vect}" value="3"/>
64 <PushIntoVector vector="{vect}" value="5"/>
65 <PushIntoVector vector="{vect}" value="7"/>
79 tree.tickWhileRunning();
Show how to access an entry in the blackboard by pointer. This approach is more verbose,...
static const char * xml_tree
std::unordered_map< std::string, PortInfo > PortsList
void registerNodeType(const std::string &ID, const PortsList &ports, ExtraArgs... args)
Tree createTreeFromText(const std::string &text, Blackboard::Ptr blackboard=Blackboard::create())
createTreeFromText will parse the XML directly from string. The XML needs to contain either a single ...
The BehaviorTreeFactory is used to create instances of a TreeNode at run-time.
static PortsList providedPorts()
PushIntoVector(const std::string &name, const NodeConfig &config)
NodeStatus tick() override
Method to be implemented by the user.
The SyncActionNode is an ActionNode that explicitly prevents the status RUNNING and doesn't require a...