

The interface for this procedure is as follows: GET_TPE_PRM(paramNo : INTEGER dataType : INTEGER intVal : INTEGER realVal : REAL strVal : STRING status : INTEGER) Next we’ll add some functionality by grabbing our parameters from the TP environment via the GET_TPE_PRM built-in. Let’s create a skeleton program with these three variables: PROGRAM logpr A STRING variable for the logfile destination (parameter from TP).An INTEGER variable for the target Position Register id (parameter from TP).A FILE variable to use as a handle for the logfile that we will write to.We’re going to record comma-separated values (CSV) with the following “schema”: timestamp, PR id, X, Y, Z, W, P, R. Here’s how you might use this utility from a TP program: CALL LOGPR(1, 'PIP:logpr.dt')

For maximum flexibility, let’s accept two parameters: one will be an INTEGER id for the PR we want to log, and the other will be a STRING filename for the desired logfile. We want to be able to log Position Register (PR) values (X, Y, Z, W, P, R) to a logfile whenever this KAREL program is called from a TP program. Let’s get started by considering our desired TPE interface. Error-checking and the status convention.KAREL variables, constants and data types.This application ends up being a great example that covers a broad range of KAREL programming fundamentals:

As luck would have it, I’d been meaning to write a post about something like this for quite a while now.
#Karel software solution fanuc syntax how to#
I received a question via email the other day where someone wanted to know how to log timestamped position data to a file.
