Mastering Turtlesim: Publishing Pose in the Terminal


Turtlesim is a versatile ROS (Robot Operating System) package that simulates a turtle swimming in a 2D environment. It provides a valuable learning platform for ROS beginners and helps developers understand and practice fundamental robotics concepts.

In this 1000-word blog post, we will explore the process of publishing the position and orientation (pose) of the turtle using terminal commands. This will equip your coding arsenal with the necessary skills to build more complex applications with Turtlesim and ROS.


Before diving into the implementation details, make sure you have:

1. Installed and set up ROS, preferably [ROS Noetic]( on Ubuntu 20.04.

2. Familiarity with ROS concepts and basic ROS commands.

3. A running instance of the ROS master using the command `$ roscore`.

4. Turtlesim package installed. You can install it using: `$ sudo apt-get install ros-noetic-turtlesim`

Understanding Turtlesim Nodes

Turtlesim provides two main nodes that will help us publish turtle's pose:

1. `/turtlesim`: the primary node responsible for managing the turtle, its appearance, and behavior.

2. `/turtle1/pose`: the node that contains information about the turtle's pose (position and orientation).

To visualize the current pose of the turtle, execute the following command:

$ rosrun turtlesim turtlesim_node

This will open the Turtlesim window with the turtle's default pose, with (x, y) coordinates set to (5.5, 5.5) and a 0-degree orientation.

Subscribing to the Pose Topic

Now that we know the relevant nodes, let's subscribe to the `/turtle1/pose` topic to access the turtle's position. Run the following command:

$ rostopic echo /turtle1/pose

You will see the turtle's pose continuously updating in the terminal, even if the turtle remains stationary. This is because Turtlesim publishes the pose message on every simulation update.

Publishing Pose using a Custom ROS Node

In this next step, we will create a custom publisher to display turtle's pose in a more readable and customized format. This involves creating a new Python script, an environment for the script, and modifying the script according to our needs. Here are the steps:

1. Creating a ROS Workspace

To keep our work organized, create a directory for our workspace and initialize an empty Catkin workspace:

$ mkdir -p ~/turtlesim_pose_ws/src$ cd ~/turtlesim_pose_ws/src$ catkin_init_workspace

2. Creating a new Package

Generate a new package within our workspace containing our Python script:

$ cd ~/turtlesim_pose_ws/src$ catkin_create_pkg turtlesim_pose_publisher rospy

Here, `turtlesim_pose_publisher` is the package name and `rospy` is the dependency (ROS Python library).

3. Writing the Python Script

Now, create the Python script that will publish the pose:

$ cd ~/turtlesim_pose_ws/src/turtlesim_pose_publisher$ mkdir scripts$ cd scripts$ touch$ chmod +x

Edit the `` file and add the following code:

!/usr/bin/env pythonimport rospyfrom turtlesim.msg import Posedef pose_callback(msg): rospy.loginfo("Turtle Pose: x = %.2f, y = %.2f, theta = %.2f", msg.x, msg.y, msg.theta)def pose_publisher(): rospy.init_node('pose_publisher', anonymous=True) rospy.Subscriber('/turtle1/pose', Pose, pose_callback) rospy.spin()if __name__ == '__main__': try: pose_publisher() except rospy.ROSInterruptException: pass

This script initializes a new ROS node 'pose\_publisher', subscribes to the `/turtle1/pose` topic, and listens for `Pose` messages. Whenever it receives a new `Pose` message, the `pose_callback` function logs the position and orientation of the turtle in a readable format.

4. Build and Run the Pose Publisher

Finally, build the new package and execute the script:

$ cd ~/turtlesim_pose_ws$ catkin_make$ source devel/setup.bash$ rosrun turtlesim_pose_publisher

You should see turtle's pose displayed in a neat format in the terminal.

Now, you may control the turtle and observe the terminal displaying the accurate pose of the turtle. To control the turtle, open a new terminal and input the following commands:

$ rosrun turtlesim turtle_teleop_key

Exploring Further

With the acquired knowledge, you can experiment and modify the pose publisher to suit your needs. Some suggestions for further exploration include:

1. Design a custom pose display format

2. Add a pose history and display the path of the turtle

3. Implement a node that publishes static or dynamic transform between different turtle instances

In conclusion, publishing the pose of the Turtlesim turtle in the terminal provides insights into working with ROS nodes and Python scripts. By mastering this ability, you will not only understand the fundamental concepts of the Robot Operating System but also those of real-world robotics applications. So, keep experimenting and build your ROS proficiency.

POS Terminals

Breaking through commercial boundaries for
complete payment experience

Portable Handheld POS Terminal With Printer-S600

- Built-in POS receipt printer uses 58*35mm printing paper, no need of print cartridges or ribbons for low operating cost, low noise and high speed while printing.

- Integration of Various Payment Methods, such as Magnetic stripe cards, IC cards, con-tactless cards,QR code payments.

- Support 4G,3G, 2G, Wi-Fi, Bluetooth, and GPS positioning, support blue-tooth printer mode and ESC/POS mode. Improve your efficiency.

- With premium quality 3100mAh 7.6V Li-ion battery, fast charging, long usage time and large capacity enduring working time.

- Android POS terminal receipt printer support preinstalled catering, store management APP. Free SDK support if you plan to make your own APP, Compatible with custom Android software.

Efficient Work

Mobile Portable Printer, 0.2 seconds to complete a code scan. It fits for 58mm receipt printer with Android 12.0 OS, more environmental and cleaner. A swift printing speed of 120mm/s boosts 20% working efficiency, and low noise while printing receipts offers you a comfortable working occasion.

Printing Speed

Paper Width

Paper Diameter

Scan code

Kingtop Financial Bank-Grade POS Terminals

·Trusted Point-of-Sale Platforms for Transaction Processing
·Reliable Receipt Printing and Long Battery Life
·Powerful and Versatile POS Systems for Retail Business
·All-in-one POS Systems for Efficient Transaction Processing
·Scalable Solutions with Bulk Discounts for Large Orders

Why Choose Us?

We’re here to help tailor our comprehensive business solutions to your specific needs.

5G Fast Connectivity

Our tablet devices are equipped with advanced 5G modules that support various network bands and protocols, which allows you to enjoy fast and stable internet access anytime and anywhere.

Rich Production Experience

We have been focusing on the production of intelligent mobile devices for 15 years, and we have a deep understanding of the industry trends and customer needs. We can provide you with high-quality products that meet your expectations and requirements.

Trouble Shooting

We have a professional and responsive customer service team that can solve any problems you encounter within 24 hours. You can also contact our engineers directly for technical support and guidance.


We can customize your tablet devices according to your specifications and preferences. You can choose the size, color, logo, software, hardware and accessories of your tablet devices. We will offer you the best solution that suits your budget and needs.

Prouduct Selection

We have a wide range of tablet devices for you to choose from, with different features, functions and prices. Our professional sales team will recommend the most suitable and cost-effective products for you based on your needs and preferences.


We have a professional R&D and design team that can develop innovative and unique tablet devices for you. We have 15 years of experience in software and hardware development, and we can create solutions that satisfy your customers and the market.Don’t miss this opportunity to get the best 5G tablet device for your business or personal use. Contact us today and get a free quote and sample!

Which POS Terminal is right for you?

Get the product features and functions you are looking for immediately.

Talk to us >        SAMPLE TEST >



IPS Screen,720*1280


3100mAh, 7.6V, long use time


120mm/s high-speed precision printing sign

Full specs→



IPS Screen,720*1440


2500mAh, 7.6V, long use time


100mm/s high-speed precision printing sign

Full specs→