Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Adding Dobot End Effector Function in Post Processor
I'm trying to modify the Dobot Post Processor to run the Dobots End Effectors and not having much success. Following this blogpost,  I made a copy of the Dobot Post processor and added two functions to turn the suction cup on and off and set that as my programs post processor. I then used the Program Call Instruction to call the function. However it just says the function was not found and skips it. 

When I generate the code the function definitions and call are there but RoboDK still skips the function call.

The code I use in the function comes directly from Dobot Studios Python generator/Dobot API so by all accounts should be the right code.

"Move and Suck" is the Code generated when I right click my program
"DobotwTools" is my edited Post Processor
I also attached a screenshot from RoboDK

Any help would be appreciated!

Attached Files Thumbnail(s)

.py   Move and (Size: 4.14 KB / Downloads: 122)
.py (Size: 21.45 KB / Downloads: 74)
The post processor and the result look good. I see you added the program calls in the header so if you generate the program (F6) you should be able to run it.
Where does it fail?

On the other hand, if you are using the driver ("Run on robot" option) it may fail as this command is not integrated in the driver. Is this what you are looking for?

Another detail: with Dobot you can buffer the commands so they are all executed in one step, avoiding jerky motion. This behavior can be changed using the isQueued flag.
It runs but when it gets to the suctionOn() function call it just prints "Program suctionOn() does not exist. Skipping function call."

When I generate the program, it generates fine and even has the function call where it should be. The robot will do all it's joint movements but skips the call.

To be more clear, it moves when I have 'Run on Robot' selected (but skips the function call). When I generate and send the program (Ctr+F6) it doesn't move at all.
The driver doesn't implement the suction on and as such the command gets skipped. The post processor generated program (Ctr+F6) not moving the robot at all means that the script is not running correctly. The console output from the program running often has useful insight on why it's not working.
For example the dobot library for python requires python 3.6.0 or later.
The python is definitely up to date. As for the console output, when I run it through "Run on robot", the only output is that it skipped the funtion. When I generate and send (Ctr+F6) I don't get any output. A console window pops up and closes quickly and then nothing. Is there some error log somewhere I can open?
When you choose the option generate a robot program as... (Shift+F6) you can choose a directory to generate the program in. You can then look at the generated files and run them outside of RoboDK . Running the program may require "DobotDll.dll" to be in the same directory as the program you are running. You can find find it in the "bin" folder of your RoboDK installation folder.
Alright, I tried that method, here's a picture of my mini-directory. When I run the MoveAndSuck file, the console window just flashes and disappears and the robot doesn't do anything.

What exactly is the difference between Generating the Program and Sending it (Ctr+F6) and checking "Run on Robot" then clicking "Run"? Since the second method is the only way the Dobot has responded at all, maybe that can clue me in on what's missing. Does only the first method use the Post Processor?

I ran it through IDLE this time and actually got some error log!

Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
=== RESTART: C:\Users\amber.saffen\Documents\RoboDK\Tester\ ===
Traceback (most recent call last):
File "C:\Users\amber.saffen\Documents\RoboDK\Tester\", line 5, in <module>
from packaging import version
ModuleNotFoundError: No module named 'packaging'

Attached Files Thumbnail(s)
To clarify, the difference between "run and robot" and "generate program" is that that when using "run on robot", robodk sends commands to the robot directly as the program is simulated in robodk but generally can't be easily modified by the user. "Generate program" generates a script using python that the robot executes. Since the dobot does not have a native scripting language the robodk post processor generates a python script that sends commands to the dobot. Generating the Program and Sending it simply automatically runs that script after it's generated.

The post processor is a python script so that you can add new functions to it like unique tools. The problem with you seem to having with running the script is that you don't have the python module "packaging" installed. You install python modules from the command line using a command like "pip install packaging"
I finally found the problem with my python packages and got past that error (even though I downloaded python fresh, pip still wasn't updated). Now it's having problems with the DobotDll import. When I try to run the program MoveandSuck I get

PS C:\Users\amber.saffen> & C:/RoboDK/Python37/python.exe c:/Users/amber.saffen/Documents/RoboDK/
Connecting to: COM10
Traceback (most recent call last):
File "c:/Users/amber.saffen/Documents/RoboDK/", line 25, in <module>
dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError",
NameError: name 'dType' is not defined
The required DLL is here:

Did you install RoboDK 64 bit or 32 bit?
Can you provide the Python file you are trying to run?

Users browsing this thread:
1 Guest(s)