KAREL/KCL/System Variable to Disable Comments, Line Numbers, IO Status

  • Hey there,


    One annoyance when getting Backups for many Robots on multiple lines is having any combination of Comments, Line Numbers, and/or IO Status enabled.


    While I have Regular Expressions and scripts to remove Comments, Line Numbers, and/or IO Status if they are in a Robot Backup, I would rather not employ them if I don't have to. So, in order to circumvent this, I usually go from one Robot to another, manually disabling Comments, Line Numbers, and/or IO Status via the iPendant like so:


    Code
    EDIT → F5 [EDCMD] → 6 Comment
    EDIT → F5 [EDCMD] → 8 Line Number
    EDIT → F5 [EDCMD] → 0 -- NEXT -- → 2 IO Status


    I am hoping someone here knows if there is/are System Variable(s) that controls if/when Comments, Line Numbers, and/or IO Status are enabled/disabled, and if I can use KCL to disable Comments, Line Numbers, and/or IO Status via the System Variable(s).


    Here's a few examples:



    Any help or knowledge that is passed on would be greatly appreciated!


    Thank you.

  • Place your Ad here!
  • HawkME

    Approved the thread.
  • Thank you, zemog11! That is correct.


    I ended up toggling the Line Numbers, Comments, Colors, and I/O Status ON/OFF manually, downloaded SYSTEM.VA each time, and compared the SYSTEM.VA files with Beyond Compare to find the System Variables. Then, I tested each one to confirm the results were the desired outcome.


    Anyway, here are the System Variables for the aforementioned functionality:


    EDIT → EDCMD → 8 Line Numbers ➡️ $LN_DISP.$HIDE_LINE_N = TRUE

    EDIT → EDCMD → 6 Comment ➡️ $MNDSP_CMNT = 0

    EDIT → EDCMD → 0 -- NEXT -- → 2 IO Status ➡️ $UI_CONFIG.$IOSTAT_INST = FALSE


    What I find strange is that only the $MNDSP_CMNT System Variable is mentioned in the FANUC Robotics System R-30iA Controller Software Reference Manual MARACSSRF03061E Rev. F Version 7.20 PDF. I have a copy of the FANUC America Corporation System R-30iB System Variable Addendum MARXUSVAR06181E Rev. A PDF, and it doesn't mention the other System Variables I was able to discover.


    With this knowledge, I wanted to see if it was possible to change the value of these System Variables using KCL Commands and the built-in Web Server. So, I quickly put together a .bat script that I ran from a Windows computer on the Robot network like so:


    Code
    curl http://172.18.1.90/KCL/SET VAR $LN_DISP.$HIDE_LINE_N=TRUE
    curl http://172.18.1.90/KCL/SET VAR $MNDSP_CMNT=0
    curl http://172.18.1.90/KCL/SET VAR $UI_CONFIG.$IOSTAT_INST=FALSE


    As I explored changing other System Variables using KCL Commands and the built-in Web Server, I discovered that using curl required me to escape some characters and that curl wasn't bundled with Windows 10 until Version 1803. With this knowledge, I ended up using the Invoke-WebRequest PowerShell Cmdlet (which has been a part of PowerShell since Version 3.0, bundled with Windows 8). Using Invoke-WebRequest instead of curl meant that I no longer had to worry about special characters (common in FANUC System Variable syntax) and/or which version of Windows was installed on the computer which would execute the script (at least at the manufacturing facility I work in).


    I am not that familiar with PowerShell, so instead of writing a .ps1 script, I opted to call PowerShell from a .bat script like so:


    Code
    POWERSHELL -NoProfile -Command "& { Invoke-WebRequest -Uri 'http://172.18.1.90/KCL/SET VAR $LN_DISP.$HIDE_LINE_N = TRUE' ; Exit ;}"
    POWERSHELL -NoProfile -Command "& { Invoke-WebRequest -Uri 'http://172.18.1.90/KCL/SET VAR $MNDSP_CMNT = 0' ; Exit ;}"
    POWERSHELL -NoProfile -Command "& { Invoke-WebRequest -Uri 'http://172.18.1.90/KCL/SET VAR $UI_CONFIG.$IOSTAT_INST = FALSE' ; Exit ;}"


    The problem with sending multiple requests to the Robot Web Server in this way is that you must wait for the response from the current/previous request before sending the next request, and that takes a long time (not as much time as it takes for me to travel from one Robot to another, manually disabling Comments, Line Numbers, and/or IO Status via the iPendant, but you get the idea).


    I learned that you can start an asynchronous process in PowerShell by passing a -ScriptBlock to the Start-Job Cmdlet with all the commands you want to execute, and it worked:


    Code
    POWERSHELL -NoProfile -Command "& { $myJob = Start-Job -ScriptBlock { Invoke-WebRequest -Uri 'http://172.18.1.90/KCL/SET VAR $LN_DISP.$HIDE_LINE_N = TRUE' ; Invoke-WebRequest -Uri 'http://172.18.1.90/KCL/SET VAR $MNDSP_CMNT = 0' ; Invoke-WebRequest -Uri 'http://172.18.1.90/KCL/SET VAR $UI_CONFIG.$IOSTAT_INST = FALSE' ; } ; Wait-Job $myJob ; Receive-Job $myJob ; Exit ; }"

    Now, PowerShell sends each request to the Web Server at once and waits for the response from each request ...but all the HTML returned with the response from the Web Server is printed to the Console (this is the HTML that would be rendered in the browser if you were to enter the value of the -Uri passed to the Invoke-WebRequest Cmdlet). In order to avoid this, remove Receive-Job $myJob from the -ScriptBlock passed to the Start-Job Cmdlet like so:


    Code
    POWERSHELL -NoProfile -Command "& { $myJob = Start-Job -ScriptBlock { Invoke-WebRequest -Uri 'http://172.18.1.90/KCL/SET VAR $LN_DISP.$HIDE_LINE_N = TRUE' ; Invoke-WebRequest -Uri 'http://172.18.1.90/KCL/SET VAR $MNDSP_CMNT = 0' ; Invoke-WebRequest -Uri 'http://172.18.1.90/KCL/SET VAR $UI_CONFIG.$IOSTAT_INST = FALSE' ; } ; Wait-Job $myJob ; Exit ; }"


    NOTE: A similar result can be achieved by using the KCLDO command instead of the KCL command, as mentioned in the FANUC America Corporation SYSTEM R-30iB Plus Controller Internet Options Setup and Operations Manual MAROUIN9010171E REV H Version V9.10:


    Quote

    Note To send KCL commands without getting a response in your web page use KCLDO instead

    of KCL. KCLDO is the same as KCL except that there is no content returned as long as the

    command is successful. This is useful for buttons on web pages which are intended to cause an

    action without requiring the web page to be rewritten.


    By using the KCLDO command instead of the KCL command, you can keep Receive-Job $myJob in the -ScriptBlock passed to the Start-Job Cmdlet in case the KCLDO command is unsuccessul, like so:


    Code
    POWERSHELL -NoProfile -Command "& { $myJob = Start-Job -ScriptBlock { Invoke-WebRequest -Uri 'http://172.18.1.90/KCLDO/SET VAR $LN_DISP.$HIDE_LINE_N = TRUE' ; Invoke-WebRequest -Uri 'http://172.18.1.90/KCLDO/SET VAR $MNDSP_CMNT = 0' ; Invoke-WebRequest -Uri 'http://172.18.1.90/KCLDO/SET VAR $UI_CONFIG.$IOSTAT_INST = FALSE' ; } ; Wait-Job $myJob ; Receive-Job $myJob ; Exit ; }"


    NOTE: I have not (yet) tested using the KCLDO command instead of the KCL command.


    To scale this functionality, I created a .csv file that included all the Robot IP Addresses that I wanted to send these KCL Commands to and iterated over each one using a FOR Loop.


    The contents of robot-ip-addresses.csv:


    Code
    robot1 172.18.1.90
    robot2 172.18.1.91
    robot3 172.18.1.92
    robot4 172.18.1.93
    robot5 172.18.1.94
    robot6 172.18.1.95
    robot7 172.18.1.96
    robot8 172.18.1.97
    robot9 172.18.1.98
    robot10 172.18.1.99


    The contents of set-system-variables.bat:



    This implementation allows me to change the values inside the robot-ip-addresses.csv file and execute the set-system-variables.bat file again to achieve the same result with different Robots.


    ...and one more thing. Have you ever found yourself annoyed by the beeping sound of the piezo disc inside the Teach Pendant whilst making use of the touchscreen keyboard? I learned that you can disable the beeping sound using the following System Variable:


    Disable Touchscreen Piezo Disc (Beep) ➡️ $UI_CONFIG.$TOUCH_BEEP = FALSE

    Edited 2 times, last by cattmampbell: Fixed error in the included set-system-variables.bat file. Added information regarding the KCLDO command. ().

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account
Sign up for a new account in our community. It's easy!
Register a new account
Sign in
Already have an account? Sign in here.
Sign in Now

Advertising from our partners