title: ROS fail to publish to a different message type
body: <p>I wrote a node called <strong>translater</strong> that basically doesn't do anything except for translating one message type to another.</p>
  <p>It subscribes to a the topic <strong>pose_before</strong> and publishes to another topic <strong>pose_after</strong>.</p>
  <p>The topic <strong>pose_before</strong> is of message type &quot;PoseWithCovarianceStamped&quot; and <strong>pose_after</strong> is &quot;TransformStamped&quot;.</p>
  <p>The issue is that all values in <strong>pose_after</strong> remain 0 when they're being published, but when I try to print the values inside the callback they do respond correctly.</p>
  <pre><code>#!/usr/bin/env python
  import rospy
  from geometry_msgs.msg import PoseWithCovarianceStamped
  from geometry_msgs.msg import TransformStamped
  
  def callback(data):
      TransformStamped().transform.translation.x = data.pose.pose.position.x
      TransformStamped().transform.translation.y = data.pose.pose.position.y
      TransformStamped().transform.translation.z = data.pose.pose.position.z
      TransformStamped().transform.rotation.x = data.pose.pose.orientation.x
      TransformStamped().transform.rotation.y = data.pose.pose.orientation.y
      TransformStamped().transform.rotation.z = data.pose.pose.orientation.z
      TransformStamped().transform.rotation.w = data.pose.pose.orientation.w
  def listener():
      pub = rospy.Publisher('pose_after', TransformStamped, queue_size=40)
      pose_after = TransformStamped()
      rospy.init_node('translater', anonymous=True)
      rospy.loginfo(&quot;Publishing pose_after&quot;)
      rospy.Subscriber('pose_before', PoseWithCovarianceStamped, callback)
      rate = rospy.Rate(40)
      pose_after.header.stamp = rospy.Time.now()
      pose_after.child_frame_id = 'base_footprint'
      print(pose_after.transform.translation.x) # this prints (0,0)
      while not rospy.is_shutdown():
          pub.publish(pose_after)
          rate.sleep()
  
  if __name__ == '__main__':
      try:
          listener()
      except rospy.ROSInterruptException:
          pass
  </code></pre>
  <p>When I put the print line in callback then it actually is able to print the correct values, so I'm wondering why the values are lost outside of the callback. I've also tried assigning a global variable inside the callback but still didn't work.</p>