15 #ifndef NAV2_BEHAVIOR_TREE__PLUGINS__CONDITION__IS_BATTERY_CHARGING_CONDITION_HPP_
16 #define NAV2_BEHAVIOR_TREE__PLUGINS__CONDITION__IS_BATTERY_CHARGING_CONDITION_HPP_
23 #include "nav2_ros_common/lifecycle_node.hpp"
24 #include "sensor_msgs/msg/battery_state.hpp"
25 #include "behaviortree_cpp/condition_node.h"
27 namespace nav2_behavior_tree
49 const std::string & condition_name,
50 const BT::NodeConfiguration & conf);
58 BT::NodeStatus
tick()
override;
67 BT::InputPort<std::string>(
68 "battery_topic",
"/battery_status",
"Battery topic")
80 void createROSInterfaces();
86 void batteryCallback(
const sensor_msgs::msg::BatteryState::ConstSharedPtr & msg);
88 rclcpp::CallbackGroup::SharedPtr callback_group_;
89 rclcpp::executors::SingleThreadedExecutor callback_group_executor_;
90 nav2::Subscription<sensor_msgs::msg::BatteryState>::SharedPtr battery_sub_;
91 std::string battery_topic_;
92 bool is_battery_charging_;
93 std::chrono::milliseconds bt_loop_duration_;
A BT::ConditionNode that listens to a battery topic and returns SUCCESS when battery is charging and ...
BT::NodeStatus tick() override
The main override required by a BT action.
static BT::PortsList providedPorts()
Creates list of BT ports.