Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ROS2 logger #100

Open
wants to merge 1 commit into
base: humble
Choose a base branch
from
Open

Conversation

tropappar
Copy link

Added logging to stdout using RCLCPP_DEBUG.
Pretty much a copy of the StdCoutLogger.

{
/**
* @brief RosLogger is a very simple logger that
* displays all the transitions on the console.
Copy link

@b-adkins b-adkins Jan 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* displays all the transitions on the console.
* displays all behavior node status transitions
* on the console.

@b-adkins
Copy link

b-adkins commented Jan 4, 2025

Oh hey, I wrote copy pasted one of these. Except mine logged to INFO.

So, I would like to suggest adding a member variable, optionally set in the constructor, to set the log level for transitions.

@b-adkins
Copy link

b-adkins commented Jan 4, 2025

I have two more thoughts about the design:

  1. The ROS logger would also be a useful parameter (member variable, set in the constructor). This maximizes the flexibility for the user -- they can use the ROS node's logger or a different logger (e.g. from rclcpp::get_logger("BT Transitions")). I have found multiple loggers, even in a single node, to be extremely useful to filter log message and show the DEBUG level selectively.
  2. If a constructor took a BT::TreeNode::Ptr instead of a tree object, then it would make the logger extremely flexible. This way, an API user could instantiate the logger for a subtree of interest, or (with log level as a parameter) log different subtrees at different log levels or under different loggers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants