Create a TP program with KAREL

  • I'm trying to write a KAREL program that will create a TP program and populate it with a bunch of motion commands. The problem I'm having is it seems like there's a way to make a TP program (CREATE_TPE), but no way to add new lines or instructions to it. So what's the point of that command? I can modify existing motion commands with the SET_POS_TPE, but not create new points. So I tried to just create an LS file and use position registers to make it easy, but I keep running into problems with the /ATTR section of the program causing ASBN-002 syntax errors when loading.


    Anybody done something like this? I know there's got to be a command set for it, because FANUC has KAREL programs that basically do this.

  • Right, so for most of these routines I don't have any documentation, but this is what I've been able to find:



    For your specific use case, I think especially SET_TEXT_TPE() would be interesting.


    I don't know of any way of adding new, empty lines to TP programs other than using REP_INST_TPE().


    These same functions give you some nice insight into the binary encoding of TP programs, without the cumbersome compression that the actual files use.

    Edited once, last by rf103 ().

  • I know this is a bit old but I'm wondering if Flatcurve every got this to work. I'm looking to do something very similar.

  • See attached code which contains a non supported build-in. Not all movement types are supported but it might do the trick for your application.


    Fanuc is not keen on supporting movement in Karel. Their vision is that all generated points should be teached by a qualified operator in TP. Karel logic programs can then call these teached movement TP programs.
    But FANUC seems to forget that in some cases you have to use the readily available robot kinematic model on the controller to compute or convert points during operation, so it is easier to let the controller generate the TP programs without any link to a PC/software. On the opposite of the attached code typically a software is used to create the TP program structure and points offline which is then uploaded to the controller. In the latter if anything goes wrong the software is to blame and not the controller. I guess it is a question of liability.


    Have fun!


  • See attached code which contains a non supported build-in. Not all movement types are supported but it might do the trick for your application.


    Fanuc is not keen on supporting movement in Karel. Their vision is that all generated points should be teached by a qualified operator in TP. Karel logic programs can then call these teached movement TP programs.
    But FANUC seems to forget that in some cases you have to use the readily available robot kinematic model on the controller to compute or convert points during operation, so it is easier to let the controller generate the TP programs without any link to a PC/software. On the opposite of the attached code typically a software is used to create the TP program structure and points offline which is then uploaded to the controller. In the latter if anything goes wrong the software is to blame and not the controller. I guess it is a question of liability.


    Have fun!





    Wow !!!


    Tell us in which manuals you found these functions?
    I usually created a TP via an LS file.
    It also works, but for this you need the ASCII Upload option

  • Correct that is an important note which I did not mention: ASCII upload is always the way to go if you have the option installed. It provides full functionality while the mnemonic approach has limitations.


  • Correct that is an important note which I did not mention: ASCII upload is always the way to go if you have the option installed. It provides full functionality while the mnemonic approach has limitations.


    so in which description did you read about these instructions?

  • Wow !!!


    Tell us in which manuals you found these functions?
    I usually created a TP via an LS file.
    It also works, but for this you need the ASCII Upload option

    Hello!


    I have question about WRITE file1('PROG_SIZE = 772;',CR) from your file. How do you found out that this size is suitable for your prog?

  • See attached code which contains a non supported build-in. Not all movement types are supported but it might do the trick for your application.


    Fanuc is not keen on supporting movement in Karel. Their vision is that all generated points should be teached by a qualified operator in TP. Karel logic programs can then call these teached movement TP programs.
    But FANUC seems to forget that in some cases you have to use the readily available robot kinematic model on the controller to compute or convert points during operation, so it is easier to let the controller generate the TP programs without any link to a PC/software. On the opposite of the attached code typically a software is used to create the TP program structure and points offline which is then uploaded to the controller. In the latter if anything goes wrong the software is to blame and not the controller. I guess it is a question of liability.


    Have fun!

    Hello!

    Do you have examples of adding another motion-modify options to instructions, not only TIME BEFORE?

  • Hello together,


    I actually write a karel program which creates a standard tp programs and with the information about the klevtpe.kl from rf103 I already get my program partly working.


    Now I have to insert lines, which write to a register.


    For that, I use the parameters

    lm_const = 1 -- constant

    lm_index = 2 -- index

    lm_reg = 3 -- Register


    The only problem is it will not set the correct register number.

    Does some here did this already?


    Thx a lot







  • This is absolutely awesome! Thank you so much!

    I just want to point out that in the following instruction

    Quote from WRITETP-copy.kl

    SET_POS_TPE(open_id, pos_num, tmp_pos, op_status , G1)

    tmp_pos is of XYZWPR but if it were replace by a JOINTPOS type, the same line would be written in the TP program but with a Joint representation... Might be obvious to some but still worthy of mentioning. :smiling_face:

  • Hello all!!


    I am just posting here without creating a new thread.


    I am new to Karel but trying to understand all the functions.

    I have created the code to send and receive the values from the controller to the PLC via a ProfiNET.

    But unfortunately it is not working.


    I would like to get some help from the experts out here.


  • I am just posting here without creating a new thread.

    Why don't you open a new thread? You have a complete different question.

    I am new to Karel but trying to understand all the functions.

    I have created the code to send and receive the values from the controller to the PLC via a ProfiNET.

    But unfortunately it is not working.

    What do you mean by 'it is not working'?

    Imho this code even won't be compiled. So it can't work.


    F.e. you define an array of integer: FANUC_OUT

    then you use FANUC_OUT as a structure FANUC_OUT.bHCodeREQ[i].

    This will not be compiled.


    Your main program

    Code
    --SECTION 4: MAIN PROGRAM
    ------------------------------------------------------------------------------------------------------------------------
    ------------------------------------------------------------------------------------------------------------------------
    BEGIN
    WRITEHM
    END WRITEHM


    doesn't do anything but calling itself, so what other things should this program do instead of nothing?

    Even worse, this is a endless recursive calling, you will get a stack overflow or something similar.


  • Hello Hermann,


    Sorry I would have created a new thread.


    Exactly, I'm trying to compile the file but have so many errors that it doesn't work. :confused_face:

    That's where I would need your help to fix these errors.


    As mentioned before, I am new to KAREL. I am reading documents and learning through the threads created here.

Advertising from our partners