-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change the way default port is passed, to allow namespaces
- Loading branch information
1 parent
3da7c29
commit bb5535e
Showing
10 changed files
with
270 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#include "behaviortree_ros2/bt_action_node.hpp" | ||
#include "rclcpp/rclcpp.hpp" | ||
#include "rclcpp/executors.hpp" | ||
|
||
#include "set_bool_node.hpp" | ||
|
||
using namespace BT; | ||
|
||
static const char* xml_text = R"( | ||
<root BTCPP_format="4"> | ||
<BehaviorTree> | ||
<Sequence> | ||
<SetBoolA value="true"/> | ||
<SetBool service_name="robotB/set_bool" value="true"/> | ||
<SetRobotBool robot="robotA" value="true"/> | ||
<SetRobotBool robot="robotB" value="true"/> | ||
</Sequence> | ||
</BehaviorTree> | ||
</root> | ||
)"; | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
rclcpp::init(argc, argv); | ||
auto nh = std::make_shared<rclcpp::Node>("bool_client"); | ||
|
||
BehaviorTreeFactory factory; | ||
|
||
// version with default port | ||
factory.registerNodeType<SetBoolService>("SetBoolA", BT::RosNodeParams(nh, "robotA/" | ||
"set_bool")); | ||
|
||
// version without default port | ||
factory.registerNodeType<SetBoolService>("SetBool", BT::RosNodeParams(nh)); | ||
|
||
// namespace version | ||
factory.registerNodeType<SetRobotBoolService>("SetRobotBool", nh, "set_bool"); | ||
|
||
auto tree = factory.createTreeFromText(xml_text); | ||
|
||
tree.tickWhileRunning(); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.