Programming

Robot Programming: Methods and Tools

Programming robots is very different from writing other kinds of programs. In this case, the programmer not only writes the code but also interacts with the machine’s environment and its mechanics and electronics.

For robots, several programming languages ​​of different levels are used. It can be C++, Java, Python, and several others. They also use different programming environments and approaches.

The essence of robot programming

The field that combines science, engineering, and technology is robotics. It researches to create machines that can repeat a person’s actions and even replace him in many ways.

Robotics includes the design, creation, and programming of “smart” mechanisms, that is, robots. They are used in aerospace, healthcare, e-commerce, space exploration, transportation, and other industries.

The name “robot” comes from the Czech language, where it has the form robot. This term was used by the writer Karel Capek when in 1920, in the play “RUR” (“Rossum’s Universal Robots”), he called the humanoid machines artificially created by him in the factory similar to living people invented by him. In our time, approximately the same way we imagine androids or humanoids.

A new era of the industry began in 1959. The world’s first industrial robot Unimate was created in the USA.

Today, robotics has become one area that is developing at a very fast pace. Departing from the pages of a Czech science fiction writer, these developments are divided into different areas in real life.

Here are the five main areas of robotics:

  1. Operator interface. This is the ​​interaction between the robot and the controller (the person who controls its actions). Man and machine can be connected by touch panel, joystick, etc.
  2. Mobility or locomotion. Specifies how the machine moves in space, depending on the robot type. For movement, wheels, fins, and propellers (for example, in drones) can be used. If we are talking about a humanoid object, it moves on two limbs, like a person.
  3. Manipulators. This term refers to the part of the robot that is adapted to perform certain actions. Machine components include grips, pushers, claws, mechanical hands, and fingers. For example, if the task of an industrial robot is to move objects, it is equipped with a two-finger grip.
  4. Sensations and perception. This area of ​​robotics is responsible for how the machine navigates in space, recognizes objects, and reacts to its surroundings. With the help of this field, the robot receives information about the direction of movement, obstacles, and the location of the necessary objects. For example, encountering an obstacle on the way, he looks for how to get around it. The programmer must introduce such components for the machine to make the right decisions.
  5. Programming. Includes commands with which the robot acts in a given situation. It is necessary to design and build a computer program that will be executable and allow you to perform the tasks for which the machine is intended.

The choice of how to program industrial robots depends on their brand. Many people think that C++ or Visual Basic is being used. Languages ​​such as assembly are often used.

Today there are many programming languages ​​for machines – more than a thousand. We need to understand this topic more detail to determine how this branch of robotics works.

Robot programming methods

There are several options for how robots are programmed.

Pipeline approach

This scenario involves the following steps that make up the process:

  • Tracking information from the built-in sensors of the robot. All received data will turn into an input that the machine will receive to perform its tasks.
  • State Analysis. Using the input data obtained in the previous step, a description of the system’s main characteristics is compiled. The speed of movement of the robot, its orientation, and so on are evaluated.
  • Model Building and Forecasting. This stage is a dynamic work in which assistance is periodically provided in assessing the state of the robot and its model.
  • Planning. At this stage, a set of actions is determined for the task to be solved.
  • Management. The commands are converted and modifying the program that controls the robot’s behavior becomes possible.

Biological approach

More often, robotics uses technologies such as artificial intelligence and neural networks. Their task at this stage is to imitate a person’s biological neural brain activity. An important achievement of these technologies is the possibility of setting, embodied in 2016. Now you can train robots much like you teach commands to pets.

robot programming
robot programming python
software for robot programming

Biological and conveyor approaches are in many respects opposite to each other. But worthy results of the first speak for themselves.

Mixed Approaches

This is where technology converges. At the same time, the positive experience of biological and conveyor approaches is used. As a result, robots that are programmed in this way show better results than classical ones.

Popular robot programming languages

The few hundred programming languages ​​today are divided into two groups depending on their low or high level.

In the early 1950s, machine code was replaced by low-level languages. They made programming easier. They are still used today and are especially useful if the robot’s actions need to be strictly controlled. These languages ​​have an important drawback: the same actions of machines of different designs require writing separate programs. One program is needed to capture a robotic excavator and another for a robotic arm.

This problem only exists when working with high-level languages. They are more developed and easier to use. At the same time, the nuances of the design do not matter: any robot will execute the same command. But in such languages, you can write a program only for a device with a large amount of memory since it will take up a lot of space.

If control is passed through a translator, robot programming must be done in a low-level language. If the microcontroller has an Arduino-type board, you can use high-level languages ​​that are easier to work with. Different languages are often used for different tasks when programming a robot with several types of control. Such a machine can be considered a polyglot.

Below is a selection of the most popular languages ​​that robotics use.

You need to read a lot of literature for a detailed study of programming languages. We’ve only listed the main features of each to give you a general idea and explain why it made it to the leaderboard.

