RoboDK Forum
variable targets - Generate robot program issue- Printable Version

+- RoboDK Forum (//www.sinclairbody.com/forum)
+-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN)
+--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API)
+--- Thread: variable targets - Generate robot program issue (/Thread-variable-targets-Generate-robot-program-issue)



variable targets - Generate robot program issue-TDCN-03-16-2022

Hi
I just picked up RoboDK last week and have been working hard experimenting with the python API trying to get some basics down but there's something I don't quite understand. It might just be a limitation of the software or it is me not understanding how to use the postprocessor.

I want to use RoboDK for offline programming of my UR robot setup. I then want to transfer my code to the robot and have it run with minimal overhead of work on the online robot side. I'd rather do more work offline just to have it work online as easily as possible.

So on to my program:
In my program I want to generate I bunch of targets in a grid layout. The size of the grid is calculated from an input variable string that is sent to the robot at runtime. (The robot reads a qr code where the grid data is stored). This means that the target points are not known ahead of time.

My naive "solution":
Great I have python, I thought, so I quickly wrote up a python function that takes an input string and spits out the points and moves the robot around and everything works in the simulation where I pass the string to the python function using call arguments.

The issue:
The point where I don't understand RoboDK anymore is when I generate the robot program the compiled robot program has none of the python code in it and there is just a line with a call the my python program that looks something like "move_grid(""). So from this I gather that the python program cannot be translate automatically to UR-scripts.

如果我试着direc生成机器人程序tly from my python script (with a call to the function at the end of the file) the output file is just a bunch of points not depended on my input variable anymore. My functions are not respected and are not there anymore and it just spits out the points.

Is there any way that RoboDK can be set up so it spits out my functions or worst case a place to manually write the UR scripts that should be inserted into the code instead of the functions calls so I can get the full program for the UR-robot.

I Hope someone can help me. So far RoboDK have been great for setting up the simulated world, but now writing code for it feels a bit limited. It feels like I'd have to rewrite the whole program on the teach pendant anyway.


RE: variable targets - Generate robot program issue-Jeremy-03-17-2022

Hi,

You are indeed in a limitation of the software when it comes to translating python code to script code.
You can't really do what you are trying to do directly.
One day we will get there, but crating program with variables is a big can of worms if you consider we have to implement this for 40+ brands on over 100 post-processor.
What we first focused on is creating programs with a high number of points for applications like sanding, dispensing, welding, cutting, milling, etc.
创建项目并不是针对material handling types of applications (on the offline programming side at least, the simulation works well for both.)

But there is something else you can do to kind of bridge the gap.
If you look at this function in python: RunInstruction
//www.sinclairbody.com/doc/en/PythonAPI/robodk.html#robodk.robolink.Item.RunInstruction

You can insert raw script in your generated program.
You can also do the same with the program call from the UI using the small dropdown menu.

Jeremy


RE: variable targets - Generate robot program issue-TDCN-03-18-2022

Hi Jeremy

Thank you for the answer.
As I feared i'm on a limitation of the software that I wasn't aware of when I started. I totally get the can of worms it is to implement such language translation. A shame that the manufactures cannot settle on just a few simple standards. With the use cases you mention I can totally see the appeal to use RoboDK. It is quite awesome and easy it is to generate such targets and just get going quickly. I's just not for my project then. It has though been beneficial for me to use the software to verify quickly that my robot can indeed reach all the points it's supposed to.
I'm not sure the RunInstruction command will be good for me. It feels a bit hacky to do it that way, and there's no way of checking my code for bugs offline.

\ TDCN


RE: variable targets - Generate robot program issue-Jeremy-03-21-2022

You are right that there is no way of verifying your code this way.

I'm sorry that our product is not completely suited to streamline your project as you would have to do the simulation to verify the reach/singularity/collision for all your points and recreate the same process in the robot's native language. I understand this would feel a bit redundant.

Jeremy