Right now I have a program that calculates the lenght of a tool over the z axis and it loads this into a database. However I want to adjust the TCP of the tool on the XYZ and orientation location with this toollenght. This is because the toolholder is mounted to the 6 axis with around 30 degrees offset. So every new tool loaded into the program will have a different TCP because of this offset. I can calculate the needed data however I dont know how to load these coördinates into TOOL_DATA[1]. This is what i thought would work but im getting compiling errors back. So how do i adjust the TOOL_DATA[1] with new coördinates that I calculated.
Code
DEF TOOLM() ;Subroutine for toolsetter
INTERRUPT OFF 1 ;Deactivate interrupt
BRAKE ;Stop robotarm movement
Z1=$POS_INT ;Register location on the Z axis at moment of interrupt
ToolLenght_1=StartPos-Z1.z ;Calculate distance traveled on the Z axis
ToolLenght_2=ToolCorecction-ToolLenght_1 ;Subtract distance traveld on the z axis from work area
ToolLenght_1Z=Z1.z ;Safe location on Z axis
ToolLenght_1X=Z1.x ;Safe location on X axis
ToolLenght_1Y=Z1.y ;Safe location on Y axis
$OUT[1]=TRUE ;turn on output 1
;FOLD WAIT Time=1 sec;%{PE}%R 5.5.31,%MKUKATPBASIS,%CWAIT,%VWAIT,%P 2:1
WAIT SEC 1
;ENDFOLD
ToolX=COS (ToolA)*ToolLenght_2
ToolY=SIN (ToolA)*ToolLenght_2
ToolZ=ToolLenght_2
TOOL_DATA[1]={X ToolX, Y ToolY, Z ToolZ, A ToolA, B ToolB, C ToolC}
RESUME ;Continue program
END
Display More
Code
DECL REAL StartPos=1136.21594 ;StartPosition
DECL REAL ToolLenght_1=41.0490723 ;Distance traveled
DECL REAL ToolLenght_2=220.855896 ;Measured toolenght
DECL REAL ToolCorecction=261.661926 ;Working area
DECL REAL ToolLenght_1Z=1095.16687 ;Second measurment Z axis position
DECL REAL ToolLenght_1X=13.9668493 ;Second measurment X axis position
DECL REAL ToolLenght_1Y=759.555847 ;Second measurment Y axis position
DECL REAL ToolX=0.0
DECL REAL ToolY=0.0
DECL REAL ToolZ=0.0
DECL REAL ToolA=30.14263
DECL REAL ToolB=89.8666
DECL REAL ToolC=0
Display More