Play with Robot Operating System (ROS) 2

October 26, 2024 (1y ago)

by Satrya

Background#

I've become an instructor at APTRG to teach about the Robot Operating System (ROS2). In this post, I want to share with you what we've learned together.

Chapter 1: Introduction#

  • We use Ubuntu Noble 24.04 LTS as Operating System.
  • Robot Operating System version is Jazzy EOL — support until 2029.
  • Our goal is to implement drone control with PX4 firmware.
  • We start from beginner to advance.
  • ROS2 has ROS Client Layer (RCL) and ROS Middleware Layer (RMW).
  • Robot implements Guidance, Navigation, and Control (GNC).

Jazzy Installation#

  • Follow the official guide here.
  • Make sure to source jazzy setup file to .bashrc

Beginner: CLI Tools#

  • Demo Turtlesim here.
  • Use RQT to show topic and call service.
  • Observe /cmd_vel
    • Twist -> linear and angular (x, y, z).
    • if linear: x++, turtle will go forward. otherwise
    • if angular: z++, turtle will yaw counter clockwise, otherwise.

Demo Turtlesim and RQT

Understanding Nodes#

  • Each node in ROS should be responsible for a single, modular purpose — e.g controlling the wheel motors, publishing sensor data.
  • Each node can send and receive data from other nodes via topics, services, actions, or parameters.

Understanding Topics#

  • ROS use topic to communicate between node.
  • Publish and Subscribe — Asynchronous N:M communication ()
  • Node can subscribe and publish many topics.

Understanding Services#

  • a service is a request/response pattern where a client makes a request to a node providing the service and the service processes the request and generates a response
  • Synchronous 1:1 communication.
  • Not use a service for continuous calls; topics or even actions would be better suited.

Understanding Parameters#

  • Nodes have parameters to define their default configuration values.
  • Can get and set parameter values from the command line.
  • Can also save the parameter settings to a file to reload them in a future session.

...#

References:#