#include <power_monitor.h>
Public Member Functions | |
void | batteryServerUpdate (const boost::shared_ptr< const pr2_msgs::BatteryServer2 > &battery_server) |
void | configCallback (power_monitor::PowerMonitorConfig &config, uint32_t level) |
PowerMonitor () | |
void | powerNodeUpdate (const boost::shared_ptr< const pr2_msgs::PowerBoardState > &power_board_state) |
bool | setActiveEstimator (PowerStateEstimator::Type estimator_type) |
Private Member Functions | |
void | addEstimator (PowerStateEstimator *estimator) |
PowerObservation | extractObservation () |
std::string | masterStateToString (int8_t master_state) const |
void | onPublishTimer (const ros::TimerEvent &e) |
void | publishPowerState () |
Private Attributes | |
boost::shared_ptr < PowerStateEstimator > | active_estimator_ |
ros::Subscriber | battery_server_sub_ |
std::map< int, boost::shared_ptr< const pr2_msgs::BatteryServer2 > > | battery_servers_ |
dynamic_reconfigure::Server < power_monitor::PowerMonitorConfig > | config_server_ |
std::map< std::string, PowerStateEstimator::Type > | estimator_types_ |
std::map < PowerStateEstimator::Type, boost::shared_ptr < PowerStateEstimator > > | estimators_ |
int8_t | master_state_ |
PowerObservation | observation_ |
ros::Subscriber | power_node_sub_ |
ros::Publisher | power_state_pub_ |
ros::Timer | power_state_pub_timer_ |
boost::mutex | publish_mutex_ |
boost::mutex | update_mutex_ |
This class listens to BatteryServer2 and PowerBoardState messages and publishes PowerState messages with estimates of the time remaining until the robot switches off (if discharging) or until the robot is fully charged (if charging).
Definition at line 58 of file power_monitor.h.
PowerMonitor::PowerMonitor | ( | ) |
Definition at line 40 of file power_monitor.cpp.
void PowerMonitor::addEstimator | ( | PowerStateEstimator * | estimator | ) | [private] |
Definition at line 87 of file power_monitor.cpp.
void PowerMonitor::batteryServerUpdate | ( | const boost::shared_ptr< const pr2_msgs::BatteryServer2 > & | battery_server | ) |
Definition at line 116 of file power_monitor.cpp.
void PowerMonitor::configCallback | ( | power_monitor::PowerMonitorConfig & | config, | |
uint32_t | level | |||
) |
Definition at line 93 of file power_monitor.cpp.
PowerObservation PowerMonitor::extractObservation | ( | ) | [private] |
Definition at line 151 of file power_monitor.cpp.
string PowerMonitor::masterStateToString | ( | int8_t | master_state | ) | const [private] |
Definition at line 138 of file power_monitor.cpp.
void PowerMonitor::onPublishTimer | ( | const ros::TimerEvent & | e | ) | [private] |
Definition at line 198 of file power_monitor.cpp.
void PowerMonitor::powerNodeUpdate | ( | const boost::shared_ptr< const pr2_msgs::PowerBoardState > & | power_board_state | ) |
Definition at line 125 of file power_monitor.cpp.
void PowerMonitor::publishPowerState | ( | ) | [private] |
Definition at line 203 of file power_monitor.cpp.
bool PowerMonitor::setActiveEstimator | ( | PowerStateEstimator::Type | estimator_type | ) |
Definition at line 98 of file power_monitor.cpp.
boost::shared_ptr<PowerStateEstimator> power_monitor::PowerMonitor::active_estimator_ [private] |
Definition at line 84 of file power_monitor.h.
ros::Subscriber power_monitor::PowerMonitor::battery_server_sub_ [private] |
Definition at line 88 of file power_monitor.h.
std::map<int, boost::shared_ptr<const pr2_msgs::BatteryServer2> > power_monitor::PowerMonitor::battery_servers_ [private] |
Definition at line 79 of file power_monitor.h.
dynamic_reconfigure::Server<power_monitor::PowerMonitorConfig> power_monitor::PowerMonitor::config_server_ [private] |
Definition at line 73 of file power_monitor.h.
std::map<std::string, PowerStateEstimator::Type> power_monitor::PowerMonitor::estimator_types_ [private] |
Definition at line 81 of file power_monitor.h.
std::map<PowerStateEstimator::Type, boost::shared_ptr<PowerStateEstimator> > power_monitor::PowerMonitor::estimators_ [private] |
Definition at line 82 of file power_monitor.h.
int8_t power_monitor::PowerMonitor::master_state_ [private] |
Definition at line 78 of file power_monitor.h.
Definition at line 91 of file power_monitor.h.
ros::Subscriber power_monitor::PowerMonitor::power_node_sub_ [private] |
Definition at line 89 of file power_monitor.h.
ros::Publisher power_monitor::PowerMonitor::power_state_pub_ [private] |
Definition at line 87 of file power_monitor.h.
ros::Timer power_monitor::PowerMonitor::power_state_pub_timer_ [private] |
Definition at line 86 of file power_monitor.h.
boost::mutex power_monitor::PowerMonitor::publish_mutex_ [private] |
Definition at line 76 of file power_monitor.h.
boost::mutex power_monitor::PowerMonitor::update_mutex_ [private] |
Definition at line 75 of file power_monitor.h.