Robots are gradually but steadily becoming an integral part of our lives. Every day we see a variety of videos with robots jumping, running, or performing various tricks.

Many companies (including my previous employer) use ROS (Robot Operating System) to develop their robots. This set of libraries was created more than 10 years ago by robotics students in order not to rewrite the same things.

Now it is a fairly well-known system in the world, and several leading organizations cooperate with the ROS 2 version, and the Technical Steering Committee (TSC) includes such well-known companies as Amazon, Intel, Microsoft, Toyota.

Observant readers also noted that the list includes two of the three major players in the cloud platform business, and a third player, Google, is also not standing still, as noted in this article. We will return to this topic later.

Thus, ROS provides hardware abstraction, device drivers, libraries, visualizers, messaging, packet management, and more. Because the work being built decades ago was extremely unreliable, the system was designed so that the failure of one node would not stop the work of the entire robot. Therefore, the core of the system is built around the exchange of messages between nodes that know nothing about each other. All you know is the name of the messaging channel, its format, and the type of call.

There are three types of interaction:

  • Ordinary sender and recipient (publisher – subscriber). The sender sends his message to the recipient and does not wait for a response, but simply continues to perform its task. For example, the camera can publish photos at 30 Hz.
  • Service call. In this case, the sender is interested in receiving a response to his request and is waiting for a response. For example, a service to find the shortest path on the map from point A to point B.
  • Action server feedback services that work as a second type with the ability to receive feedback on the status of the task. For example, a file upload service may return a percentage of the data sent every second.

How to build robots with ROS

In general, the development of work begins with the CAD program (computer-aided design). The most popular among robot developers is SolidWorks. Recently, OnShape (online CAD, free for open models) has also become popular in the open-source robot development community. The development of electronics for the robot is also carried out at Altium.

URDF

The next phase of development is to create a URDF (Unified Robot Description Format) robot. URDF contains information about the appearance, limits of work (to calculate collisions), and physical properties (mass, inertia, nodes). With SolidWorks to URDF Exporter, you can generate URDF from a CAD model.

CAD

Of course, for people who have never encountered creating models in CAD programs or designing electronics, the first point seems to be a whole new unknowable world that they need to master. However, thanks to ROS, it can be bypassed at first and start developing a simulated robot model. This will allow you to test the algorithms in advance, before the appearance of a physical robot. As for the type of robot, the URDF works well with primitives such as a rectangular parallelepiped, cylinder, and sphere. Accordingly, you can create the first “rough” model of the robot and try to configure the controllers in the simulation.

Next, choose which regulators are needed for the robot. For example, to work with two motors and wheels plus a third passive wheel that rotates in all directions (as in an office chair), you can use a differential. To do this, you can use a ready-made controller from the ROS Control subsystem. Of course, the simulation does not perfectly convey the nature of the environment, and a certain class of tasks is simulated quite well, such as navigating the generated room.