Five ways to program a cobot

Author: Martin Rytter

Are you searching for the single best way to program a robot. One robot programming language to rule them all? I am sorry, but it doesn’t exist, and it never will.

If my life as software developer taught me anything, it is that there will never be one programming language that is superior to all other languages at everything a programming language has to do. It is not practical to develop a device driver using JAVA. It does not make sense to develop an interactive web application using C++. Visual Basic is not a language I’ll ever love, but I am not alone in preferring it for when I need to do something quick with Excel.

Robot programming is no different than any other programming. There are many ways to program a robot. Here are five ways in which you can program a robot from Universal Robots:

Visual programming: Ease of use and flexibility

Many things a robot arm must do are simple and very common. Move the arm to a point or along a straight line. Set an output to activate a tool or read an input to know when the next part is ready. Modify how fast the arm must move or insert waiting time where necessary. Ask the user how many parts needs processing and use the answer to run the correct number of cycles. These are tasks you want to be able to program fast and with limited training. That is exactly what visual programming on a teach pendant lets you do.

More advanced robot programming often requires a computer, a development environment, or some other development infrastructure. Visual programming requires just the robot’s teach pendant. You build a visual program by inserting program nodes into a program tree and adjusting their parameters. This is an approach that is easy for anyone to get familiar with. Visual programming is also extremely flexible. It enables you to program your robot anywhere, in your office, in a test environment, or after the robot have been deployed on a production line.

The robot comes with a toolbox of common program nodes. Installing URCaps gives you access to additional nodes.

URScript: Unleash the power to do more

URScript is a “real programming language” (whatever that is) that gives you the power to do more.

Visual programs are automatically turned into URScript before they are executed by the robot. This means that you’re always using URScript, even though you might not realize it. It also means that everything you can do with a visual program, you can also do by writing URScript. And then some more.

Visual programs allow you to insert a special URScript program node. This lets you write script into your program simply by using the teach pendant. It is also possible to write script using a computer, either using URSim or whatever text-editor you prefer.

URScript is a dynamic language that requires no compilation. It supports arithmetic expressions, conditional logic, variables, matrixes, arrays, functions, scoping rules, threads, and more. The URScript manual introduces the language. It also provides a complete reference of standard functions.

URScript is different from most dynamic languages in one respect. URScript is designed for robot control and therefore uses a real-time-friendly scheduling policy that is compatible with the requirements of the robot’s control system. The control system expects an update on what to do with a 500 Hz frequency. URScript is executed in time slices using the same frequency, thus ensuring that robot control is reactive and deterministic.

URCaps: Develop robot software for others to use

URCaps are like “apps” or “plugins”. As a developer, you create your own URCap and package it for others to use. As an end user, you decide what URCaps you want installed on your robot. Many end-of-arm tools come with a URCap, but they can be created for any purpose.

A software developer kit (SDK) is available to developers that want to create their own URCaps. It allows you to create program nodes, installation settings, tool bars and other custom user interface components. A URCap can both contribute to the visual programming experience on the teach pendant and control the robot using URScript. It is also possible for a URCap to include daemon processes that run in the background. These are often used to communicate with external hardware and to interact with the control system while a robot is working.

URCaps offer endless possibilities for software developers, students, researchers, equipment vendors and anyone else that want to run software on robots.

External control: Control robot with software running elsewhere

Visual robot programs, URScript and URCaps are designed to run on a robot. No additional hardware is involved. However, the robot also allows for external control. This is for situations where you want to develop software that executes on external hardware such as a PC, PLC or on hardware that you are developing.

You can do different things with external control. You can monitor and control registers. You can load, start and stop programs. It’s also possible to externally control motion.

External control requires an ethernet connection to the robot. Apart from that, there are not really any restrictions on what the software can be. You can use any language and any hardware that is practical for you.

External control is enabled by several protocols. You can implement the client-side of these protocols yourself, but we recommend using a client library when there is one that fits your needs.

External control gives you a lot of power, but also a lot of responsibility. There are often things to think about that can make your development trickier than first expected.

For example, many robot users expect to use the teach pendant for certain tasks. This means that “external control” or “software on robot” often is not a question of either or – it’s often some of both. If you’re a student or researcher that develop something mostly for yourself to use, then this is maybe not that important. However, if you are developing a product for others to use, then it is important to end up with a user experience that everyone understands.

Another common set of challenges arise if you want to do external motion control. The robot’s built-in control system will respect safety settings and adjust motions to comply with the physical capabilities of the robot. This means that even though you have the power to externally control motion, the robot cannot always do exactly what you ask for. External motion control can be tricky, but it is possible.

ROS: Control robot from a ROS system

ROS is a great platform that offers powerful building blocks for developing your own robot software. ROS is used to develop mobile robot solutions, robot arm solutions and many other types of robotic solutions. ROS development is a special case of “external control”, but since ROS is so common, it deserves special mention.

Special drivers for both ROS1 and ROS2 are available. A ROS driver will typically run inside a ROS system on external hardware. From the robot’s perspective, the ROS driver is just a client library like ones we discussed in the section on external control. From a ROS world perspective, the ROS driver is a ROS node that provides access to control the robot arm.

In addition to the drivers, ROS-related URCaps are available that makes it possible to combine “visual programming on the teach pendant” with “external control using ROS”.

Conclusion

There are many ways to program a robot:

Some are flexible and makes it easy to get started. Others are advanced and powerful. Some are available just using the robot. Others require external hardware. Some are sufficient when developing something that only yourself will be using. Others are preferred when developing a solution for others to use.

I don’t see a future where one specific robot programming language will dominate all others, but I see one robot programming philosophy that should encompass all robot programming:

Programming simple tasks should be easy. Programming complicated tasks should be feasible. Combining everything into a solution should just work.

Local Office
  • Universal Robots USA, Inc
  • 27175 Haggerty Road, Suite 160
  • 48377 Novi, MI
Contact us: +1 844-462-6268
Contact us: + 1-844-GO-COBOT