Package: robodk
RoboDK API for PythonTherobodkpackage implements theRoboDK API for Python.The RoboDK API allows creating simulations for industrial robots, specific mechanisms and generating vendor-specific programs for robots.
With the RoboDK API for Python it is possible to simulate and program any industrial robot using Python programming language.
The RoboDK API provides an alternative to using vendor-specific programming languages.While RoboDK's graphical user interface can be used to create programs, it is possible to extend the robot controller limitations by using a universal programming language such as Python.
The following page provides an overview of the RoboDK API using Python:https://robodk.com/offline-programming.Therobodkpackage is available onPyPi.RoboDK can be used for a wide range of robot manufacturing applications, such as robot machining, 3D printing, synchronizing multiple robots, pick and place, and so on.Industrial Robot application examplesRobot libraryRoboDK BlogRoboDK ForumImportant:The RoboDK API is not the same as theRoboDK Plug-In interface.DocumentationTherobodkpackage includes the following modules:Therobolinkmoduleis 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.Therobomathmoduleis a robotics toolbox, inspired fromPeter Corke's Robotics Toolbox. For instance, matrix operations, projection, timers, etc.Therobodialogsmoduleis a dialogs toolbox. For instance, open and save file dialogs, message prompts, etc.Therobofileiomoduleis a file operation toolbox. File properties, CSV, FTP, etc.Theroboappsmoduleis a RoboDK Apps toolbox. More information can be found in ourApp loader documentation.You can find more information about RoboDK API in our documentation.Introduction to the RoboDK APIIntroduction to RoboDK for robot simulation and offline programmingTherobodkpackage for PythonRequirementsRoboDK Simulation SoftwarePython(Python 2 and Python 3 supported)Mac and Linux usually have Python 2 installed by default. Although it is not required, Python 3 can be installed on Linux by typing:sudo apt-get install pip3
sudo apt-get install idle3The RoboDK API can be used with a free RoboDK license.How to installBy default, RoboDK automatically uses thePYTHONPATHenvironment variable pointing to the/RoboDK/Python/folder to search for therobodkpackage. Alternatively, you can also install therobodkpackage for Python:# cd path-to-python/Scripts
pip install robodkRoboDK will automatically install external Python dependencies based on your usage. However, if you do not have an active ethernet connection or wish to install them all at once, you can specify external dependencies (see extras_require insetup.py):# cd path-to-python/Scripts
pip install robodk[cv,apps,lint]The Python interpreter and editor used by RoboDK can be set in:RoboDK - Tools - Options - PythonExampleThe following script shows an example that uses therobodkpackage for robot simulation and offline programming. For more examples using the API, see ourdocumented examples.fromrobodk.robolinkimport*# RoboDK's APIfromrobodk.robomathimport*# Math toolbox for robots# Start the RoboDK API:RDK=Robolink()# Get the robot item by name:robot=RDK.Item('Fanuc LR Mate 200iD',ITEM_TYPE_ROBOT)# Get the reference target by name:target=RDK.Item('Target 1')target_pose=target.Pose()xyz_ref=target_pose.Pos()# Move the robot to the reference point:robot.MoveJ(target)# Draw a hexagon around the reference target:foriinrange(7):ang=i*2*pi/6#ang = 0, 60, 120, ..., 360# Calculate the new position around the reference:x=xyz_ref[0]+R*cos(ang)# new X coordinatey=xyz_ref[1]+R*sin(ang)# new Y coordinatez=xyz_ref[2]# new Z coordinatetarget_pos.setPos([x,y,z])# Move to the new target:robot.MoveL(target_pos)# Trigger a program call at the end of the movementrobot.RunCode('Program_Done')# Move back to the reference target:robot.MoveL(target)Post ProcessorsThe same script used for simulation can be used for robot programming offline. This means a program will be automatically generated for your robot controller to reproduce the movements on the robot.
RoboDK supports a large number of robot controllers and it is easy to include compatibility for new robot controllers using Post Processors.More information about robot post processors here:Quick introduction to RoboDK post processorsHow to use Post ProcessorsTechnical ReferenceYou can find the most up to date list of supported robot controllers in our documentation forPost processors.ABB RAPID IRC5: for ABB IRC5 robot controllersABB RAPID S4C: for ABB S4C robot controllersAdept Vplus: for Adept V+ programming languageAllen Bradley Logix5000: for Allen Bradley Logix5000 PLCAubo: for AUBO robot controllersCLOOS: for CLOOS robot controllersComau C5G: for Comau C5G robot controllersDenso PAC: for Denso RC7 (and older) robot controllers (PAC programming language)Denso RC8: for Denso RC8 (and newer) robot controllers (PacScript programming language)Dobot: for educational Dobot robotsDoosan: for Doosan collaborative robotsEpson: for Epson robot controllersFanuc R30iA: for Fanuc R30iA and R30iB robot controllersFanuc R30iA_Arc: for Fanuc Arc weldingFanuc RJ3: for Fanuc RJ3 robot controllersGCode BnR: for B&R robot controllersGSK: for GSK robotsHCR: for Hanwha robot controllersHIWIN HRSS: for HIWIN robotsHyundai: for Hyundai robot controllersKAIRO: for Keba Kairo robot controllersKinova: for Kinova robotsKawasaki: for Kawasaki AS robot controllersKUKA IIWA: for KUKA IIWA sunrise programming in JavaKUKA KRC2: for KUKA KRC2 robot controllersKUKA KRC2_CamRob: for KUKA CamRob milling optionKUKA KRC2_DAT: for KUKA KRC2 robot controllers including DAT data filesKUKA KRC4: for KUKA KRC4 robot controllersKUKA KRC4_Config: for KUKA KRC4 robot controllers with configuration data in each lineKUKA KRC4_DAT: for KUKA KRC4 robot controllers including DAT data filesMecademic: for Mecademic's script code required by the Meca500 robotMecademic Python: it generates a Python script that can control the Mecademic Meca500 robot remotely.Mitsubishi: for Mitsubishi robot controllersMotoman/Yaskawa: for different Motoman robot controllers using Inform II and Inform III (JBI)Nachi AX FD: for Nachi AX and FD robot controllersOmron: for Omron/Techman robot controllersOTC: for Daihen OTC robot controllersPanasonic: For Panasonic PRG programs (requires Panasonic G2PC tools to compile ASCII files to binary files)Precise: for Precise Scara robotsRobostar: for Robostar robot controllersSiasun: for Siasun robot controllersSiemens_Sinumerik: for Siemens Sinumerik ROBX robot controllerStaubli VAL3: to generate Staubli VAL3 robot programs (CS8 controllers and later). It inlines the robot movements.Staubli VAL3_Machining: for Staubli VAL3 controllers that have the Machining HSM option.Staubli S6: for Staubli S6 robot controllersToshiba: for Toshiba robotsTechman: for Omron/Techman robot controllersUniversal Robots: for UR robots, it generates linear movements as pose targetsUniversal Robots URP: for UR robots, it generates a URP that can be loaded and modified in Polyscope (the UR robot controller)Universal Robots_RobotiQ: for UR robots including support for RobotiQ gripperUniversal Robots_MoveP: for UR robots, it generates linear movements as MoveP commandsYamaha: for Yamaha robotsApp loader Plug-InOnce you have a script working in Python, you can easily set it up as an App using the App loader plugin.
RoboDK Apps allow you to customize the RoboDK environment for simulation and offline programming.
RoboDK Apps can be easily distributed for production. More information here:Load scripts as plug-ins in RoboDKroboappsmoduleLinting (source-code checker)Pylint is a source-code, bug and quality checker for Python programming. Pylint is integrated by default when using RoboDK's default settings (VScode/VScodium text editor).If you prefer using other text editors you can use the pylint_robodk module with Pylint for linting. The following argument must be passed to pylint to activate this feature:--load-plugins=pylint_robodkMore about RoboDKMain websiteRoboDK DocumentationBlog