5 from geometry_msgs.msg
import PoseStamped
7 if __name__ ==
'__main__':
8 rospy.init_node(
'publish_pose', anonymous=
True)
9 worldFrame = rospy.get_param(
"~worldFrame",
"/world")
10 name = rospy.get_param(
"~name")
11 r = rospy.get_param(
"~rate")
12 x = rospy.get_param(
"~x")
13 y = rospy.get_param(
"~y")
14 z = rospy.get_param(
"~z")
20 msg.header.stamp = rospy.Time.now()
21 msg.header.frame_id = worldFrame
22 msg.pose.position.x = x
23 msg.pose.position.y = y
24 msg.pose.position.z = z
25 quaternion = tf.transformations.quaternion_from_euler(0, 0, 0)
26 msg.pose.orientation.x = quaternion[0]
27 msg.pose.orientation.y = quaternion[1]
28 msg.pose.orientation.z = quaternion[2]
29 msg.pose.orientation.w = quaternion[3]
31 pub = rospy.Publisher(name, PoseStamped, queue_size=1)
33 while not rospy.is_shutdown():
35 msg.header.stamp = rospy.Time.now()