MCPcopy Create free account
hub / github.com/BehaviorTree/BehaviorTree.ROS2 / callback

Method callback

behaviortree_ros2/src/bt_ros_logger.cpp:11–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9{}
10
11void RosLogger::callback(Duration timestamp, const TreeNode& node,
12 NodeStatus prev_status, NodeStatus status)
13{
14 using namespace std::chrono;
15
16 // get ros node pointer
17 auto ros_node = node_.lock();
18
19 if (ros_node) {
20
21 constexpr const char* whitespaces = " ";
22 constexpr const size_t ws_count = 25;
23
24 double since_epoch = duration<double>(timestamp).count();
25
26 RCLCPP_DEBUG(
27 ros_node->get_logger(), "[%.3f]: %s%s %s -> %s",
28 since_epoch, node.name().c_str(),
29 &whitespaces[std::min(ws_count, node.name().size())],
30 toStr(prev_status, true).c_str(), toStr(status, true).c_str());
31 }
32}
33
34void RosLogger::flush()
35{

Callers

nothing calls this directly

Calls 1

toStrFunction · 0.50

Tested by

no test coverage detected