Robots in Architecture Forum

KUKA|prc - parametric robot control for Grasshopper => Support => Topic started by: Melis on June 13, 2016, 02:13:58 PM

Title: C Sharp
Post by: Melis on June 13, 2016, 02:13:58 PM
Hello Johannes!

Do you have any examples on how to manipulate the robot movements with C# or on how to link C# with the robot?
I'm trying out a few little things with C# but don't know how to connect it with the robot.

Thanks a lot for support...
Title: Re: C Sharp
Post by: Johannes @ Robots in Architecture on June 13, 2016, 02:31:50 PM
Hello,
KUKA|prc is not open source, so we don't have a full documentation of all functions or APIs. But of course you can use it like any other library. Can you give me some more details on what you want to achieve?
Best,
Johannes
Title: Re: C Sharp
Post by: Melis on June 14, 2016, 05:25:08 PM
Hello,

for example the robot starts at one point on this box. Right now I am trying to write a code, where the program has to calculate the distance between the starting point to any other points. Now the robot has to move from the starting point to the nearest next point - to the point which has the least distance to.

The problem is I don't know how to command the robot with this code or how to transfer the code to the robot. How do I do that?

I already asked a few questions in this forum because I'm relatively a newbie with grasshopper/rhino/kukaprc. Hope you can help me though.

Best,
Melis
Title: Re: C Sharp
Post by: Johannes @ Robots in Architecture on June 15, 2016, 07:49:40 AM
Hello,

I'm still not entirely sure what you want to do. Do you want to create  robot movements from C#? That should be very straightforward. If you want to do inverse or forward kinematics from within your C# code you will need to set the entire simulation up, defining the robot and everything else that is usually set through the GUI.
Personally, I would also suggest using Visual Studio for C# coding, which is much, much more convenient than the built-in editor. It makes debugging magnitudes more enjoyable.

Best,
Johannes
Title: Re: C Sharp
Post by: Melis on June 15, 2016, 11:05:29 AM
Hallo,

ich versuche es noch einmal auf deutsch. Hatte bisher auf englisch geschrieben, damit andere es auch verstehen können, falls jemand so etwas ähnliches machen muss und neu mit dem ganzen Grasshopper/Rhino/Kuka ist.

Wenn man erst einmal C# außer Acht lässt, dann sucht sich der Roboter seine Route ja selbst aus - welchen Punkt er als nächstes anfährt (Bild1).

Nun möchte ich aber mit C# dem Roboter sagen, suche dir deine Route nicht selbst aus, sondern gehe von einem Punkt zum nächsten Nahe gelegen Punkt. Das heißt zum nächsten Punkt mit dem kürzesten Abstand. Bin gerade dabei das Programm dazu zu schreiben, sodass er mir halt immer die Abstände berechnet und den Punkt mit dem kürzesten Abstand als Output gibt.

Das Problem ist wie gesagt, wie übertrage ich das auf den Roboter? Muss ich jetzt so wie du sagtest die Bewegungen und die ganze Simulation im C# schreiben? Wenn ja wozu gibt es dann diese ganzen Möglichkeiten im Grasshopper linear/circular/ptp movements und die libraries? Hatte gedacht: ok du schreibst jetzt das Programm zum "traveling salesman problem" übertragen auf einen Roboter mit Optimierungsproblem (kürzeste Druchlaufzeit) und dann verknüpfst du das mit dem Roboter im Grasshopper?

Freundliche Grüße,
Melis


Title: Re: C Sharp
Post by: Johannes @ Robots in Architecture on June 16, 2016, 10:35:55 AM
Hello,

I'll reply in English to keep it relevant for non-German speakers.
Basically you want to optimize the order of points. If you do this in regards to their Cartesian position you do not need to involve the robot simulation for the pathplanning - just use the output of your optimized order of points as the input of your toolpath.
I've attached a very simple example that just shuffles a list of points and then outputs it again.
Another way would be to optimize the process time via Galapagos, however to get access to the (simplified) process time values, you would need the Analysis component which is only available in the member version. I can issue a temporary license, though.

Best,
Johannes
Title: Re: C Sharp
Post by: Melis on June 16, 2016, 11:54:43 AM
Hello Johannes!

Thank you so much! This motivates me a lot right now and I think your example might help.

Best wishes,
Melis