Hi,
I am trying to create a karel log file in order to store the vision register 1 through 5 (X,Y,Z,w,p,r) into a file. I am new to Karel and I have been digging through the karel programming manual to make this program. I am trying to output a file (VisionOffsetData.dg) that will contain Vision Registers 1, 2, 3, 4, 5, 6 offsets on x,y,z,w,p,r.
I was wondering if you guys have created a vision register log in the past? If so, could you guide me of what I need on this program.
This is what I got so far:
%NOLOCKGROUP
%ALPHABETIZE
%NOPAUSE = ERROR + COMMAND + TPENABLE
%NOABORT = ERROR + COMMAND + TPENABLE
PROGRAM VISIONDATA
VAR
EnableVisionOffsetData: BOOLEAN
STATUS : INTEGER
visprocess : STRING[8]
int_value : INTEGER
real_value: REAL
OffsetValueVR1: XYZWPR
OffsetValueVR2: XYZWPR
OffsetValueVR3: XYZWPR
OffsetValueVR4: XYZWPR
OffsetValueVR5: XYZWPR
OffsetValueVR6: XYZWPR
GetVisionOffset : REAL
VisionOffsetData: FILE
BEGIN
EnableVisionOffsetData = FALSE
IF UNINIT(VISIONDATA)THEN VISIONDATA=FALSE;ENDIF
IF VISIONDATA=TRUE THEN
OPEN FILE VISIONOFFSETDATA ('AP', 'VISIONOFFSETDATA.dg')
WRITE VISIONOFFSETDATA (CR,CR, '---------------------------------------',CR)
ENDIF
--If Enable VIsion Offset Data is TRUE
-- then start populating data into the file
IF EnableVisionOffsetData = TRUE
GET V_GET_OFFSET (OffsetValueVR1, 1, STATUS)
WRITE VisionOffsetData ('X', CR)