diff --git a/robomaster_pi/pup_position.py b/robomaster_pi/pup_position.py index 367d67b22b1d45cd79e632d8b6ffd876dd521c55..9f980f4d5dd20fcceade7e26c18e2f635c8d3d1a 100644 --- a/robomaster_pi/pup_position.py +++ b/robomaster_pi/pup_position.py @@ -1,6 +1,6 @@ import rclpy from rclpy.node import Node -from geometry_msgs.msg import PoseStamped +from geometry_msgs.msg import PoseStamped, Pose from tf2_ros import TransformListener, Buffer from tf2_geometry_msgs import do_transform_pose from builtin_interfaces.msg import Time @@ -19,7 +19,7 @@ class RobotPosePublisher(Node): transform = self.tf_buffer_.lookup_transform('map', 'base_link', Time()) pose_stamped = PoseStamped() pose_stamped.header = transform.header - pose_stamped.pose = transform.transform + pose_stamped.pose = transform.transform.translation self.publisher_.publish(pose_stamped) except Exception as e: self.get_logger().error('Failed to lookup transform: %s' % str(e))