how to get timestamp from header
Hi ROS fans..
I am new in ROS.. I try to make a simple node that subscribes timestamp from a messages with a header and a timestamp here..
http://www.ros.org/doc/api/sensor_msgs/html/msg/JointState.html
As Describe in this tutorial
http://ros.org/wiki/ROS/Tutorials/WritingPublisherSubscriber%28python%29,
I make a simple coding like this..
#!/usr/bin/env python
import rospy
from sensor_msgs.msg import JointState
def callback(data):
rospy.loginfo(rospy.get_name() + ": I heard %s" % data.header)
def listener():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber('get_timestamp', JointState, callback)
rospy.spin()
if __name__ == '__main__':
listener()
But I get this error..
rospy.loginfo(rospy.get_name() + ": I heard %s" % data.header) TypeError: float argument required, not Header
why float argument required ? How to solve that problem..
Actually I am confuse with the Sensor_msgs/JointState, because the type of the header is std_msgs/header.
how to subscribe it from sensor_msgs/JointState to get timestamp ?
I hope someone can help me.. :) Thanks..