CHECK_EPOS built-in, finding the right parameters -how to get the UTOOL and UFRAME in KAREL as POSITION data type

  • Hi dear robot-forum community!


    I have again some problems with the lovely KAREL language. I have a LR Mate 200iD/7L with a R-30iB Mate cabinet Controller and I build a socket communication between my PC and the robot. So i can set a position register with the value i send from the PC. Before moving to this position I would like to check if this position is even reachable. Therefore I try to use the built-in CHECK_EPOS procedure. In the Karel manual is the following syntax for this procedure:


    Syntax :CHECK_EPOS (eposn, uframe, utool, status <, group_no>)

    Input/Output Parameters :

    [in] eposn :XYZWPREXT

    [in] uframe :POSITION

    [in] utool :POSITION

    [out] status :INTEGER

    [in] group_no:INTEGER

    %ENVIRONMENT Group :PBCORE

    Details

    :•eposnis the XYZWPREXT position to be checked.

    •uframespecifies the uframe position to use witheposn.

    •utoolspecifies the utool position to use witheposn.

    •statusexplains the status of the check. If the position is reachable, the status will be 0.

    •group_no is optional, but if specified will be the group number foreposn. If not specified thedefault group of the program is used.


    My problem is that i don't get the values for the parameters uframe and utool. Is there a way to set a user defined variable in the data type position to the Tool Number 1 (e.g.) and the frame to the world frame/ user frame whatever?


    I already tried to set a Position variable for the uframe like this:

    WORLD:POSITION

    WORLD.location.x=0

    WORLD.location.y=0

    WORLD.location.z=0


    but then i can't set the Orientation or even set the tool. Does anybody knows a way to just set my variable to the tool or frame with the number (1,2,3,4,....)??
    Thanks a lot for any help!


  • Herman, yeah your way worked!


    dha i tried, and yes it works too,when you pass it as $UTOOL/$UFRAME or $MNUFRAME[1,1]/$MNUTOOL[1,1]. but i wasn't sure because the status from the CHECK_EPOS Position was never 0(reachable)


    I fixed it by adding the optional (obviously not so optional) paramter group_no. Now the status returns a correct value.

  • Hi all,


    I was looking KAREL "reference programming manual " in section B.8, author used "CHECK_EPOS" built-in with an "XYZWPR" data type and I am also trying to do but I am having a warning from ktrans:


    113 CHECK_EPOS(lpos,UFRAME,UTOOL, 1,STATUS)

    ^ WARNING

    Argument will be passed by value. Id: LPOS


    Here is my code:

    Code
      GET_VAR(entry, '*SYSTEM*', '$MNUFRAME[1,1]', UFRAME, STATUS)
      GET_VAR(entry, '*SYSTEM*', '$UTOOL[1,1]', UTOOL, STATUS)
      lpos= GET_POS_REG(reg_ID_CART,STATUS,1)
      CHECK_EPOS(lpos,UFRAME,UTOOL, 1,STATUS)
      WRITE('CHECK_EPOS',lpos,STATUS,CR)

    Also, when that KAREL program is run on TP I got an "uninitialized data" at

    Code
    CHECK_EPOS(lpos,UFRAME,UTOOL, 1,STATUS)

    any help will be appriciated.


    Thanks in advance

  • Post your full code. Something in one of the parameters passed to CHECK_EPOS is not initialized.


    The warning you are getting is not anything to be worried about, especially since it is involved in a built in function.


    There are two ways to pass vars in Karel, by reference, or by value. When passing by value, any changes to the passed in data will not be reflected on the original data. When passed by reference, changes to the data inside the function will happen to the original data passed in.

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

  • Thanks, Nation for your response.

    Here is my full code, now I am having error at:

  • That's not full code. I can't compile it to diagnose your issue.


    Critiques from the snippet of code you did post:

    • Fix your spacing.
    • Where is joint_pos coming from, and why are you overwriting lpos if you are pulling that from a PR? Why pull lpos from a PR at all? This is probably where your uninit error is coming from.
    • There are no loops in this code, so I don't see why you are getting a stack overflow error.
      • Post the actual error.

    Check out the Fanuc position converter I wrote here! Now open source!

    Check out my example Fanuc Ethernet/IP Explicit Messaging program here!

  • Where is joint_pos coming from, and why are you overwriting lpos if you are pulling that from a PR? Why pull lpos from a PR at all? This is probably where your uninit error is coming from.

    Joint POS is coming from another application(App2) running in the cloud. App2 receives robot's work cell picture and process it with CNN to detect object to pick and does geometric transformations and provide joint angles for the the object that needs to be picked.

    My middleware application (Python script) receives the Following is the message received from App2:

    The joint angles in the message are dummy (taught randomly for testing). J1 and j2 are reachable locations on the other hand J3 is not readable.

    I a position is not reachable then middleware starts the camera cycle for a new picture and sends it to App2. The following picture shows the big picture of the use case. A lot of steps for APP1(middleware) has been completed.

Advertising from our partners