joint_state_publisher.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 
00003 import rospy
00004 from sensor_msgs.msg import JointState
00005 
00006 joint_states = None
00007 def callback(msg):
00008     global joint_states
00009     print msg
00010     joint_states = msg
00011 
00012 def joint_state_publisher():
00013     global joint_states
00014     rospy.init_node('joint_states_latcher', anonymous=True)
00015     rospy.Subscriber("joint_states_sub", JointState, callback)
00016     pub = rospy.Publisher('joint_states_pub', JointState)
00017     while not rospy.is_shutdown():
00018         if joint_states:
00019             print joint_states
00020             joint_states.header.stamp = rospy.Time.now()
00021             pub.publish(joint_states)
00022         rospy.sleep(0.1)
00023 
00024 if __name__ == "__main__":
00025     joint_state_publisher()
00026 
00027 
00028 


jsk_interactive_marker
Author(s): furuta
autogenerated on Sun Sep 13 2015 22:29:27