This documentation presents the RoboDK API for Python. With the RoboDK API you can create robot simulations and generate brand-specific programs for robots using a universal programming language. Whereas you can use the graphical user interface to create programs, you can extend RoboDK capabilities using a programming language such as Python.
The RoboDK API for Python integrates all the offline programming features of the RoboDK simulator and allows you to deploy automated applications for a large variety of robots and mechanisms.
- Brief introduction to the RoboDK API for Python:
- Brief introduction to simulation and offline programming:
- Sample application merged with RoboDK using the RoboDK API for C#:
- The latest version of the RoboDK API is available on GitHub:
The RoboDK API for Python is composed of the following two modules:
robolink Module: this module is the link between RoboDK and Python. Any item from the RoboDK item tree can be retrieved. Items are represented by the object Item. An item can be a robot, a reference frame, a tool, an object or a specific project.
robodk Module: this module is a robotics toolbox for Python, inspired from Peter Corke’s Robotics Toolbox: http://petercorke.com/Robotics_Toolbox.html. The following page provides an overview of the RoboDK API for Python: https://robodk.com/offline-programming
With the RoboDK API it is possible to simulate and program robots for applications as simple as pick and place or as complex as synchronizing the movements of many robots. RoboDK API example using Python:
from robolink import * # import the robolink library (bridge with RoboDK) RDK = Robolink() # establish a link with the simulator robot = RDK.Item('Robot') # retrieve the robot robot.setJoints([0,0,0,0,0,0]) # set all robot axes to zero target = RDK.Item('Target') # retrieve the Target item robot.MoveJ(target) # move the robot to the target # calculate a new approach position 100 mm along the Z axis of the tool with respect to the target from robodk import * # import the robodk library (robotics toolbox) approach = target.Pose()*transl(0,0,-100) robot.MoveL(approach) # linear move to the approach position
The same script used for simulation can be used for offline programming, which means that the appropriate program can be generated for the robot being used. RoboDK supports a large number of robot controllers and it is easy to include compatibility for new robot controllers using Post Processors. A quick overview of RoboDK Processors is provided in the following video: https://robodk.com/help#PostProcessor
1.1. How to install¶
To install the robodk package for Python manually, type:
pip install robodk
When you run programs from RoboDK you don’t need to have the RoboDK API for Python installed as RoboDK automatically sets the Python path to the RoboDK/Python folder which contains the required modules.
More information available in the PyPi page:
RoboDK uses the Python IDLE editor by default. It is possible to change these settings to automatically use Notepad (installed with RoboDK), Visual Studio Code or Pycharm in the menu:
- More information here:
RoboDK uses Python 3 by default. The robodk package is also compatible with Python 2.
Download and install RoboDK if don’t have RoboDK: https://robodk.com/download Follow these steps to verify if Python is working properly:
Program-Add Python Program. A new Python item will appear called
Double click the new Python program. A message should be displayed, provoked by an error raised inside the script. The message should list all items available in the station.
Right click the new program and select “Edit Python script” to modify it.
If a different message is displayed it means that RoboDK does not detect Python. If Python was installed properly it is possible to adjust the following settings for RoboDK to use Python properly: Tools-Options-Other
If you already installed RoboDK for Windows you should have Python 3 installed. If you didn’t install RoboDK with the Python option checked, install Python from the following link: https://www.python.org/downloads/windows/
RoboDK and Python must be installed separately on Mac computers. Download Python for Mac here: https://www.python.org/downloads/mac-osx/
Python 2 might be already installed on recent Mac computers. In that case it is not required to install Python.
RoboDK and Python may have to be installed separately on Linux. Download Python for Linux here:
Python 2 is installed by default with Ubuntu. In that case it is not required to install Python.
1.2. RoboDK API for Matlab¶
A Matlab version of the RoboDK API is available here:
1.3. RoboDK API for C#¶
A C# version of the RoboDK API is also available (based on the Nuget package). More information here: