how to restart an aborted task, if RUN_TASK doesn't work, fanuc error code manual

  • Hi,

    i try to run a TP program with my karel code. Therefore I use the procedure RUN_TASK and it works from time to time.

    Code
    RUN_TASK(tmp_str,0,FALSE,TRUE,1,status)

    So it's theoratically possible to move the robot by running a task.

    But often it doesn't work. Then I got a Run_TASK Status like: 3007 or 6003 and I don't really know how to fix it

    I use a LR Mate 200iD/7L with a R-30iB Mate cabinet Controller btw.


    I also tried to catch the task state with the function GET_TSK_INFO

    Code
    GET_TSK_INFO(tmp_str,0, TSK_STATUS,value_int, value_str, status)

    If anything is alright, I got the value_int = 0, but if not i got value_int = 2, what means PG_ABORTED


    That's why I wanna know how to restart an aborted task? When i CONT_TASK it fails cause the task is aborted not paused.

    Does anybody knows how i can do this?

    And does anybody got an error code manual from Fanuc, where i can check all the status values, which i get in so much Karel procedures?
    I know this side: http://linuxsand.info/fanuc/

    But therefore i still need to find out the first letters..


    Thanks a lot to any help!

  • kwakisaki

    Approved the thread.
  • The GET_TSK_INFO function is tricky. For example, TSK_STATUS will not be set at all if a task has never been run(since the robot controller was booted up). Also, just as you noticed RUN_TASK and CONT_TASK only work if the task is in the correct state.

    There are a few KAREL constants that I use to compare with the value of TSK_STATUS: PG_RUNNING, PG_PAUSED, and PG_ABORTED.


    Here is an example of what I do. Note that in my case I was only interested in if a program is NOT running. So I always abort it and restart it even if it is paused.


    tsk_sts_int=-1 --Initialize the value, this allows us to check if the value is never set


    GET_TSK_INFO(prog_name ,task_no,TSK_STATUS,tsk_sts_int,tsk_sts_str,STATUS)

    --IF prog_name has never been run, GET_TSK_INFO will return an error value in STATUS

    --and task_sts_int will not be set. So we can check if task_sts_int=-1 (the initial value) to know if the program

    --needs to be started

    IF(tsk_sts_int<>PG_RUNNING) OR (tsk_sts_int=-1) THEN

    ABORT_TASK(prog_name ,TRUE, TRUE,STATUS)

    Now call your RUN_TASK

    ENDIF

Advertising from our partners