Hello y'all, can someone please explain to me how to use arrays/matrix on KUKA? I just can't find a good explanation. I want to do a program that delivers a piece of iron for exemple, in 4 different positions, for that I want to use a 2x2 matrix. First in 1x1, then 1x2, 2x1 and 2x2. Two lines and two colluns. What should I declare, what variable should I use? Can someone please help me?
KUKA MATRIX AND FOR FUNCTION
-
legityme -
April 23, 2020 at 7:07 PM -
Thread is Unresolved
-
-
Does someone has an exemple of a simple program that does what I want?
-
tons of examples are already on the forum... look for "palletizing" for example
and post your system info unless you want code in JAVA or something else.
-
Can you send me a link with these exemples or something? I could'nt find specifics exemples, I'm kinda lost here on the website. And thank you!
-
at the top right you will see icon of a magnifying glass. click on it and search window will open up. then type what you are looking for such as:
kuka palletizing
-
I looked for kuka palletizing but I only got people asking about it as well. Didn't found any exemples
-
Could you send me a link with an exemple of a program that uses a matrix?
looks like you are desperate to get results fast. you value your time and don't want to spend it searching or reading some forum posts.
turns out i am a busy man too. yes I could post a link... and I could write you a program too.
how much you think is a fair price?
-
It's all spelled out in the manuals, with example code.
Code
Display MoreDECL INT OneDArray [5] ; 1D array, type integer, 5 entries OneDarray[1]=17 OneDarray[2]=-46 OneDarray[3]=-91 OneDarray[4]=-9 OneDarray[5]=-83 DECL INT TwoDArray[5,5] ; 2D array, type integer, 25 entries TwoDArray[1,1]=-65 TwoDArray[1,2]=85 TwoDArray[1,3]=60 TwoDArray[1,4]=41 TwoDArray[1,5]=95 TwoDArray[2,1]=-44 TwoDArray[2,2]=92 TwoDArray[2,3]=-34 TwoDArray[2,4]=-78 TwoDArray[2,5]=24 TwoDArray[3,1]=31 TwoDArray[3,2]=12 TwoDArray[3,3]=74 TwoDArray[3,4]=-6 TwoDArray[3,5]=33 TwoDArray[4,1]=-68 TwoDArray[4,2]=-98 TwoDArray[4,3]=36 TwoDArray[4,4]=94 TwoDArray[4,5]=24 TwoDArray[5,1]=59 TwoDArray[5,2]=91 TwoDArray[5,3]=84 TwoDArray[5,4]=-56 TwoDArray[5,5]=-46 DECL INT Index1, Index2, Value1D, Value2D FOR Index1 = 1 TO 5 Value1D = OneDArray[Index1] FOR Index2 = 1 TO 5 Value2D = TwoDArray[Index2] HALT ; monitor the Value variables here ENDFOR ENDFOR
-
A while ago I had the same requirement - to create a palletizing program.
You really have to learn raw KRL to do this. So no In-line forms.
I am using a PLC that runs a program when needed... so that might not be what you need.
Declare variables in a DAT file.
DECL GLOBAL INT RobotMove = 1
DECL GLOBAL INT BoxLayer = 1
In the SRC file declare two positions:
DECL POS InBoxUp, InBoxDown
And in the program section you can add "1" after every time the program was running.
RobotMove = RobotMove +1
IF RobotMove == 4 THEN
BoxLayer = BoxLayer + 1
ENDIF
IF RobotMove == 4 THENRobotMove = 1
ENDIF
So both of them keep going up... the RobotMove will go 1...2...3...4......1...2...3....4
And the BoxLayer will go to infinity unless you also reset it at some point. 1...2....3.....4.....5.....6
You can calculate individual components of a coordinate for different cases.
Or if you just have a single case then you don't need the SWITCH CASE statements.SWITCH RobotMove
CASE 1, 2, 3 ;
InBoxUp.x=257
InBoxUp.y=223-(RobotMove-1)*83
InBoxUp.z=(BoxLayer-1)*100
InBoxUp.A=90
InBoxUp.B=180
InBoxUp.C=0
ENDSWITCH
And after the switch statement you can order the robot to go to this point... and that point will have new coordinates every time the program is run.
PTP InBoxUpIn my case the box coordinates are relative to the base of the box... so I just adjust the base to be in the right place and the individual pieces are placed to the correct positions inside the box.