joint_state_publisher.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 from sensor_msgs.msg import JointState
5 
6 joint_states = None
7 def callback(msg):
8  global joint_states
9  print(msg)
10  joint_states = msg
11 
13  global joint_states
14  rospy.init_node('joint_states_latcher', anonymous=True)
15  rospy.Subscriber("joint_states_sub", JointState, callback)
16  pub = rospy.Publisher('joint_states_pub', JointState)
17  while not rospy.is_shutdown():
18  if joint_states:
19  print(joint_states)
20  joint_states.header.stamp = rospy.Time.now()
21  pub.publish(joint_states)
22  rospy.sleep(0.1)
23 
24 if __name__ == "__main__":
26 
27 
28 


jsk_interactive_marker
Author(s): furuta
autogenerated on Sat Mar 20 2021 03:03:33