Robotic polishing machine
-
amolghule7 -
July 4, 2015 at 3:35 PM -
Thread is marked as Resolved.
-
-
your counter does not do anything so there is no base shifting at all...
to make your code work you must move counter declaration into DAT file and initialize it there.
you also need way to reset the counter for example when head is changed, maybe ask on program start if polisher was replaced. -
-
I think that my comments in previous reply were VERY clear. my intention is to help when question is specific, but you need a lot more help.
for example if posted code is yours, it shows that you did not have kuka training (or programming in general). you still need to learn about scope and life of variables and how are variables declared in KRL (covered in basic programming).
you had variable "I" declared in SRC file (in tri2_base.src). this makes it a runtime variable, meaning that it vanishes when program ends, so it cannot retain value to be used in the next program run.
then you initialize it (also in SRC file) which sets value for I (i=0), but it does so every time you run program. this can be useful in some cases but - not here because, if I=0 every single time, then comparison (if i==5 then) will never do anything different, so the geometric operator used to produce offset is actually never used. even if it was used, it would be overwriting base - there is nothing to restore base to original values after worn buffing head is replaced with a new one.
finally you increment I, (i=i+1) so at this line you actually get i=1 every time (because it was I=0 every time before reaches this line). but... we are already done using this variable "I" and when program end is reached, the variable is destroyed so manipulating it in any way still does nothing.
Now to (one) possible solution:
Code
Display MoreDEF tri2_base( ) DECL FRAME offset DECL INT Dialog_Answer DECL INT Max_Cycles DECL REAL Wear_Per_Cycle INI ; initialize variables Max_Cycles = 50 Wear_Per_Cycle = 0.20 ; mm ; check wear and recommend tooling replacements IF Run_Cycles > Max_Cycles THEN MsgDialog(Dialog_Answer,"Wear limit reached. Is tool replaced?","ToolCheck",,,,,,,"No","Yes") IF Dialog_Answer==1 THEN Run_Cycles=0 ; if tool changed, reset Run_Cycles base_data[5]=base_data[15] ; restore working base ENDIF ENDIF ; compute offset for EVERY run ; note that base 15 does not change (no offset) ; base 5 is just a working base (includes correction offset) offset ={x 0,y 0,z 0,a 0,b 0,c 0} offset.z= Run_Cycles * Wear_Per_Cycle base_data[5]=base_data[15]:offset ; perform polishing PTP P3 Vel=50 % PDAT1 Tool[1] Base[5]:Buff_Head_2; ;.... LIN P2 Vel=2 m/s CPDAT2 Tool[1] Base[5]:Buff_Head_2 ; track number of polishing jobs since head was replaced Run_Cycles = Run_Cycles + 1 END
and Run_Cycles must be declared in DAT file:
-
thank you