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()) {
90 updater.setHardwareID(hostname);
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);