Example: KUKA LBR iiwa and Sunrise

Started by Johannes @ Robots in Architecture, April 29, 2016, 04:11:19 PM

Previous topic - Next topic

Johannes @ Robots in Architecture

KUKA LBR iiwa and Sunrise
Requirements: Rhinoceros 5, Grasshopper 0.9.0076, KUKA|prc V2

Programming a KUKA LBR iiwa via Sunrise. Note that the redundant axis is mapped to E1 in KUKA|prc. In the code output, axis are numbered from A1 to A7, from the base to the flange.

USING COMPONENTS THAT ARE ONLY AVAILABLE TO MEMBERS

How to use Sunrise:
Import the KUKA|prc Sunrise library to your project and then adapt your program file as in the *.java file that is also attached as an example below.
If your setup is not too unusual, you just need to set the name of the tool, tool tip, and base in the *.java file.
When you start the program, a "File Open" dialog will pop up, asking you to select the *.xml file that you want to run.
So just like with KRC4 you can use USB sticks, network shares etc. Of course it is also possible to hardcode the paths, have multiple programs selectable via a GUI etc., you just need to adapt the Java code.

evo85210

I'm having some trouble with this example in particular, it's giving me an error in German (arbeitsraumfehler) and I'm not quite sure what it means.
I think it has to do with a bad setting on my iiwa?

if someone can give me some pointers on how to solve this, that'd be great.

----
side note: is it possible to set the default directory to a specific location else instead of documents?
this iiwa is being set up as a shared robot, I don't really want users getting confused when selecting the directory

Johannes @ Robots in Architecture

Hello,

Arbeitsraumfehler would relate to the work envelope. Did you setup the tool and base in the Sunrise Workbench and then also set the right names in the code that calls the KUKA|prc library?
Also make sure that you can switch the Sunrise Workbench between degrees and radians, so the angles need to be in the right format.
Regarding the path, take a look at the PRC_FileChooser.java file, which extends the JFileChoser. You should be able to set a different default path there.

Best,
Johannes

evo85210

ah, so I didn't correctly to set the base, as I didn't notice the robot in the example isn't set a the origin, that's all solved now.
is it possible to set the .java file to have the tool and base as variables that can be set thru the XML file? (just a thought)

for the directory, I took a look at the libraries, and i'm not quite sure what i'm suppose to do with PRC_FileChooser.java (I'm basically new to java)
However, I saw that in PRC_Core there's a file filter, fileChooser.setFileFilter(filter), so I tried adding fileChooser.setCurrentDirectory("E:") to PRC_Core, which workbench then tells me that the method is not applicable? i'm a bit confused, since both .setFileFilter() and .setCurrentDirectory() are methods of JFileChooser, I don't see why one works but not the other.

Also, for A3 (E1), the movement is quite obvious in the simulation, but when the application is ran on the iiwa, the movement of A3 is at very little. If I attach a radians just before LIN MOVE the simulation and actual movements seems similar. What's going on here? (seems like it's somehow been converted into radians automatically, but the iiwa reads it as degrees? in workbench preference the units is set as radians)
With the way A3 is controlled right now, it's basically manual input, is it possible for it to be automatically determined thru reverse kinetics like the other axis? (coming in future release?)

Johannes @ Robots in Architecture

Hello,

I cannot test it right now, but I would take a look at the CORE_ChooseXML() function in PRC_Core and try something like that...
PRC_FileChooser fileChooser = new PRC_FileChooser("E:\\");

Regarding the redundant axis, KUKA|prc uses degrees, so please use those. If you input radians instead you should get less movement, as radians are always much smaller.
Automating the position of the redundant axis is something that is very application-dependent, but it's on our todo list. Until we know if there will be more 7-axis robots from KUKA - the upcoming LBR iisy has got 6 axes - it's not that high, though. But you could e.g. already optimize the E1 value through Galapagos, by defining a fitness function based on the output of the Analysis component, e.g. minimizing process time and collisions.

Best,
Johannes

evo85210

When I try PRC_FileChooser fileChooser = new PRC_FileChooser("E:\\"), it tell me this constructor is undefined, but it's fine, for the file directory I've solved it with fileChooser.setCurrentDirectory(new java.io.File("E:\\")), I don't think this is the proper way to do it, but it works and I don't see any side effects for now.

for the degrees and radians, is there any settings for that in KUKA|prc?
everything in grasshopper is in degrees, the input values, the simulation, but when prc outputs an xml, it's converted into radians? (see attachments)

Johannes @ Robots in Architecture

Hello,

There is no switch in KUKA|prc between degrees and radians, KUKA|prc alsways assumes degrees and then puts it in the right format for each platform, i.e. radians for Sunrise!
Glad you were able to make it work, thanks for the feedback!

Best,
Johannes

richardblackwell

Hi! Richard Blackwell here. Im a relative newcommer to using PRC with the KUKA LBR but have some experiance with PRC for KRL output with a KR70. I have the added inconvenience of having to reinstall sunrise workbench and all software as we have not run our LBR in some years. Im just noting this as it may be that im running the wrong version of workbench or are missing options etc etc. For what its worth, everything else we have set up in the past seems to be running OK.

Im having an error just trying to do some basics to get running XML from PRC established. I Believe my tool and base are correctly named and both are trained, and my code simulates well. but I keep getting this error on the pendant right after loading my XML from the USB drive

here is the error message
ArrayIndexOutOfBounds.jpg

Just incase here is a look at my SRC file where sunrise project has been imported

Sunrise Project SRC view.PNG

Lastly. Best to my knowladge here are the lines of code the Error message address

From application.PRC_RunXML.run Ln 73:

      prc_Core.CORE_RUN(xmlout, robot, kuka_Sunrise_Cabinet_1, getApplicationData().createFromTemplate(toolname), tcpname, baseFrame, enablellogging, getLogger(), null, getApplicationData(), iogrp);

From prc_core.PRC_CORE.CORE_RUN ln 146:

PRC_CommandData lastcmd = xmlout.prccommands.get(xmlout.prccommands.size() - 1);

Im really guessing here, but im wondering if im missing some Java Libraries or I have improperly structured/imported the Sunrise project.

For what its worth, and Needless to say, PRC_RunXML does run and Creates the tool.

Any hints would be much appreciated!


Johannes @ Robots in Architecture

Hello Richard,

The nice thing about the iiwa is that you can debug it and step through code like you would do it for any Java software.
So going into the Debug view, setting a breakpoint at that line and then checking which variable is null would be the best approach.

Note that a tool has got a tool name and a TCP, so make sure they both exist. Also, check the IO Group if it exists or set it to null.

Best,
Johannes