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 


jsk_rviz_plugins
Author(s): Kei Okada , Yohei Kakiuchi , Shohei Fujii , Ryohei Ueda
autogenerated on Sat Mar 20 2021 03:03:18