How to Program a Robot, and What Does It Have to Do with Lego?


Hi, everyone! I am Veronika Demedetska, a Tech Expert and Senior Software Engineer at AMC Bridge, PhD in Engineering Sciences. I have been working in IT in the domains of 3D graphics, CAD development, and robotics for 11 years. In this article, I will share my experience of developing an industrial robot simulator step by step and tell about the main components of such programs. So, if you work or would like to work in this sphere, you’ll find this article useful.

What are industrial robots? Let me put it straight: they are no Terminators. And in comparison with the Terminator, they are quite boring. However, their purpose is to replace a human where high operation accuracy, monotony, and extreme physical endurance are required.

For me, everything has started when I got a Lego robot from the Lego Mindstorms set for a birthday. It was one of those you could assemble one of several robot configurations. It also included software for its basic programming. It was my first attempt to assemble and develop a program for a robot. I would not say that I managed to teach it functionality, which was my original plan. But it was 100% successful in scaring my dog.

Already working in IT, I joined a project to develop an industrial robot simulator for a customer. It was then that I dived deep into robotics. Now I can tell you with certainty: if your objective is to create something significant, you will have to learn a mixture of many industries: mechanics, high- and low-level programming, physics, electronics, algorithms, Big Data, and so on. That’s why I love robotics: it is always cross-technological and offers endless opportunities for development and learning.

Robot Simulators: What They Are and What They Are For 

At the dawn of robotics, robot testing was held with real physical machines. But, certainly, if the price of the robot with a basic package starts from $50.000, every mistake costs a lot.

With technological development, it became clear that most tasks performed by robots can be modelled with the help of virtual devices. Companies have already started experimenting with simulating parts of the larger process rather than working with real robots and gained significant time, costs, and risks reduction.

So, a robot simulator is software that enables creating programs for robots and testing their performance without using real physical machines.

Let’s get technical now. In the sections below, I will tell you how to develop a robot simulator step by step, based on a project I worked on with the AMC Bridge team. Unfortunately, the NDA does not allow adding a video of the project to this article.

That’s why I will refer to the existing analogs and rely on your imagination.

Step 1. Modeling a Robot. Geometric and Physical Components

The first step in creating a full simulation system is a description of all elements that appear in the virtual scene: robots, peripheral devices, and any other objects.

First, let’s consider a model used for representing a robot in the simulator. You can see one of the most wide-spread configurations below—a robotic arm shown as a kinematic chain. This chain consists of links. Their quantity is unlimited and can range from one to an n-number.

A link is a rigid body with six degrees of freedom. Links are connected by joints that can mainly be divided into three types: fixed, linear, and rotary. The chain ends with an end effector that can have different configurations. The end effector has a tool center point (TCP) that serves as an origin and sets the coordinates of the end effector.

In general, end effectors are divided into two groups:

  • Grippers for pick-and-place operations.
  • Tools for processes. For instance, welding, painting, drilling.

Next, we select a format that will let us describe the robot and all the devices and objects in the scene. Moreover, the format should enable setting the hierarchy of the robot chain links and joint types.

We can either select from a number of existing formats or write our own. However, we may also go for one of the most popular formats—a simple Universal Robot Description Format (URDF). In fact, it is an ordinary XML-markup used in the Robot Operating System (ROS), but it has universal specifications for describing scenes and robots.

To describe the links and joints, we should set the following parameters:

For the links:

  • The mass.
  • The origin.
  • The inertia.
  • The geometry.
  • The material: color and texture.

For the chain joints:

  • Joints and limits types: fixed, linear, or rotate.
  • The hierarchy: parent and child links.
  • The origin.
  • The axis.

Additionally, we need to set the parameters that will describe the dynamics of the robot movement:

  • The friction.
  • The damping.
  • Velocity limits.
  • Other parameters.

The geometry of links, peripheral devices, and other objects is usually shown as meshes or breps. And the choice of the geometric presentation will depend on the selected viewer, which we will build in our program for the robot simulation.


For the visualization, we can choose one of the existing render engines. For example:

  • OpenGL
  • Blender Game E2ngine
  • HOOPS Visualize
  • Any self-developed solution

The rest of the article can be found on the Ukrainian version of the site.

Get In Touch