monitoring tool for raspberry pi ?

asked 2019-11-09 04:54:18 -0600

kallivalli gravatar image

updated 2019-11-10 05:49:43 -0600

hey guys

how to publish rpi basic hardware details like ram , temperature and memory etc through node

i have already checked below packages

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
        #hello_str = "hello world %s" % rospy.get_time()

if __name__ == '__main__':
    except rospy.ROSInterruptException:
edit retag flag offensive close merge delete


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 a subprocess.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".

Weasfas gravatar imageWeasfas ( 2019-11-14 09:26:14 -0600 )edit