I'm trying to modify the Dobot Post Processor to run the Dobots End Effectors and not having much success. Following这篇, 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 APIso 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
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.
01-08-2020, 09:19 PM(This post was last modified: 01-08-2020, 09:23 PM byamber.saffen.)
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.
01-13-2020, 07:06 PM(This post was last modified: 01-15-2020, 10:13 PM byPhillip.)
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.
01-15-2020,10:43 PM(This post was last modified: 01-15-2020, 10:49 PM byamber.saffen.)
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.
之间的区别到底是什么产生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\MoveandSuck.py === Traceback (most recent call last): File "C:\Users\amber.saffen\Documents\RoboDK\Tester\MoveandSuck.py", line 5, in from packaging import version ModuleNotFoundError: No module named 'packaging' >>>
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/MoveandSuck.py Connecting to: COM10 Traceback (most recent call last): File "c:/Users/amber.saffen/Documents/RoboDK/MoveandSuck.py", line 25, in dType.DobotConnect.DobotConnect_NoError: "DobotConnect_NoError", NameError: name 'dType' is not defined