-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathros_topic_logger.h
More file actions
36 lines (25 loc) · 871 Bytes
/
ros_topic_logger.h
File metadata and controls
36 lines (25 loc) · 871 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#pragma once
#include <behaviortree_cpp_v3/loggers/abstract_logger.h>
#include <ros/ros.h>
#include <behaviortree_ros/StatusChangeLog.h>
#include <behaviortree_ros/StatusChange.h>
namespace BT
{
class RosTopicLogger : public StatusChangeLogger
{
static std::atomic<bool> ref_count;
public:
RosTopicLogger(TreeNode* root_node, ros::NodeHandle nh, const std::string topic_name = "behavior_tree_log");
~RosTopicLogger() override;
virtual void callback(Duration timestamp,
const TreeNode& node,
NodeStatus prev_status,
NodeStatus status) override;
virtual void flush() override;
private:
ros::NodeHandle nh_;
std::string topic_name_;
ros::Publisher status_change_pub_;
std::vector<behaviortree_ros::StatusChange> event_log_;
};
} // end namespace