For each language, an example of the same program written in it is given. With this program, basic training usually begins. Its result is the appearance of the inscription Hello, world on the monitor or controller screen.

Assembly (“Assembler”)

This is a low-level language. It is very close to machine code. Since the advent of microcontrollers such as Arduino, this language has been used less frequently, as robots can now be controlled at a different level. Microcontrollers support control in C/C++ and other languages. But “Assembler” is still needed. It is used in cases where you need full control over the robot’s actions. Some conditions can be set to the machine only in this language.

robot programming
robot programming python
software for robot programming

global _main

extern_printf

section.text

_main:

push message

call _printf

add esp,4

ret

message:

db ‘Hello, World’, 10.0

Java

The point is that the Java virtual machine allows you to apply the same code on different robots. But this idea only sometimes works and sometimes slows down the execution of the program that brings the code to the mechanism. The virtual machine must first create an “image” of the operation of a specific program on this robot. This takes quite a lot of time.

But the universality of this language has made it widespread in robotics. There are special microcontrollers that are made for Java programming.

The programming of robots related to web technologies takes place in this language. Examples: a machine that shoots video with broadcast to the Internet, you can also specify a smart home system that uses JavaScript similar in principle.

One of the creators and promoters of the language is Simon Ritter. He also developed the Robotics Software Development Kit and demonstrated new robotic systems. This person is considered the most authoritative specialist in Java technologies.

class HelloWorldApp {

public static void main(String[] args) {

System.out.printIn(“Hello World!”); //Prints the string to the console.

}

}

MATLAB

A high-level language that has become popular with robotics engineers. In addition to MATLAB with its environment, languages ​​close to it have open-source interpreters, such as Octave.

robot programming
robot programming python
software for robot programming

This language allows you to write programs that process the information on a large scale and give accurate results. Therefore, MATLAB is suitable, in particular, for developing computer vision.

classdef hello

methods

function greet(this)

disp(‘Hello, World’)

end

end

end

Python

This language from the high-level group is valued for its ease of use. It also saves time in operations such as defining and casting variables.

There are many ready-made program execution codes (scripts) that have already been written. It is possible to use them to implement several basic functions. In addition, the language can be tied to scripts written in C / C ++, which means that those parts of the code that need high performance can be implemented in these languages. All this makes Python a universal language in almost all areas.

robot programming
robot programming python
software for robot programming

The language has become more and more popular lately. For example, Python is often used on the Raspberry Pi, a microcomputer ideal for experimenting and developing IoT devices. Contribute to the choice of language libraries containing ready-made solutions for basic programs. The simple and clear syntax allows you to create programs for programming robots in Python for children and beginners.

print(“Hello World”)

C/C++

C combines the best qualities of high- and low-level languages: the former’s convenience and the latter’s control. This language is easier to translate than many others into machine code. But C/C++ has a complex syntax and does not allow even the slightest error. A running program can be broken by just one misspelled line. Program linking in the GRL (Generic Robot Language) occurs in languages ​​such as C.

This high-level language is difficult at the stage of development, but after learning it, you can set almost any task.

robot programming
robot programming python
software for robot programming

Here are the areas where C++ is used:

  • software development;
  • creation of various programs, operating systems, and drivers for various devices;
  • Implement applications (in games, on high-performance servers, embedded systems).

C language:

#include <stdio.h>

int main(void)

{

printf(“hello, world\n”)

}

C++ language

#include <iostream>

int main()

{

std::cout<<“Hello, world!

\n”;

return 0;

}

Each of the programming languages ​​is suitable for certain actions. They have different syntaxes and work under different conditions.

To explain this with an illustrative example, we use the following situation. We need to get out of bed and out of the bedroom. If we were robots and this task had to be presented as a program, it would be written as follows.

In Python, the procedure would look like this:

  • open eyes
  • get out of bed
  • log off

In C++, the program would look different:

  • (Create a bedroom object)
  • (Create a bed object)
  • (Create an “I” object)
  • Open eyes

…etc.

Robot software

The software can be used for different purposes; based on this, there is its classification, which distinguishes:

  • Maintenance Tools. Needed to keep robots in top working condition using maintenance, calibration, and troubleshooting tools.
  • Means for representing and tracking the work of automated industrial robots. Show their status and level of efficiency.
  • Tools for creating models and simulating the actions of technical complexes. Such mechanisms and offline programming tools are needed to develop and customize robotic solutions before they are implemented in production.
  • Tools for creating additional software. With their help, the development and configuration of individual applications for controlling robots are carried out.
  • Means of software control of controllers. They are used when programming robots directly through logic controllers while using existing peripheral resources.
  • Application software tools. Refers to interfaces to external components or devices used to trigger specific robot actions.

According to another principle, two categories of software can be distinguished:

  • Controlling and managing. These include graphical interfaces for working with teleoperated systems, software designed to interact with autonomous robots on a point-n-click basis, and software for creating schemes for industrial robots;
  • Task Software. This includes simple drag-and-drop interfaces, customizable navigation paths, and programs designed specifically for deploying specific applications.

