FANUC PROJECT: Data recording with background Karel program

  • 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
    • Make a Karel program we can launch from a TP program like that:
    Code
    !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:

    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 :smiling_face:

    Edited 2 times, last by Axillus ().

  • massula

    Approved the thread.
  • Try putting DELAY 50 instruction at the end of while loop.


    Instead of CALL DATARECORDER, use RUN command. You will have to set arguments before you use RUN, maybe in Register and String Register.

  • 1 Make the interval to run this and delay it within the tp program that makes the call? you can also multitask this to run in Parallel with your other functioning programs.2 I'm not sure about being able to run this from a background task, but you may be able to because it contains no motion.

  • Hello Axillus and welcome to the forum,

    There are some things to consider:

    1. I would replace WAIT FOR statement with a DELAY statement.
    2. If you want to run in parallel with other programs, as dha stated, you would start it with RUN.
    3. If you start it with RUN and you want to run it continously you will need another WHILE or REPEAT loop above WHILE (duration > clock_var) DO

    This loop will provide means on controlling the running/abort status of the program. Just use some virtual outputs (DO's mapped to rack 0, slot 0).
    If you want the program just to finish after logging the data at 20 sec interval you don't need this extra loop.
    In other case, run the program non-stop the program would look like :

    Code
      REPEAT 
      - start recording
        WHILE  (duration > clock_var) DO
        ......
        ENDWHILE
        clock_var=0
        DELAY(50)
      UNTIL DOUT[..]=OFF 

    And you make DOUT[...]=ON in the beginning of the program. If you want to cancel the program you just make DOUT[..]=OFF.

    And also take out SET_PERIOD routine.


    I've made some modifications to your code:

  • Hello,

    Thanks you very much guys!

    RUN command works very well! (but is it possible to catch entries with RUN?)

    The DELAY period command instead of WAIT FOR also seems to work well!

    The goal of the program is that it must record a maximum of data for x seconds even if a security error is detected.


    Next challenge is to find which variable corresponds to which parameter (for example, I have associated CUR_TORQUE[n] to a REAL variable but the value is still 0 in the log file... same thing for CUR_DIS_TRQ[n]. The only variables I record well are CURRENT_ANG[n]).

  • Hi, i'm after the same data recorder and i'm having some issues to figure it out about sys vars like


    $MOR_GRP[1].$CUR_TORQUE - ARRAY[9] OF SHORT$MOR_GRP[1].$CUR_DIS_TRQ - ARRAY[9] OF SHORT

    because i can't understand what they really represent or the way to scale it into REAL numbers who actually represent disturbance (A) and Torque (percent or Nm, idk).


    Anyone can pointme in the right direction? I've googled a lot and reviewed all sys var which are available. Readed all manualls about ZDT too and i don't know where are the variables like High Water Mark Torque, odometer, etc.


    Thanks in advance, i've been programming fanuc last three years and i think i can actually help people of the forum about some other stuff, so i will be around here.


    Greetings.

    Edited once, last by bugme ().

  • Hi bugme ,

    Did you find what the $MOR_GRP variables represent or the way to scale it int real numbers who actually represent disturbance(A) and Torque .??


    When I compare the data in this variable to the axis screen it shows different values.

  • Hi there,


    Have you check that this variables is set to 1?

    $MISC_MSTR.$hpd_enb

    Minimum: 0

    Default: 0

    Maximum: 1

    karel/Data: RW

    Program: RW

    Control Start: RW

    Type: BOOLEAN

    Memory Location: CMOS

    Name: High Precision Disturbance Torque Enable

    Description: If TRUE: System will update $MISC.$HPD_TRQ[]. If FALSE: System does not update $MISC.$HPD_TRQ[].

    User Interface Location: SYSTEM Variables screen

  • Hi, I did set $hpd_enb variable to TRUE, and I see $HPD_TRQ[] updated. But I don´t understand what does the value represent, since it is different than the values shown in the "axis" screen in the TP.

    Is this a % of disturbance related to the max allowed or related to the max specification of the servo?

  • Hi, I did set $hpd_enb variable to TRUE, and I see $HPD_TRQ[] updated. But I don´t understand what does the value represent, since it is different than the values shown in the "axis" screen in the TP.

    Is this a % of disturbance related to the max allowed or related to the max specification of the servo?

    Hi,


    Unfortunately I can't tell yo what is the relationship between disturbance values and those values. I just know that with monitoring those I'm able to make some part relocation based on those values. I tried to search from my manuals, but couldn't found much to share.

  • I have spent many, many hours trying to convert the values from system variables concerning torque, max. torque, disturbance torque to match the Teach Pendant monitor values and I have concluded that the numbers in system variables concerning the HPD_TRQ[] array are double types and they in fact represent Amps (A) and match what you see on the Teach Pendant. So this you can use safely.

    Now concerning MOR_GRP system variables this is a whole lot different story. Values stored in $TORQUE, $MAX_TORQUE, $CUR_TORQUE are of type UINT and they are raw data coming straight from the Servo's DSP (Digital Signal Processor) cast internally by the Teach Pendant's Kernel to represent a measured value for MONITOR. I have not found a way so far to "pull" the value of the TP monitor screen because that value in my opinion is not stored in a system variable rather it is processed on-the-fly and updated.

    A method around I used to tackle this problem was to collect a big sample of data seperately for each axis from both the value of the variable and the value on the teach pendant and compare the mins and max between specific time intervals to find MINs and MAXs as a percent.


    Creating a Real-time robot torque monitor in PLC HMI


    This was a project of implementing a Live Robot Monitor directly on the PLC's HMI. Scroll to my last post and you can see a video.

Advertising from our partners