Class RosTopicLogger

Inheritance Relationships

Base Type

  • public BT::StatusChangeLogger

Class Documentation

class RosTopicLogger : public BT::StatusChangeLogger

A class to publish BT logs on BT status change.

Public Functions

inline RosTopicLogger(const rclcpp::Node::WeakPtr &ros_node, const BT::Tree &tree)

A constructor for nav2_behavior_tree::RosTopicLogger.

Parameters:
  • ros_node – Weak pointer to parent rclcpp::Node

  • tree – BT to monitor

inline void callback(BT::Duration timestamp, const BT::TreeNode &node, BT::NodeStatus prev_status, BT::NodeStatus status) override

Callback function which is called each time BT changes status.

Parameters:
  • timestamp – Timestamp of BT status change

  • node – Node that changed status

  • prev_status – Previous status of the node

  • status – Current status of the node

inline void flush() override

Clear log buffer if any.

Protected Attributes

rclcpp::Clock::SharedPtr clock_
rclcpp::Logger logger_ = {rclcpp::get_logger("bt_navigator")}
rclcpp::Publisher<nav2_msgs::msg::BehaviorTreeLog>::SharedPtr log_pub_
std::vector<nav2_msgs::msg::BehaviorTreeStatusChange> event_log_