Complete the code to define a simple behavior tree node in ROS.
auto node = BT::NodeBuilder().name("[1]Node").build();
The node name should describe the action, here 'Move' fits a common robot behavior.
Complete the code to add a Sequence node to the behavior tree.
auto sequence = tree.root()->addChild(BT::[1]Node::create("Sequence"));
A Sequence node runs its children in order until one fails, so 'Sequence' is the correct node type.
Fix the error in the code to correctly tick the behavior tree root node.
BT::NodeStatus status = tree.root()->[1]();The correct method to update the behavior tree is 'tick()'.
Fill both blanks to create a Fallback node and add a child action node.
auto fallback = tree.root()->addChild(BT::[1]Node::create("Fallback")); fallback->addChild(BT::[2]Node::create("CheckBattery"));
A Fallback node tries children until one succeeds, and 'CheckBattery' is an action node.
Fill all three blanks to define a condition node, a decorator node, and add them to the tree.
auto condition = BT::[1]Node::create("IsObstacleDetected"); auto decorator = BT::[2]Node::create("Inverter"); decorator->addChild(condition); tree.root()->addChild([3]);
The condition node checks a state, the decorator modifies behavior, and the decorator is added to the tree.
