1. run the relevant pkg and executable
ros2 run {turtlesim} {turtlesim_node}
  1. check available topics
ros2 topic list ## we publish sth relevant one.
ros2 topic info {interesting topic from list}
ros2 interface show {interesting type from the info above}

Depending on you need response or request, check the types (ex. float32, int, bool, ...)

  1. check available services
ros2 service list
ros2 service type {interesting topic} # check the type of the service
ros2 interface show {interesting type from the type above}
  1. make own pkg
ros2 pkg create {name_pkg} --build-type ament_python
  1. make node and make it executable
cd src/{name_pkg}/{name_pkg}
touch {name_node}.py
chmod +x {name_node.py}
  1. Name the nodes (3parts)
  2. Go to packages.xml
    1. depend: rclpy, ...
  3. fill the entry_points in setup.py

Subscribe something?

from turtlesim.msg import Pose 
self.pose_ = None # variable to contain the content
self.pose_subscriber_ = self.create_subscription(
    Pose, "turtle1/pose", self.callback_turtle_pose, 10) # msg_type, topic, fn, fq
def callback_turtle_pose(self, msg):
        self.pose_ = msg # update pose through getting msg.

Publish something?

from geometry_msgs.msg import Twist
self.cmd_vel_publisher_ = self.create_publisher(
            Twist, "turtle1/cmd_vel", 10) # publishes don't need a callback fn!

Control something?

(call some fn regulary?)