battery_pub.h
Go to the documentation of this file.
1 //
2 // Created by sub on 31/10/17.
3 //
4 
5 #ifndef ARMADILLO2_HW_BATTERY_PUB_H
6 #define ARMADILLO2_HW_BATTERY_PUB_H
7 
8 #include <ros/ros.h>
10 #include <sensor_msgs/BatteryState.h>
11 #include <std_msgs/String.h>
12 
13 //#define BATT_PORT "/dev/BMS"
14 #define BATT_PUB_INTERVAL 2 //secs
15 #define SPEAK_LOW_BAT_INTERVAL 30 //secs
16 #define BATT_PORT_PARAM "~batt_port"
17 
18 namespace armadillo2_hw
19 {
20  class BatteryPub
21  {
22  private:
27 
28  std::string batt_port_;
29  int low_batt_val_ = -1;
30  bool show_warnings_ = false;
31  bool load_battery_hw_ = true;
32 
34 
35  void pubBatTimerCB(const ros::TimerEvent &event);
36 
37  void speakLowTimerCB(const ros::TimerEvent& event);
38 
39  void speakMsg(std::string msg, int sleep_time)
40  {
41  std_msgs::String speak_msg;
42  speak_msg.data = msg;
43  espeak_pub_.publish(speak_msg);
44  if (sleep_time > 0)
45  sleep(sleep_time);
46  }
47 
48  public:
50  };
51 }
52 
53 
54 
55 #endif //ARMADILLO2_HW_BATTERY_PUB_H
void publish(const boost::shared_ptr< M > &message) const
ros::Timer speak_low_batt_timer_
Definition: battery_pub.h:25
ros::Publisher espeak_pub_
Definition: battery_pub.h:33
bms::BMSInterface bms_
Definition: battery_pub.h:26
BatteryPub(ros::NodeHandle nh)
Definition: battery_pub.cpp:9
void speakLowTimerCB(const ros::TimerEvent &event)
Definition: battery_pub.cpp:53
ros::Publisher bat_pub_
Definition: battery_pub.h:23
void speakMsg(std::string msg, int sleep_time)
Definition: battery_pub.h:39
void pubBatTimerCB(const ros::TimerEvent &event)
Definition: battery_pub.cpp:58


armadillo2_hw
Author(s):
autogenerated on Wed Jan 3 2018 03:48:27