1 #ifndef DECORATOR_TIMEOUT_NODE_H 2 #define DECORATOR_TIMEOUT_NODE_H 23 template <
typename _Clock = std::chrono::steady_clock,
typename _Duration = std::chrono::steady_clock::duration>
55 return { InputPort<unsigned>(
"msec",
"After a certain amount of time, " 56 "halt() the child if it is still running.") };
68 throw RuntimeError(
"Missing parameter [msec] in TimeoutNode");
124 #endif // DEADLINE_NODE_H const TreeNode * child() const
const std::string & name() const
Name of the instance, not the type.
const NodeConfiguration & config() const
The TimeoutNode will halt() a running child if the latter has been RUNNING for more than a give time...
size_t cancel(uint64_t id)
Cancels the specified timer.
static pthread_mutex_t mutex
TimeoutNode(const std::string &name, unsigned milliseconds)
void haltChild()
Halt() the child node.
TimerQueue< _Clock, _Duration > timer_
std::mutex timeout_mutex_
Result getInput(const std::string &key, T &destination) const
TimeoutNode(const std::string &name, const NodeConfiguration &config)
std::unordered_map< std::string, PortInfo > PortsList
virtual BT::NodeStatus tick() override
Method to be implemented by the user.
void setRegistrationID(StringView ID)
bool read_parameter_from_ports_
std::atomic< bool > child_halted_
uint64_t add(std::chrono::milliseconds milliseconds, std::function< void(bool)> handler)
Adds a new timer.
static PortsList providedPorts()
NodeStatus status() const
virtual BT::NodeStatus executeTick()
The method that should be used to invoke tick() and setStatus();.
void setStatus(NodeStatus new_status)