Robots in Architecture Forum

KUKA|prc - parametric robot control for Grasshopper => Tutorials => Topic started by: Johannes @ Robots in Architecture on April 29, 2016, 04:11:19 PM

Title: Example: KUKA LBR iiwa and Sunrise
Post by: Johannes @ Robots in Architecture on April 29, 2016, 04:11:19 PM
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.
Title: Re: Example: KUKA LBR iiwa and Sunrise
Post by: evo85210 on February 15, 2019, 09:07:29 AM
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
Title: Re: Example: KUKA LBR iiwa and Sunrise
Post by: Johannes @ Robots in Architecture on February 15, 2019, 08:25:46 PM
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
Title: Re: Example: KUKA LBR iiwa and Sunrise
Post by: evo85210 on February 18, 2019, 07:59:02 AM
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?)
Title: Re: Example: KUKA LBR iiwa and Sunrise
Post by: Johannes @ Robots in Architecture on February 18, 2019, 07:11:11 PM
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
Title: Re: Example: KUKA LBR iiwa and Sunrise
Post by: evo85210 on February 19, 2019, 04:12:45 AM
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)
Title: Re: Example: KUKA LBR iiwa and Sunrise
Post by: Johannes @ Robots in Architecture on February 19, 2019, 12:20:40 PM
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