I am connecting two points using the connectPoints routing , but when I try to move to the point in TP the robot gets a system error. I understood it is because some of the data in the point is null.
How do I check if only part of the point is NULL? I made a CHKNULL Routine that works but would like to make something more robust. I added both routines on the bottom.
Code
ROUTINE CHKNULL
VAR
pointNULL : BOOLEAN
tempstr: STRING[20]
BEGIN
pointNULL = TRUE
CNV_REAL_STR(firstPoint.x, 2,0,tempstr)
IF tempstr = ' *' THEN
pointNULL = FALSE
ENDIF
CNV_REAL_STR(firstPoint.y, 2,0,tempstr)
IF tempstr = ' *' THEN
pointNULL = FALSE
ENDIF
CNV_REAL_STR(firstPoint.z, 2,0,tempstr)
IF tempstr = ' *' THEN
pointNULL = FALSE
ENDIF
CNV_REAL_STR(firstPoint.w, 2,0,tempstr)
IF tempstr = ' *' THEN
pointNULL = FALSE
ENDIF
CNV_REAL_STR(firstPoint.p, 2,0,tempstr)
IF tempstr = ' *' THEN
pointNULL = FALSE
ENDIF
CNV_REAL_STR(firstPoint.r, 2,0,tempstr)
IF tempstr = ' *' THEN
pointNULL = FALSE
ENDIF
RETURN(pointNULL)
END CHKNULL
Display More
Code
ROUTINE CONNECTPOINTS
VAR
resultPoint : XYZWPR
BEGIN
CNV_STR_CONF('fut', conf, 1)
resultPoint = POS(0, 0, 0, 0, 0, 0, conf)
resultPoint.x = firstPoint.x + secondPoint.x
resultPoint.y = firstPoint.y + secondPoint.y
resultPoint.z = firstPoint.z + secondPoint.z
resultPoint.w = firstPoint.w + secondPoint.w
resultPoint.p = firstPoint.p + secondPoint.p
resultPoint.r = firstPoint.r + secondPoint.r
RETURN(resultPoint)
END CONNECTPOINTS
Display More