Nav2 Navigation Stack - rolling  main
ROS 2 Navigation Stack
log_action.hpp
1 // Copyright (c) 2026 Open Navigation LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #ifndef NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__LOG_ACTION_HPP_
16 #define NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__LOG_ACTION_HPP_
17 
18 #include <string>
19 
20 #include "behaviortree_cpp/action_node.h"
21 
22 namespace nav2_behavior_tree
23 {
24 
33 class LogAction : public BT::SyncActionNode
34 {
35 public:
41  LogAction(const std::string & name, const BT::NodeConfiguration & config)
42  : BT::SyncActionNode(name, config) {}
43 
50  static BT::PortsList providedPorts()
51  {
52  return {
53  BT::InputPort<std::string>("level", "Log level: DEBUG, INFO, WARN, ERROR, or FATAL"),
54  BT::InputPort<std::string>("message", "Message to log"),
55  };
56  }
57 
63  BT::NodeStatus tick() override;
64 };
65 
66 } // namespace nav2_behavior_tree
67 
68 #endif // NAV2_BEHAVIOR_TREE__PLUGINS__ACTION__LOG_ACTION_HPP_
A BT::SyncActionNode that logs a message through the BT navigator's ROS logger.
Definition: log_action.hpp:34
LogAction(const std::string &name, const BT::NodeConfiguration &config)
A constructor for nav2_behavior_tree::LogAction.
Definition: log_action.hpp:41
BT::NodeStatus tick() override
Logs the input message at the specified level using the blackboard's node.
Definition: log_action.cpp:23
static BT::PortsList providedPorts()
Creates list of BT ports.
Definition: log_action.hpp:50