Rosanswers logo


I'm trying to catch turtlebot position so I can plot its trajectory.

More precisely, I'm trying to build and run a ros2 subscriber on "/Turtle_2/pose", where "/Turtle_2" is my turtlebot namespace. Using this subscriber, I want to store the turtlebot position in a memory to plot all of them. But as a first step, I wan to print("Hello") when the subscriber is triggered by a new message published on this "/Turtle_2/pose" topic, which is not.

For confidentiality reason, I cannot give you more code than my subscriber. I'm sry about that.


  • ros2 topic list contain the topic I'm looking for.

  • ros2 topic echo /Turtle_2/pose plot indeed real time information about my turtle position.

  • Running the subscriber don't plot anything (no trigger message nor error message)

  • OS ubuntu 20.04.2 LTS ; Gnome 3.36.8

  • Ros2 Foxy installed

  • Subscriber code :

    import rclpy from rclpy.node import Node

    from nav_msgs.msg import Odometry from std_msgs.msg import String from geometry_msgs.msg import PoseStamped

    class MinimalSubscriber(Node):

     def __init__(self):
         self.subscription = self.create_subscription(
     def listener_callback(self, msg):

    def main(args=None): rclpy.init(args=args)

     minimal_subscriber = MinimalSubscriber()
     # Destroy the node explicitly
     # (optional - otherwise it will be done automatically
     # when the garbage collector destroys the node object)

    if name == 'main': main()

  • This subscriber work on other topics like "Turtle_2/odom"

  • result of ros2 topic info -v /Turtle_2/pose:

    Type: geometry_msgs/msg/PoseStamped

    Publisher count: 1

    Node name: natnet_client Node namespace: /Turtle_2 Topic type: geometry_msgs/msg/PoseStamped Endpoint type: PUBLISHER GID: 01.0f.69.56.05.b0. QoS profile: Reliability: RMW_QOS_POLICY_RELIABILITY_BEST_EFFORT Durability: RMW_QOS_POLICY_DURABILITY_VOLATILE Lifespan: 2147483651294967295 nanoseconds Deadline: 2147483651294967295 nanoseconds Liveliness: RMW_QOS_POLICY_LIVELINESS_AUTOMATIC Liveliness lease duration: 2147483651294967295 nanoseconds

    Subscription count: 0

Any idea will be appreciated, thanks in advance.

Originally posted by Hedwin on ROS Answers with karma: 21 on 2022-03-01

Post score: 1


1 Answer 1


Rosanswers logo

A guy from my laboratory found the solution:

There was king of a communication problem, so the subscriber qos profile had to be redefined :

qos_sensor = QoSProfile(

self.get_logger().info('Use QoS Sensor')

self.subscription = self.create_subscription(

Thanks to everyone who tried to help

Originally posted by Hedwin with karma: 21 on 2022-03-15

This answer was ACCEPTED on the original site

Post score: 1


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.