Position Relative To ROBROOT or Perform Geometric Operatoration In VB or C#

  • Hi,


    I have a situation whereby I need to know the robot position relative to robroot continuously. Currently when $ACT_BASE is set to an assigned base the $POS_ACT position is relative to the origin of the base.


    I have the below code in the SPS, but occasionally the SPS stops. This is due to the fact that $POS_ACT, $ACT_TOOL or $ACT_BASE can have a state where they are uninitialised (i.e. null) and also the SPS and Robot Program run with different interpolations.


    Code
    IF ((VARSTATE("$POS_ACT") == #INITIALIZED) AND ($ACT_TOOL>0) AND ($ACT_BASE>0)) THEN
      TCP_ACT=BASE_DATA[$ACT_BASE]:$POS_ACT
    ENDIF
    IF ((VARSTATE("$POS_ACT") == #INITIALIZED) AND ($ACT_BASE==0) AND ($ACT_TOOL>=0)) THEN
      TCP_ACT=$POS_ACT
    ENDIF


    I have looked at doing this via an interrupt but as stated previously I need it to run continuously.
    I need to try reading the variables into local SPS variables, and perform my checks on the local variables, this may improve things?
    I was thinking about getting a handle on the variable $ACT_BASE and performing the calculation in my plugin?


    Does anyone know of a different approach to this?


    Cheers.

  • $POS_ACT and $POS_ACT_MES can be uninitialized at almost any time, by various circumstances. A program reset/cancel is is one.


    Assuming you have a KSS version of 5.6 (5.4?) or higher, you could try using ON_ERROR_PROCEED to get over the "Invalid Value" errors.


    You could try using the FORWARD function with $AXIS_ACT (which is always valid), but you would need to be careful about managing Tool and base data.


    The Geometric Operator is essentially just a cross-multiplication between two matrices which have been created from each of the POS/FRAME variables. So recreating the linear algebra offline is possible, but you need to have a good grasp of the underlying math and Euler rotation handling.

  • Unfortunatly this is not totally correct:


    Quote

    And because it's calculating the cartesian position from joint values, tool transformation and base transformation is not in the result


    You still need to set a valid $TOOL and $BASE. Cartesian positions always have a coordinate system you refer to ($BASE) and a coordinate system that is referred ($TOOL). In the special case $TOOL = $NULLFRAME and $BASE = $NULLFRAME you get from Forward($AXIS_ACT, Options) the current flange position referring zu the robot base (at least if you are not mounted on e.g. a linear unit).


    Fubini

  • Maybe I explained it badly, or I'm really misunderstanding it how it works. I know that you need valid $tool and $base for cartesian motions, but when you execute the forward($axis_act, options) do you get the current tcp position in the current base, or the flange position the world, or maybe something else? Since the function doesn't seem to take tool or base arguments, does it internally use the current tool and base values to calculate the current tcp position in the current base?


    Edit: Duh! It actually says in the pdf that it uses $tool, $base, $robroot and $ipo_mode. Too lazy to read until someone points out mistakes.

    Edited once, last by Spl ().

  • Using the FORWARD command I could check the err_status to whether the $BASE or $TOOL values were invalid.
    What do you think to the below code? (I'm not currently at a controller to try).



    ON_ERROR_PROCEED shouldnt be needed in this case because the variables that could become uninitialised are not used in any calculations?

  • That might work. I was actually thinking of something like this


    Code
    temp = $base ; store current base 
    $base = $nullframe
    tcp_act = forward($axis_act, err_status)
    $base = temp ; reset base to what it was


    but I don't know if it would mess up any ongoing movements.

    Edited once, last by Spl ().

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