In this Robot Operating System 2 (ROS2) tutorial, we explain how to write a Python program and a ROS2 package from scratch that will send velocity control commands to a 2D mobile robot. As a model of a 2D mobile robot we use a ROS2 Turtlesim simulation. The developed ROS2 program will send velocity control messages with a fixed control frequency. In this tutorial, the robot will describe a circular trajectory shown in the figure below.

You can easily modify the developed code to program any other trajectory.
The main motivation for learning the material presented in this tutorial comes from the fact that all the implementation steps explained in this tutorial are the implementation steps that you will perform on a real robot. That is, to control a mobile robot, you need to send control commands. In this tutorial you will learn how to do that in Python. Later on, you can modify the code files presented in this tutorial and adapt them to a specific robotics application.
The YouTube tutorial is given below.