Intro
- https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Introducing-Turtlesim/Introducing-Turtlesim.html
 - https://docs.ros.org/en/humble/Tutorials/Beginner-CLI-Tools/Understanding-ROS2-Topics/Understanding-ROS2-Topics.html
 - See ROS Part 2
 
Turtlesim is a lightweight simulator for learning ROS 2. It illustrates what ROS 2 does at the most basic level to give you an idea of what you will do with a real robot or a robot simulation later on.
This tutorial touches upon core ROS 2 concepts, like nodes, topics, and services. All of these concepts will be elaborated on in later tutorials; for now, you will simply set up the tools and get a feel for them
- start turtlesim
 
ros2 run turtlesim turtlesim_node
[INFO] [1729587409.041614825] [turtlesim]: Starting turtlesim with node name /turtlesim
[INFO] [1729587409.072164425] [turtlesim]: Spawning turtle [turtle1] at x=[5.544445], y=[5.544445], theta=[0.000000]
- Use rqt_graph to see the running node and topics it’s subscribed to
- Click refresh if window is blank
 
 
rqt_graph
- use turtlesim
- Open another terminal to run a new node to control the turtle
 
 
ros2 run turtlesim turtle_teleop_keyRefresh rqt_graph to see how teleop node is interacting w/ the turtlesim node
In this setup, the/teleop_turtlenode publishes velocity commands to/turtle1/cmd_vel, which is consumed by/turtlesimto move the turtle. Additionally, action-related topics handle feedback and status for rotating the turtle to specific angles. Therqt_graphvisually represents the connections between nodes and the topics they communicate over.
- Show list of active topics
 
ros2 topic list/parameter_events
/rosout
/turtle1/cmd_vel
/turtle1/color_sensor
/turtle1/pose
- Show list of active topics with topic type
 
ros2 topic list -t/parameter_events [rcl_interfaces/msg/ParameterEvent]
/rosout [rcl_interfaces/msg/Log]
/turtle1/cmd_vel [geometry_msgs/msg/Twist]
/turtle1/color_sensor [turtlesim/msg/Color]
/turtle1/pose [turtlesim/msg/Pose]
- 
Show these topics in rqt_graph by unchecking the boxes under Hide:

 - 
See data being published on a topic
/teleop_turtlewill publish data over/turtle1/cmd_veltopic when you use the keys to move the turtle
 
ros2 topic echo /turtle1/cmd_vellinear:
  x: 0.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: -2.0
---
linear:
  x: 0.0
  y: 0.0
  z: 0.0
angular:
  x: 0.0
  y: 0.0
  z: 2.0
- View the publisher publishing data over cmd_vel topic with 2 subscribers subscribed to it
- Uncheck debug box
 /_ros2cli5009is the node created by the echo command
 
Show info on topics including number of publishers and subscribers
- Show Twist messages on 
/turtle1/cmd_vel 
 ros2 topic info /turtle1/cmd_velType: geometry_msgs/msg/Twist
Publisher count: 0
Subscription count: 2
Twist messages
- Twist messages have x,y,z components for angular and linear velocity
 
- Show the details of a message- the structure of data it expects
 
ros2 interface show geometry_msgs/msg/Twist- This same structure was shown with the echo command earlier
 
# This expresses velocity in free space broken into its linear and angular parts.
Vector3  linear
        float64 x
        float64 y
        float64 z
Vector3  angular
        float64 x
        float64 y
        float64 z
- Pubish data direclty to a topic from the command line
 
ros2 topic pub <topic_name> <msg_type> '<args>'- Example using YAML syntax
- With no command-line options, ros2 topic pub publishes the command in a steady stream at 1 Hz.
 
 
ros2 topic pub /turtle1/cmd_vel geometry_msgs/msg/Twist "{linear: {x: 2.0, y: 0.0, z: 0.0}, angular: {x: 0.0, y: 0.0, z: 1.8}}"Try the spawn service
- Use rqt to call the /spawn service and create another turtle
 








