thank you all for the help. I data format to be transferred from cognex 3d scanner can be in the Ascii type, 16 bit- signed integer and soo on. Please see the attachment. I have created variable in my karel program to accept this data. Ca you please let me know if the variables I declared are wrong and wont accept the data ?
is my line of code to read the file from cognex application correct?
PROGRAM Cognex
%COMMENT = 'KL_SocketMessaging V9.1'
%STACKSIZE = 8096
%NOLOCKGROUP
%NOPAUSESHFT
%NOPAUSE = ERROR + COMMAND + TPENABLE
%NOBUSYLAMP
%NOABORT = ERROR + COMMAND
%INCLUDE KLEVCCDF -- predefined key character code constants
%INCLUDE KLIOTYPS -- karel IO type definitions
%INCLUDE KLEVKEYS -- predefined karel key code constants
VAR ---- Global Variable declaration
file_var : FILE -- for client communication
enc_count: INTEGER
tmp_int : INTEGER
tmp_int1 : INTEGER
tmp_str : STRING[128]
status : INTEGER -- communication status
entry : INTEGER
try : INTEGER
xs : STRING[128]
ys : STRING[128]
angles : STRING[128]
x : REAL
y : REAL
angle : REAL
comment : STRING[16]
loop1 :BOOLEAN
my_pos :XYZWPR
BEGIN
MSG_PING('S3:',status)
WRITE TPDISPLAY('pinging',status)
SET_FILE_ATR(file_var, ATR_IA)
SET_VAR(entry,'*SYSTEM*','$HOSTC_CFG[3].$SERVER_PORT',5001,status)
-- Connect the tag
WRITE TPDISPLAY('Connecting…',CR)
MSG_DISCO('S3:', status) ----- closing port before start
MSG_CONNECT ('S3:',status)
WRITE('Connect Status =',status,CR)
loop1= TRUE
IF status = 0 THEN
WHILE loop1 = TRUE DO
WRITE TPDISPLAY('OPENING FILE..',CR)
OPEN FILE file_var('RW','S3:')
status=IO_STATUS(file_var)
IF status = 0 THEN
FOR tmp_int =1 TO 10 DO
READ file_var(tmp_str ::10)
READ file_var(tmp_int ::10)
IF status <> 0 THEN
WRITE('Loop Test Fails',CR)
loop1 = FALSE
tmp_int = 10
ENDIF
ENDFOR
ENDIF
ENDWHILE
ENDIF
READ file_var(xs::10)
READ file_var(ys::10)
READ file_var(ys::10)
WRITE TPDISPLAY ('disconnecting', CR)
MSG_DISCO('S3:',status) --Disconnect Socket
-- Convert the data
CNV_STR_REAL(xs, x)
CNV_STR_REAL(ys, y)
CNV_STR_REAL(angles, angle)
WRITE TPDISPLAY('X:',x,CR,'Y:',y,CR,'R',Angle,CR)
END Cognex
Please let me know how can I proceed to get the right data in the correct format.
How can I read daa from the cognex file into group inputs?