RobotStudio event

Comparison of joint targets fails

Options
I need to check that the current angles of axis joints 2,3,4,5 & 6 match the angles defined in  Jointtarget_1. As a test I have positioned the robot so that only the angle of joint 1 differs from the angles defined in Jointtarget_1.

Here is my code:
CONST jointtarget Jointtarget_1 :=[[54,-36,24,0,-26,45],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

VAR jointtarget Jointtarget_2;

PROC aTest()
    !Copy current joint angles to Jointtarget_2 ...
    Jointtarget_2 := CJointT();

    !Copy Joint #1 angle from Jointtarget_1 to Jointtarget_2 ...
    Jointtarget_2.robax.rax_1:=Jointtarget_1.robax.rax_1; 
 
    !Now Jointtarget_1 and Jointtarget_2 are equal ...
    IF Jointtarget_1 <> Jointtarget_2 THEN
        !Targets not equal
        ErrWrite "Targets not equal","";
    ENDIF
ENDPROC
When the code executes the error message is displayed although the joint angles viewed in the Watch window and FlexPendant are identical:
Jointtarget_1    [[54,-36,24,0,-26,45],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]

Jointtarget_2    [[54,-36,24,0,-26,45],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]
If I substitute the conditional test with 'IF Jointtarget_1 <> Jointtarget_1 THEN' the test works correctly and the error message is not displayed.

Can anyone replicate this behaviour or explain what is going wrong?

Thanks,

Kevin


Comments

  • mattdavis
    Options
    I would expect it is because the joint targets are actually stored to 3-5 decimal places.

    And if you are moving the robot, your unlikely to get it in exactly the same location.

    you may be have to subtract and each axis from the same axis in the one you want to compare and then sum the differences and check if that is small enough. Might work, not 100% sure what your trying to do though.
  • Kevin
    Options
    Hi Matt,

    Thanks for your reply.

    I had considered this as a possible explanation, but if I jog the axes slightly both the Watch and FlexPendant data windows display the angles to 6 decimal places if required. The fact that the  angles display with no decimal places leads me to believe that my Jointtarget_1 and Jointtarget_2 are actually equal. However, there must be an explanation for the strange behaviour, so I will experiment futher along the lines you suggest.

    The reason for wishing to do this is the robot is surrounded by a number of tooling stations, each with a safe 'Home' position with identical angles for axes 2 to 6. Motion between the tooling stations is achieved by a MoveAbsJ which moves only axis 1. If axes 2 to 6 are in the correct positions, an unskilled operator may re-start the cycle from a pushbutton (di) after an interruption to production, so long as the robot is at any of the Home positions.

    Kevin

  • Kevin
    Options
    Hi Matt,

    On displaying the Jointtarget_2 axis angles via UIMsgBox, one of the angles did have a value at the 6th decimal place (why did this not show in the Watch window or FlexPendant?).

    I have added lines of the form: 'Jointtarget_2.robax.rax_2:=Round(Jointtarget_1.robax.rax_2);' for each axis and now the comparison works correctly.

    Thanks again,

    Kevin

This discussion has been closed.