Hello,
I'm working on a Karel program inspired by the "Data Recorder" function available on collaborative robots made by KUKA (LBR iiwa):
Look the Kuka Data Recorder documentation page 423
In fact, it seems that there is anything comparable on FANUC robots, particularly on there collaborative robots where it will be very interesting to have a data (log) recording for risk assessment (for example).
I'm working on CR-35iA (with R-30iB controller), a 6-axis collaborative robot made by FANUC.
I looked at "Data Monitoring" option mainly destinated to arc welding robots, which can only record 5 items at the same time... and this is not very satisfasting (for example you can't record the joint positions of the 6 axis of CR-35iA because it's limited to 5 items).
So, I'm discovering the Karel language and its possibilities, and according on what I've read on this forum and other documentations, it's seem possible to do what I want on a FANUC robot in Karel.
Here is links I've look: Link 1, Link 2, Link 3, Link 4, Link 5, Link 6, Link 7, Link 8
What I'm trying to do:
- Identify data to record as same data that a collaborative Kuka can record (and more if possible):
Variables I think I've identified are bolded:
Kuka's Data recorder like:-
Internal Joint Torque (6 axis) :
$MOR_GRP[1].$CUR_TORQUE - ARRAY[9] OF SHORT -
External Joint Torque (6 axis) :
$MOR_GRP[1].$CUR_DIS_TRQ - ARRAY[9] OF SHORT -
Cartesian Force (force sensor on CR-35iA) :
($DCSS_CLLB[1].$EXT_RFORCE) or ($DCSS_CLLB[1].$EXT_FORCE - ARRAY[6]) ? -
Commanded Joint Position (6 axis) :
? -
Current Joint Position (6 axis) :
$MOR_GRP[1].$CURRENT_ANG - ARRAY[9] OF REAL -
Commanded Cartesian Position (XYZWPR at TCP) :
(maybe $PATHAJ_3POS[1]. $X, $Y and $Z) ? -
Current Cartesian Position (XYZWPR at TCP) :
($MOR_GRP[1].$CUR_TCP with 2 = X, 3 = Y, 4 = Z, 5 = W, 6 = P, 7 = R) or ($MOR_GRP[1].$CURRENT_POS) ?
More if possible, otherwise it's easy to calculate them:
-
Commanded Cartesian Velocity (at TCP) :
?
-
Current Cartesian Velocity (at TCP) :
(maybe $SCR_GRP[1].$MCH_SPD) ? -
Commanded Cartesian Acceleration (at TCP) :
? -
Current Cartesian Acceleration (at TCP) :
? -
Commanded Joint Velocity (6 axis) :
? -
Current Joint Velocity (6 axis) :
? -
Commanded Joint Acceleration (6 axis) :
? -
Current Joint Acceleration (6 axis) :
$MOR_GRP[1].$CUR_AXS_ACC - ARRAY[9] OF INTEGER
-
Internal Joint Torque (6 axis) :
- Make a Karel program we can launch from a TP program like that:
!Start recording data each 100 ms, during 20000 ms in a usb file
CALL DATARECORDER(100, 20000, 'UD1:logfile.dt')
J P[1] 100% FINE
J P[1] 100% FINE
- Here is my Karel program skeleton:
PROGRAM datarecorder
%COMMENT = 'LOG DATA RECORD'
%SYSTEM
%NOLOCKGROUP
%NOABORT=ERROR+COMMAND+TPENABLE
%NOPAUSE=ERROR+COMMAND+TPENABLE
%NOPAUSESHFT
VAR
logFile : FILE
filename : STRING[16]
duration : INTEGER -- recording duration in milliseconds
clock_var : INTEGER -- clock count in milliseconds
period : INTEGER -- recording period in milliseconds (8 ms to 127 ms)
timeInt : INTEGER -- actual time
timeStr : STRING[18] -- formated
IntTQa1 : REAL -- internal joint torque on axis 1
IntTQa1Str : STRING[4] -- formated
entry : INTEGER
status : INTEGER
-- tests
test : INTEGER
clocky : INTEGER
-----------------------------------------------------------------------------------
-- routine to set period
ROUTINE SET_PERIOD(active : BOOLEAN)
BEGIN
IF active:
--- set sample period
SET_VAR(entry, '*SYSTEM*', '$SCR.$COND_TIME', period, status)
END SET_PERIOD
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-- routine to get internal torque measured on axis 1
ROUTINE GET_INT_TQ(active : BOOLEAN)
BEGIN
IF active:
GET_VAR(entry, '*SYSTEM*', '$MOR_GRP[1].$CUR_TORQUE[1]', IntTQa1, status)
END GET_INT_TQ
-----------------------------------------------------------------------------------
-----------------------------------------------------------------------------------
-- main routine
BEGIN -- execute the program
clock_var = 0
-- begin the clock time count
CONNECT TIMER TO clock_var
period = 150 -- ms
-- set sampling period
SET_PERIOD(TRUE)
duration = 10000 -- ms
filename = 'MC:'+'TEST'+'.dt'
entry = 0
status = 0
-- tests
test = 0
clocky = 0
-- get actual time and convert it into string
GET_TIME(timeInt)
CNV_TIME_STR(timeInt, timeStr)
-- open the log file
OPEN FILE logFile ('AP', filename)
-- write actual time and make a carriage return
WRITE logFile (timeStr, CR)
-- start recording
WHILE (duration > clock_var) DO
clocky = clock_var
test = clocky+period
WAIT FOR (clock_var>test) -- if removed, program bug
GET_INT_TQ(TRUE) -- call internal torque routine
CNV_REAL_STR(IntTQa1, 2, 2, IntTQa1Str)
WRITE logFile(clock_var)
--WRITE logFile(';')
--WRITE logFile(IntTQa1Str, CR)
ENDWHILE
-- stop recording, close log file
CLOSE FILE logFile
-- end of program
END datarecorder
Display More
As you can see, I want to make a log file (like the .csv generated by a Kuka) with the different data recorded at each period count.
I have succeeded to write in a file but, my clock_var variable doesn't increase (stays to 0) if I remove the WAIT FOR statement (and the program infinite runs).
Furthermore, I feel that the teach iPendant hangs until the Karel program is finished before continuing the TP program (I've only tested it on Roboguide).
I want to run the KAREL program in background of the TP program but I don't know how to do this.
Does anyone have ideas to help me?
Thanks in advance