10#ifndef _BATTERY_CHECK_HPP
11#define _BATTERY_CHECK_HPP
13#include <behaviortree_cpp/action_node.h>
16#include <driver_msgs/msg/power_state.hpp>
17#include <rclcpp/rclcpp.hpp>
18#include <std_msgs/msg/string.hpp>
33 const std::string & name,
const BT::NodeConfig & config,
34 rclcpp::Publisher<std_msgs::msg::String>::SharedPtr logger_pub,
35 rclcpp::Node::SharedPtr ros_node);
46 BT::NodeStatus
onStart()
override;
59 rclcpp::Node::SharedPtr ros_node_;
60 rclcpp::Publisher<std_msgs::msg::String>::SharedPtr logger_pub_;
61 rclcpp::Subscription<driver_msgs::msg::PowerState>::SharedPtr power_sub_;
63 std::atomic<float> logic_voltage_, act_voltage_;
64 std::atomic<bool> topic_received_;
66 bool is_battery_good(
float voltage);
67 void logger(
bool logic_check,
bool act_check);
Condition node to check the health status of battery voltage.
Definition: battery_check.hpp:24
BT::NodeStatus onRunning() override
Performs the battery check logic.
Definition: battery_check.cpp:33
void onHalted() override
Called when the node is halted.
Definition: battery_check.cpp:50
BT::NodeStatus onStart() override
Start logic.
Definition: battery_check.cpp:31
static BT::PortsList providedPorts()
Defines the input and output ports for this node.
Definition: battery_check.cpp:29