SPS crashes because $PRONAME[] invalid

  • I am looking for some help with a problem I have been struggling with. On a KRC4 KR180 R2500 extra with KSS 8.3.32 I am running the SPS to control the AEXT of the robot so that no external PLC is used and to load a specific program to the robot.

    The issue is that if you reset the program or cancel it you get the error $PRONAME[] - value invalid - on the screenshot. The error occurs randomly - not every time you reset or cancel the program, so I am thinking it must be some timing issue with the closing of the program and the fast SPS cycle. The trouble is that this variable is nowhere to be seen. It's not $PRO_NAME[] and I am using $PRO_NAME1[] in the SPS to check the loaded program and I check if it is #INITIALISED. And my biggest concern is that when I get this error I need to reset the SPS and I want to get rid of this crash but I fail to see what causes it.

    In the user section of the loop I have this regarding the $PRO_NAME1[]

  • well.... first identify line of code that causes problem.


    there are different ways to do that:


    one of them is to use Single Variable Monitor and change $INTERPRETER to 0 (when no MultiSubmit is installed) or 2 (when Multisubmit is installed) and select some robot program (anything) so you can look at the SPS code as it runs and stops. This will reveal line wihere instruction pointer in the SPS and htis is where the fault is. when done, change $INTERPRETER back to 1.


    another is to monitor system variable and find where instruction pointer is


    another is to comment out blocks of code until problem stops appearing. this is a brute force method and therefore it is least preferred.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Using VARSTATE for something like this is not reliable, due to the asynchronous relationship between the Level 0 and Level 1 interpreters.


    My guess is that the error is happening on Line 2. I would put an ON_ERROR_PROCEED immediately before this line, and then fence in the following code with an IF statement checking the value of $ERR.

  • These are very useful ideas. I was also thinking that the problem is some asynchronicity happening. It is not line 2 though since I added it in order to make a single call to $PRO_NAME1[] instead of multiple calls in every IF. This reduced the frequency of the event, I will definitely try ON_ERROR_PROCEED.

    But is there any chance that the VARSTATE is throwing the error (I guess I will check that with $INTERPRETER=1 when I have access to the robot)?

    Also what is this variable anyway is it just the error not showing correctly or there is in fact $PRONAME[] without "_"?

  • It is line 2 as SkyeFire suggested, It was very nice of KUKA to provide a weird line numbering for SNR value - I only found out after I figured it out in one manual they actually state to subtract the number of & lines from the line number, but not in the Systems variable manual. For some reason they do print $PRONAME instead of $PRO_NAME1[] which I cannot figure out why, even in KSS8.5.7 (I recreated it in OL).


    I will test the solution when I get on site.

  • well... can't say much without seeing whole code and screenshot at the moment of crash and values....


    but i would avoid temptation to copy a string in KRL like that. it is bound to have problems...

    KRL does not have a string type so KRL strings are really character arrays. consider this example:

    DECL CHAR pr1[24], pr2[24]


    pr1[]="hello world"

    pr2[]="bye"

    pr1[]=pr2[] ; problem..... pr1[] value is "byelo world" since previous content was not erased.


    even KSS included string functions have ... issues. and i mean a lot of issues...

    for example i had experienced where they corrupt memory (kill drives, crush HMI etc.) and require restart plus all kind of weird messages.

    also they don't work across arrays of different dimensions etc. (or at least not correctly)

    for that reason, i hesitate to use them and prefer to stick to my own functions.


    fortunately array manipulation is simple though it adds to program code length.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Panic is correct. For a good example of string/char-array manipulation, with bulletproofing against errors, I'd suggest looking at MSGLIB.SRC, which comes in every KRC4, located (usually) in /R1/System/.

  • Did you solve this problem? We are having exactly the same problem. This error message comes sometimes when we are checking out whether the specified program name is selected.


    The biggest problem is when after the "proname[] " error our own multi submit program stops to run in the background.

  • i do tons of string manipulation, use multi-submits all the time constantly starting/stopping one task from another, using code to evaluate and log what is running etc. and don't have a problem...


    so problem is clearly with trying to use that kind of code.

    as mentioned KRL does not have STRING data type. that's it. so stop treating it as a string, treat it as a character array that it really is.


    strings will show anything that is before first null character. and if first character is not null then string is initialised. everything after first null is ignored. a common way to "erase" string is to put zero in first char, without overwriting every single char.


    arrays on the other hand are different animals. if at least one element (in this case char) is initialised, then array variable as a whole is deemed initialised.


    so do not check if $PRO_NAME1[] is initialised to see what is happening with task, use $PRO_STATE1.

    1) read pinned topic: READ FIRST...

    2) if you have an issue with robot, post question in the correct forum section... do NOT contact me directly

    3) read 1 and 2

  • Panic is correct. For a good example of string/char-array manipulation, with bulletproofing against errors, I'd suggest looking at MSGLIB.SRC, which comes in every KRC4, located (usually) in /R1/System/.

    I will definitely keep what you and panic mode mentioned about strings not being strings in mind and also study MSGLIB. tbex I used the ON_ERROR_PROCEED filtering for the value invalid error. I have not seen any errors afterwards. I needed $PRO_NAME1[] to make sure a certain program is loaded and I am also using $PRO_STATE1 for monitoring program execution.

Advertising from our partners