Extracting raw data from Kinect
Hello all,
I am new to ROS and I would like to know how to subscribe to a topic and save the data in python. I understand how to log data using rosbag or to echo the data on the topic, but I do not know how to save the data to a variable. I am trying to modify the tutorial code to simply display the raw data.
#!/usr/bin/env python
import roslib; roslib.load_manifest('beginner_tutorials')
import rospy
from std_msgs.msg import String
def callback(data):
rospy.loginfo(rospy.get_name()+" %s ",data.data)
def listener():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber("camera/rgb/image_color", String, callback)
#declares that your node subscribes to the chatter topic which is of type s std_msgs.msgs.String
rospy.spin()
#keeps your node from exiting until the node has been shutdown
if __name__ == '__main__':
listener()
Any help would be greatly appreciated.
-Sean