Robots in Architecture Forum

KUKA|prc - parametric robot control for Grasshopper => Support => Topic started by: kratzsci on April 19, 2021, 09:40:20 PM

Title: Python script not being generated in KRL
Post by: kratzsci on April 19, 2021, 09:40:20 PM
Good afternoon,

I have recently started testing our kuka|prc (Community edition) and have discovered python scripting. I have tried to implement some simple scripts into my grasshopper project and have gotten no errors on that end. However, the KRL produced by the project does not include any of my python scripts, making the simulation and final product rather different. Any help or suggestions would be greatly appreciated!

Thank you for your help.
Title: Re: Python script not being generated in KRL
Post by: Johannes @ Robots in Architecture on April 19, 2021, 10:39:37 PM
Hello,
There are some tricks to get C# scripting to work, I personally haven't worked with Python scripting though. Can you specify a bit closer what you mean that the KRL does not contain your scripts? Ideally attach a short example!
Thanks,
Johannes
Title: Re: Python script not being generated in KRL
Post by: kratzsci on April 20, 2021, 02:45:21 PM
I'm trying to get the arm to move until it reaches an object, which will be indicated by a digital input through a button press. I thought I could get the looped movement via a python loop that takes input from the digital input (see screenshot). The SRC file produced by grasshopper only has the PTP movements in it and seems to omit the digital input and the python script. The SRC file is attached as well.
Title: Re: Python script not being generated in KRL
Post by: Johannes @ Robots in Architecture on April 20, 2021, 02:59:51 PM
Hello,
Hmmm... I can only work from what I am seeing in the screenshot.
Basically all commands need to be provided as a list to the KUKA|prc Core component.

However, you are getting the WAIT FOR command and then use its output to set the amplitude of a Z-vector to change the position of your second PTP movement. Your Python script is only outputting "0", how should that affect the simulation?

Note that without mxAutomation you are not getting real-time data from the robot.

To write something like that you could use the Custom KRL component e.g.:
WHILE $IN[1]==FALSE
LIN_REL {Z -1.0}
ENDWHILE

That moves the robot down by 1 millimeter, checks the input and then repeats it until input 1 is TRUE.
The proper way would be to do that through interrupts, but if a millimeter is not a problem, that is propably the simplest way to do it.

Custom-KRL code will not show up in the simulation, though!

Hope that helps!
Best,
Johannes
Title: Re: Python script not being generated in KRL
Post by: kratzsci on April 20, 2021, 07:11:08 PM
The custom KRL component worked great. It seems much easier to implement than the python variation. Thank you so much for your help Johannes!
Title: Re: Python script not being generated in KRL
Post by: Johannes @ Robots in Architecture on April 20, 2021, 07:29:59 PM
Great!!