Table of contents
Create a Turtle Location Subscriber
After starting the turtle simulation, ROS will publish a topic named "/turtle1/Pose" by default
Which publishes data of turtlesim/Pose type
Contains the position x, y of the turtle; yaw angle theta; linear velocity linear_velocity; angular velocity angular_velocity.
Now, we create a subscriber in the previous learning_pub_sub_pkg package to subscribe to the location of the turtle and print it to the terminal:
First, create a cpp file named pose_subscriber.cpp in the src folder of the learning_pub_sub_pkg package.
cd ros_wxw/src/learning_pub_sub_pkg/src/