KAREL abort all is blocked by program that needs to be aborted

  • I need to be able to run a KAREL program continuously in the background, that listens for a KAREL variable (or perhaps we will look into using a flag for this) that signifies an abort all request. Using a background logic program would be perfect, but KAREL programs sadly cannot be used here. I have tried to use a hot start autoexec program that calls a 'listener' KAREL program with the infinite loop, however this autoexec program still blocks the execution of other KAREL/TP programs which we need for the robot's regular functionality (TPIF-013 Other program is running). I am not sure what other options I have to implement this functionality, all options seems to get stuck on the fact that a program that is running and needs to be aborted blocks the execution of the abort_all program... Any suggestions would be appreciated.

  • Place your Ad here!
    • Helpful

    The parent would stick around, which is probably what you call blocking.


    According to the manual:


    If you want the child task to be completely independent of the parent, a KAREL program can initiate

    another task using the KCL or KCL_NOWAIT built-ins to issue a KCL>RUN command

  • a KAREL program can initiate another task using the KCL or KCL_NOWAIT built-ins to issue a KCL>RUN command

    You are correct, this seems to be what I'm looking for. However, I can't seem to get a KCL call in the KAREL script right. When I'm trying to call a sample KAREL-program 'hello_world.pc' I get status results unequal to 0.

    KCL('LOAD PROG hello_world', status) -> returns 2014

    KCL('RUN hello_world', status) -> returns 24003 (probably because it wasn't loaded correctly)

    Now I can't find any help regarding these return values online, so I'm still stuck.

  • When I'm trying to call a sample KAREL-program 'hello_world.pc' I get status results unequal to 0.

    KCL('LOAD PROG hello_world', status) -> returns 2014

    2014 is file-014 which is "file not found".


    According to the manual again:


    Purpose: Loads a p-code file from the default storage device and default directory into memory using

    the specified or default file name. The file type is assumed to be ``.PC.''

    If file_spec is not specified, the default program is used. If the default has not been set, then the

    message, ``Default program name not set,'' will be displayed.


    Note For R-30iB Plus, R-30iB, and R-30iB Mate controllers, the KAREL option must be

    installed on the robot controller in order to load KAREL programs.

  • Have you seen this thread:

  • 2014 is file-014 which is "file not found".

    Is there any error code conversion table available? I have tried looking for it but could not find it online.


    Regarding the use of the load function; when I already have the .PC file in the controller's memory (but not loaded as the active program), do I need to load the file before I can run it using RUN?

  • Have you seen this thread:

    Yes I have found this, but the issue in that thread is not what I am running into. I can run a KAREL program as a hot_start program without issues, the problem arises when I want to call another program from this hot_start-ed program.

  • I need to be able to run a KAREL program continuously in the background, that listens for a KAREL variable (or perhaps we will look into using a flag for this) that signifies an abort all request. Using a background logic program would be perfect, but KAREL programs sadly cannot be used here. I have tried to use a hot start autoexec program that calls a 'listener' KAREL program with the infinite loop, however this autoexec program still blocks the execution of other KAREL/TP programs which we need for the robot's regular functionality (TPIF-013 Other program is running). I am not sure what other options I have to implement this functionality, all options seems to get stuck on the fact that a program that is running and needs to be aborted blocks the execution of the abort_all program... Any suggestions would be appreciated.

    What is your $SCR.$MAXNUMTASK variable? Maybe increasing this variable and using autoexec will solve your problem.

  • The maximum number of user programs which can be run simultaneously. You can change it in controlled start. I had similar problem and it helped me, but if your variable is set to 4 maybe its not the problem. What does your code look like?

  • The auto-exec program is as follows:

    And the program 'test_bg' that I try to call is for now a simple program I use to debug the functionality:

    Both programs build successfully and their .pc files are in the controller's memory in roboguide.

  • Easy solution: don't call a different program. Why don't you start the 'test_bg' direct by autostart.

    And by the way: it's a good idea to change the WHILE TRUE with a test for a flag or something else to be able to stop the background program. Otherwise testing will be a bit fiddly.

  • Yes I have found this, but the issue in that thread is not what I am running into. I can run a KAREL program as a hot_start program without issues, the problem arises when I want to call another program from this hot_start-ed program.

    In that thread there is described a solution with assigning a macro to a flag, and start the macro by setting this flag, this works with starting TP or Karel programs from a autostart routine, and the foreground task is not blocked by those background tasks.

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