Position Control of Mobile Robot in Gazebo, Python, ROS2 Jazzy from Scratch | ROS2 Jazzy Tutorial

preview_player
Показать описание
#ros2jazzy #robotics #mechatronics #machinelearning #controltheory

In this Robot Operating System 2 (ROS2) Jazzy tutorial, we explain how to write a Python program and a ROS2 package from scratch that demonstrate how to implement all the components of a feedback controller for controlling the position of a mobile robot in 2D space. To investigate the performance of the controller, we use a Gazebo model of a differential drive mobile robot.

The controller receives robot position and robot orientation from a sensor, and calculates the linear and angular velocities for controlling the robot motion. The calculated values of linear and angular velocities are sent to the local motion controller (local differential drive controller). These values are set point values for the local motion controller. That is, the local motion controller should control the left and right wheels of the robot such that the robot body position and orientation follow the set point values.

The measured robot position and orientation are components of an odometry message. The full odometry message consists of robot position, robot orientation, robot linear velocity, and robot angular velocity. However, in this tutorial, for feedback control, we only use the position and orientation.

In particular, in this tutorial, we explain how to implement a Python class that embeds:

1) A ROS2 subscriber object for receiving the robot odometry information from a sensor. The subscriber uses a callback function to read and process the odometry information. This callback function is activated every time there is sensor data on a ROS2 sensor topic. The callback function adds a feedback loop to the system.
2) A ROS2 publisher object for sending the control velocity commands to the robot. The ROS2 publisher object uses a timer with a defined control period for calling a controller function. The controller function calculates and sends the control velocities to the Gazebo local motion controller (differential drive controller) which moves the robot.

Besides this, we explain how to establish a communication link between a ROS2 program and a Gazebo simulation of a differential drive robot.

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 will need to write a Python code that will read sensor information and that will send control commands. Later on, you can modify the code files presented in this tutorial and adapt them to a specific robotics application.

In the tutorial, we use a differential drive robot Gazebo model that comes with the Gazebo simulation demo package. That is, in the tutorial, we do not explain how to model a differential drive robot in Gazebo and ROS2. If you are interested in learning how to model a differential drive robot, we created a number of tutorials explaining how to model a differential drive robot from scratch in ROS2 and Gazebo.
Рекомендации по теме
Комментарии
Автор

The background sound comes from the computer fan.

aleksandarhaber
join shbcf.ru