When developing software for industrial robots, safety requirements must be kept in mind and observed.

Development environment for programming robots

To control robots, various programming environments are used. They are divided into two main groups: visual and textual. In addition, there is a difference in universality. Programming environments are specialized for controlling a particular robot and are suitable for different robots manufactured by different companies.

  • NXT-G. This graphical environment was created for the famous Lego Mindstorms NXT robotics kit. With its help, the NXT Brick module is programmed. The interface of this software is intuitive, and robot control programs are created like flowcharts. Blocks are placed on LEGO beams along the axis of the action sequence. The program is executed in the order in which the blocks follow.
TrikStudio
robot programming
robot programming python
software for robot programming
  • TrikStudio. This program is designed for programming training robots by Trik. It includes a simulator with which you can test programs without using a robotic kit.
  • Microsoft Robotics Developer Studio (MRDS). This platform contains the visual programming language (VPL) and a simulation visual 3D environment. Describing robot action algorithms using the VPL language is more suitable for novice programmers. Also, this language is offered for study by students. Professional programmers can use C#. To create a program on the VPL platform, you must select the appropriate components for a given task and establish a connection between them.
  • RobotC is one of the best programming languages ​​for learning robots and preparing for competitions. Based on the C language. The development environment is easy to use, but it is paid software.
  • BricxCC is one of the most widely used tools that support the NXC programming language. The program is freely available, has various tools that allow you to work with Lego Mindstorms blocks, and is suitable for replacing standard Lego software, except drivers. Thanks to the built-in language libraries, you can work with the device at different levels. Both low-level ones are offered to access the inputs and outputs of the device and physical memory languages, and high-level ones (for example, to control motors or work with data received from sensors).
  • Arduino is another robot programming environment. The interface consists of the following elements: a text editor, a message output area, a text console, a toolbar with standard buttons, and a main menu. With this software, the computer can interact with the Arduino to transfer data or flash the code to the controller.

Nuances of programming industrial robots

Almost every manufacturer in the field of robotics develops its programming languages ​​and auxiliary software. Those who introduce robotics into production processes are primarily interested in developing supporting software that will be adapted to the existing conditions.

Also, work is underway in creating new and improving old technologies and introducing measuring systems that will help improve the quality of products.

Industrial robots, as a rule, are equipped with a complex software shell into which various additional extension modules can be added based on the task being solved. For example, you can connect modules for interaction with external monitoring devices (video surveillance, a system for measuring the applied load and torque), allowing the robotic mechanism to respond as needed when external conditions change.

Often there is a relationship between the robot controller and the programmable logic controller (PLC). With its help, the robot interacts with peripheral equipment.

There are two industrial robot programming types: online and offline. Usually, both are used at the same time. Some differences relate to programming methods, the capabilities of the languages ​​themselves, and the features of robots.

Online programming

It is carried out at the robot’s installation site and with the mechanism’s help. In this method, two methods stand out: Teach-In and Playback.

The first method (Teach-In, abbreviated as Teachen) consists in programming the robot’s movements in such a way that it is controlled by a console (joystick or buttons). At the same time, in the robot itself, a coordinate system is laid in the first axis, which is connected by a kinematic chain with the most remote point of the machine (that is, for a six-axis robot, this is the 6th axis). As a result, the location in space and the orientation of all the axes of the mechanism and its intended tool are always clear.

The robot controller remembers the reached location and repeats until all required operations have been completed. The complexity of these points (locations) sets the trajectory of the mechanism’s movement. Each item has its changeable parameters, speed of movement and angular rotation, accuracy, and axis configuration.

The second method is Playback. First, the robot is manually guided along the desired movement path and repeats the specified trajectory. This method is often used to program robots for painting or varnishing.

The disadvantage of online programming is the inability to conduct the production process at this time. In addition, high accuracy cannot be ensured, and making changes to the program is difficult.

Offline programming

In this case, programming is carried out without the participation of a robot on a computer. There is no need to stop the production process.

Programming in text form describes the course of a program in one of the languages. That is, the logic of the program is written as follows:

  • Trajectories and their sequence
  • Reading data from peripheral devices.
  • Interaction with maintenance personnel
  • Compliance with safety requirements

The program is then downloaded to the robot controller using a floppy disk or network connection. After that, you need to test for errors, correct them if necessary, and the program can be used.

The main task of creating a robot is writing the program code. For the machine to show all its capabilities in the best possible way and correctly perform the tasks it was created, it must compose the program correctly. Although the basics of robot programming are now available even to children, it must be borne in mind that it differs from writing a conventional computer program.

If a programmer needs to write ordinary code, then a robotic programmer needs to consider the relationship with the mechanics, electronics, and environment in which the robot will exist.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button