Introduction to RoboDK’s API: How to Automate Repetitive Tasks

The RoboDK API offers a powerful set of tools for you to quickly and easily program more complex robot tasks. It is the perfect tool for automating repetitive robot programming tasks in your business.

For many people, RoboDK’s standard graphical user interface is their primary method for using the software. While this is a very intuitive way to program your robot – especially if you are a beginner – the software has a lot more capabilities than you might first realize.

With the API, you can create some very sophisticated programs in just a few lines of code in your favorite programming language.

Whether you’re looking to automate simple repetitive programming tasks or you want to take on more complex challenges, here’s how to use the API…

Automating Repetitive Tasks with RoboDK’s API

One of the tremendous benefits of using robots is that they can take over the dull and repetitive parts of people’s jobs.

But programming robots can also be dull and repetitive. When you have to perform the same programming and configuration steps over and over, you might wish that you had a robot to program your robot.

This is where the API comes in!

With the API, you can script and automate parts of your programming process in just a few lines of code.

Here are a few examples of programming tasks that you could automate:

  • Motion and trajectory generation — Perhaps you repeatedly need to generate new robot trajectories, such as when a new product is added to your production. You could create a program to generate these trajectories programmatically and then call the RoboDK API to generate the robot program.
  • Passing parameters from other programming steps — The more you automate your production line, the more you will need to pass information between different automation stages. You can use the API to create middleware programs between to act as a bridge between these steps.
  • Monitoring the robot’s performance — You can also create programs to monitor the operation of the robot. This could involve simple error reporting or a more complex setup with vision sensors. You could then use the API to send corrective instructions to the robot.

You could even employ more advanced programming techniques, such as using artificial intelligence and machine learning.

Understanding the 5 Elements of RoboDK’s API

What do you need to know about the RoboDK API? It’s helpful to understand the core components.

Below is an overview of the main 5 elements of the API. You can find out more details in the extensive API documentation (here the Python API).

The robolink module is the main module of the API. It provides the fundamental functionality to interact with the RoboDK software and your code.

Robolink can access any item from within your RoboDK program tree, load models, define tools, set robot movements, and generate programs.

2. robomath

Robotic programming often involves a lot of geometrical mathematics. These are difficult to calculate using the standard mathematics functions in most programming languages.

To make this math easier, we have implemented the robomath module, based on the Robotics Toolbox by Professor Peter Corke.

3. robodialogs

Much of the functionality in the graphical interface of RoboDK involves interacting with message boxes and other types of dialogs.

The robodialogs module contains functionality to handle these dialogs, including opening and saving files.

4. robofileio

RoboDK supports a wide variety of file types, including robot program files (such as ABB’s .mod or KUKA’s .ls), CAD files (such as .step or .stl), and standard data files (such as .txt or .csv).

The robofileio provides functionality to handle and analyze files, such as finding if files exist and generating safe variable names that can be used for robot programming.

5. roboapps

Finally, the roboapps module is the API interface for the RoboDK Apps toolbox.

The RoboDK App interface allows you to extend the functionality of RoboDK even further. It allows you to load scripts and executable files as if they were plug-ins in RoboDK software.

RoboDK API Python Robot Programming

An Example of Automating a Complex Trajectory with the API

What does it look like when you use the RoboDK API for more advanced programming automation?

Let’s look at an example of robot art generation (which is a common usage for RoboDK among artists). In this case, say we are using Python to create a fractal trajectory with the robot.

Programming a fractal with RoboDK’s graphical interface alone could be a very tricky activity. Fractals are, by nature, programmatic – they are defined by mathematical formulas. So it makes sense to use programs to create them instead of a graphical interface.

A basic form of fractal is the Koch curve. It is fairly simple to program a Koch curve in Python. Using the method explained in this example here to create a Koch Snowflake, you could generate a Koch curve in your Python code and send the resulting trajectory points to your robot with the RoboDK API. This would be possible in very few lines of code.

If you wanted even more complex fractal designs, such as the Barnsley Fern or Mandelbrot Set, you could also achieve these in a similar way. Most of your program would stay exactly the same – only the fractal generation function would change.

How to Get Started With the RoboDK API

The RoboDK API is a powerful tool that can help you optimize and streamline your robot programming process.

With programming languages like Python or MATLAB, programming doesn’t even have to be difficult. The languages themselves are intuitive enough that you don’t need to be a highly skilled programmer to create powerful programs.

Get started with the RoboDK API by heading over to the documentation and having a look at what it is capable of!

What programming tasks do you find repetitive? Tell us in the comments below or join the discussion on LinkedIn, Twitter, Facebook, Instagram, or in the RoboDK Forum.. Also, check out our extensive video collection and subscribe to the RoboDK YouTube Channel

About Alex Owen-Hill

Alex Owen-Hill is a freelance writer and public speaker who blogs about a large range of topics, including science, presentation skills at, storytelling and (of course) robotics. He completed a PhD in Telerobotics from Universidad Politecnica de Madrid as part of the PURESAFE project, in collaboration with CERN. As a recovering academic, he maintains a firm foot in the robotics world by blogging about industrial robotics.

View all posts by Alex Owen-Hill