40 #include <sensors/sensors.h> 43 #include <boost/foreach.hpp> 44 #include <boost/algorithm/string/replace.hpp> 56 sensors_chip_name
const *chip_name;
58 while ((chip_name = sensors_get_detected_chips(NULL, &number)) != NULL){
64 int main(
int argc,
char** argv){
66 char hostname_buf[1024];
67 int gethostname_result = gethostname(hostname_buf,
sizeof(hostname_buf));
69 if(gethostname_result == 0) {
70 hostname = hostname_buf;
74 ROS_WARN(
"Could not get system hostname: %s", strerror(errno));
77 if(!hostname.empty()) {
78 std::string hostname_clean = boost::replace_all_copy(hostname,
"-",
"_");
79 ros::init(argc, argv,
"sensor_monitor_"+hostname_clean);
89 if(!hostname.empty()) {
98 if( sensors_init(NULL) != 0 ) {
99 ROS_FATAL(
"Failed to initialize sensors library");
103 std::vector<std::string> ignore_sensors;
104 pnh.
getParam(
"ignore_sensors", ignore_sensors);
void setHardwareID(const std::string &hwid)
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
void add(const std::string &name, TaskFunction f)
virtual void buildStatus(diagnostic_updater::DiagnosticStatusWrapper &stat)=0
int main(int argc, char **argv)
#define ROS_INFO_STREAM(args)
bool getParam(const std::string &key, std::string &s) const
void enumerate_sensors(const std::vector< std::string > &ignore)
std::vector< SensorChipPtr > sensor_chips_
ROSCPP_DECL void spinOnce()