monitoring tool for raspberry pi ?
hey guys
how to publish rpi basic hardware details like ram , temperature and memory etc through node
i have already checked below packages
https://github.com/ethz-asl/ros-syste... http://wiki.ros.org/libsensors_monitor http://wiki.ros.org/robot_monitor http://wiki.ros.org/rosmon
advance Thank you
update: i have created but i dont get output in ros same im getting in python
import os
import sys
import rospy
from std_msgs.msg import String
def talker():
pub = rospy.Publisher('chatter', String, queue_size=10)
rospy.init_node('talker', anonymous=True)
rate = rospy.Rate(10) # 10hz
while not rospy.is_shutdown():
mycmd = 'vcgencmd measure_temp'
mycm5 = 'vcgencmd measure_volts'
mycm2 = 'free -m'
mycm3 = 'df -h'
mycm4 = 'ifconfig'
a = str(os.system(mycm2))
hi = "%s" %a
pub.publish(hi)
#pub.publish(os.system(mycmd))
#pub.publish(os.system(mycm3))
#pub.publish(os.system(mycm5))
#pub.publish(os.system(mycm4))
#hello_str = "hello world %s" % rospy.get_time()
#rospy.loginfo(hello_str)
#pub.publish(hello_str)
rate.sleep()
if __name__ == '__main__':
try:
talker()
except rospy.ROSInterruptException:
pass
This is not a ROS problem but python wise.
os.system
will run a command in a subprocess and wait for it to finish before running. You may want to run it in parallel with the parent process, then you should look at the subprocess module -- in particular, you'll want to create asubprocess.Popen
object.Furthermore, take into account the node runs in a particular rate, so the info you are obtaining with the publisher may not be in "real time".