twist_stamped_add_header.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import rospy
4 import sys
5 from geometry_msgs.msg import Twist, TwistStamped
6 
7 rospy.init_node("twist_stamped_add_header")
8 pub = rospy.Publisher("cmd_vel_stamped", TwistStamped)
9 
10 def callback(msg):
11  global pub
12  output = TwistStamped()
13  output.header.stamp = rospy.Time.now()
14  output.header.frame_id = sys.argv[1]
15  output.twist = msg
16  pub.publish(output)
17 
18 if len(sys.argv) != 3:
19  print("Usage: twist_stamped_add_header frame_id topic")
20 
21 sub = rospy.Subscriber(sys.argv[2], Twist, callback)
22 rospy.spin()
23 
twist_stamped_add_header.callback
def callback(msg)
Definition: twist_stamped_add_header.py:10


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Fri Aug 2 2024 08:50:15