Passing Arguments From TP to Karel

  • Does anyone know how Passing an argument from the teach pendent programming to a .PC program.... on the Karel side? for example do you do the following:


    PROGRAM FRM_OVD_XMPL(Dynframe:INTEGER;Pos1:POSITION;POS2:POSITION;Pos3:POSITION)


    Begin


    Whats even more cool. is Fanuc has a way of setting names for arguments. in the teachpendant. For example when i call the program on the tp for a 3d program...


    1: CALL FIRE_PROJECTOR (projector name= ,)


  • AD
  • DUUUDDDEEEE!!!!!!!!!!!!!!!!!!!!!!!!! i was legit just turned to that page in the Old Karel Manual.


    Any Idea how they set the name of an argument? in .TP?



    1
    : CALL FIRE_PROJECTOR (projector name= ,)

  • You have to create a file named argdispeg01.dt, load it, and reboot the robot.


    Here is what the contents of the file looks like on a job I did:


    The handlingtool manual goes over it pretty well.

    Check out the Fanuc position converter I wrote here!

  • Just what I was looking for few days ago. But I was looking in KAREL manual as I tought this was KAREL function ...


    Thanks


    You have to create a file named argdispeg01.dt, load it, and reboot the robot.


    Here is what the contents of the file looks like on a job I did:


    The handlingtool manual goes over it pretty well.

  • Nation,


    Youre right the handling manual does describe the Naming convetions for arguements prettty well. So i will have no problems in the future with that.


    Whats weird is the examples I use via the Karel program do not work. Having all kinds of issues just to pull a integer.


    My errors with logic im trying to use

    C:\uf_override.kl(22)

    22 GET_TPE_PRM(1, data_type, int_value, status)

    ^ ERROR

    ROUTINE called has less arguments than ROUTINE definition. Routine: GET_TPE_PRM


    C:\uf_override.kl(26)

    26 IF Data_type <> PARM_INTEGER THEN -- make sure parameter is an integer

    ^ ERROR



    Example in the manual. Which only shows half of what needs done. see attached. Is this a common thing in Karel? They only show you half the solution?

  • 22 GET_TPE_PRM(1, data_type, int_value, status)

    ^ ERROR

    ROUTINE called has less arguments than ROUTINE definition. Routine: GET_TPE_PRM

    You have to use the amount of arguments defined for that routine. None of them are optional. Doesn't matter if you don't use them later, they still need to be populated.

    C:\uf_override.kl(26)

    26 IF Data_type <> PARM_INTEGER THEN -- make sure parameter is an integer

    ^ ERROR

    PARM_INTEGER was probably a constant defined earlier in the program. I don't think it is a global constant. That, or it was imported. Check the top of the example program.


    My Karel joint conversion program uses GET_TPE_PRM quite a bit. Check it out here.

    Check out the Fanuc position converter I wrote here!

  • GET_TPE_PRM requires 6 arguments. You're trying to call it with 4. Therefore the error "ROUTINE called has less arguments than ROUTINE definition"

    GET_TPE_PRM(param_no, data_type, int_value, real_value, str_value, STATUS) - all arguments are required. If the parameter is INT, int_value will be the value of the parameter. If it's a real, real_value; string, str_value. Data_type tells you what type of parameter is being passed from the TP program.

  • I guess I can say that I understand what the compiler is recommending the issue is. It conflicts with what I am trying to understand in the Karel manual.


    So help me help my understanding of this language. I'm new to it.

    1.with any "built in procedure" all in/out have to be populated? For example 'GET_TPE_PRM(x,x,x,x,x,x)'.....

    2.also depending on the Data type of the TP argument only one of the variables will be populated,even though all 3 are shown, int_value, Real_value, or str_value?


    Nation,

    Your program helped a lot thanks. im learning quickly just started karel yesterday.


    everyone,

    the manual program example didn't set any variables or anything and shows the built in procedure wrong. Guess I will just have to accept this and learn that the manual isn't entirely right.

  • 1.with any "built in procedure" all in/out have to be populated? For example 'GET_TPE_PRM(x,x,x,x,x,x)'.....

    Correct. I'm not sure if Karel even supports optional arguments. Would be something to look into, but in this case, none are optional.

    2.also depending on the Data type of the TP argument only one of the variables will be populated,even though all 3 are shown, int_value, Real_value, or str_value?

    Also correct. The others are there in case the user passes in a real or a string. Like Titus said, data_type will tell you what came in, then you use that to know which var to look at. Pretty clunky, but that is Karel in general.

    Guess I will just have to accept this and learn that the manual isn't entirely right.

    Haha, welcome to the world of Karel.

    Check out the Fanuc position converter I wrote here!

  • 1&2 - correct on both


    The program in the manual is just a snippet. You're right that they don't show where they declared their variables, but I'm not seeing how the built-in is wrong?

    You are right, I as wrong. The Built-in is correct. must be that damn dyslexia or something....




    THANKS EVERYONE!!!!!!!!!!!!!!!!

  • <argument> denotes an optional argument

    {argument} denotes an optional repeatable argument

    Everything else is required


    Good luck learning Karel, I'm pretty new to it myself - once you get the hang of its weird idiosyncrasies it's not too bad.

  • Were you guys able to find out how to show the desciption of the arguments when calling the program from TP?


    i have it so when i call the program i have to manually add the arguments but their is no desciption as to what they are:


    PROGRAM Outputs_Ctrl

    %ALPHABETIZE

    %CMOSVARS

    %COMMENT ='Outputs Control'


    VAR

    Status, loop, StartOutput, EndOutput, OutputReq :INTEGER



    ------------------------------------------------------------------------

    ROUTINE GetArgumentValue

    VAR str_value:STRING[1]

    Real_Val:REAL

    BEGIN

    -- Read the arguments sent

    GET_TPE_PRM(1,1,StartOutput,Real_Val,'gripper',status)

    GET_TPE_PRM(2,1,EndOutput,Real_Val,str_value,status)

    GET_TPE_PRM(3,1,OutputReq,Real_Val,str_value,status)

    END GetArgumentValue


    ------------------------------------------------------------------------

    BEGIN -- Main Program


    GetArgumentValue


    IF OutputReq =1 THEN

    FOR loop = StartOutput TO EndOutput DO

    DOUT[loop] = ON

    ENDFOR

    ELSE

    FOR loop = StartOutput TO EndOutput DO

    DOUT[loop] = OFF

    ENDFOR

    ENDIF


    END Outputs_Ctrl


    pasted-from-clipboard.png

  • Hi penguinMan,

    you can set up the ArgdispEgXX.file ... i think that will help you out


    [PROGRAM]

    NAME = "OUTPUTS_CNTR"

    ARGUMENT = '3'


    [ARGUMENT]

    N01 = "Start Output"

    N02 = "End Output"

    V03 = "ON":'1', "OFF":'0'


    [ENDPROGRAM]

    Edited once, last by R47: [PROGRAM] NAME = "OUTPUTS_CNTR" ARGUMENT = '3' [ARGUMENT] N01 = "Start Output" N02 = "End Output" V03 = "ON":'1', "OFF":'0' [ENDPROGRAM] ().

  • Do you know where i can find some documentation on the argdispeg file? i tried searching it through the handling tool and karel manuals but cannot seem to find anything on it

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