-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bt : Use RosActionNode instead and split out SleepBtNode
- Loading branch information
Showing
7 changed files
with
132 additions
and
146 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
--- | ||
--- |
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 was deleted.
Oops, something went wrong.
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,30 @@ | ||
#pragma once | ||
#include <functional> | ||
|
||
#include <rclcpp/rclcpp.hpp> | ||
#include <rclcpp_action/rclcpp_action.hpp> | ||
|
||
#include "behaviortree_ros2/bt_action_node.hpp" | ||
#include "work_bt/action/bt_action_client.hpp" | ||
|
||
template<typename ActionType> | ||
class SimpleRosActionNode : public BT::RosActionNode<ActionType> { | ||
using RosActionNode = BT::RosActionNode<ActionType>; | ||
public: | ||
SimpleRosActionNode(const std::string& name, const BT::NodeConfig& config, std::shared_ptr<rclcpp::Node> node, std::string action_server_name, std::function<typename ActionType::Goal()> goal_generator) | ||
: RosActionNode(name, config, BT::RosNodeParams(node, action_server_name)), node(node), goal_generator(goal_generator) { | ||
} | ||
|
||
bool setGoal(typename RosActionNode::Goal& goal) override { | ||
goal = goal_generator(); | ||
return true; | ||
} | ||
|
||
BT::NodeStatus onResultReceived(const typename RosActionNode::WrappedResult &result) override { | ||
return BT::NodeStatus::SUCCESS; | ||
} | ||
|
||
private: | ||
std::shared_ptr<rclcpp::Node> node; | ||
std::function<typename ActionType::Goal()> goal_generator; | ||
}; |
Oops, something went wrong.