Vision and workobjects

  • Hi

    Once again I'm fighting with a vision and workobjects trans and orient.

    I can't find complete examples on the net and the programs that I've done before are not helping much



    PERS wobjdata wobjvision:=[FALSE,TRUE,"",[[8.63,-513.81,-56.26],[0.708021,-0.00362682,-0.00371983,0.706173]],[[0,0,0],[1,0,0,0]]];

    PERS robtarget pPick:=[[0,0,0],[1,0,0,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]];


    VAR pos VisionTranslationPoints:=[0,0,0];

    VAR num VisionXRotation:=0;

    VAR num VisionYRotation:=0;

    VAR num VisionZRotation:=0;



    Xoffset:=15; These are test coord

    Yoffset:=15;

    zangle:=0;


    VisionTranslationPoints.x:=Xoffset;

    VisionTranslationPoints.y:=Yoffset;

    VisionTranslationPoints.z:=0;

    VisionXRotation:=0;

    VisionYRotation:=0;

    VisionZRotation:=zangle;


    At this point I have the values 15s and 0s in the correct place

    The I offset the oframe with those values. Then I move


    wobjVision.oframe.trans:=[VisionTranslationPoints.x,VisionTranslationPoints.y,VisionTranslationPoints.z];

    wobjVision.oframe.rot:=OrientZYX(VisionXRotation,VisionYRotation,VisionZRotation);


    MoveL Offs(pPick,0,0,10),v1000,z1,tPointer\WObj:=wobjVision;


    If I run this program the robot doesnt even go near the 15,15, it goes who know where

    This should be very simple. I'm missing something

    Any thoughts ? Thanks

    Retired but still helping

  • Here's a possibility, keep in mind I have no experience with IRC5s and vision systems.


    Your code:

    wobjVision.oframe.rot:=OrientZYX(VisionXRotation,VisionYRotation,VisionZRotation);


    Manual's expalnation:

    OrientZYX (ZAngle YAngle XAngle)

    The rotations will be performed in the following order:

    • rotation around the z axis,

    • rotation around the new y axis,

    • rotation around the new x axis.


    This suggests, as a start, to try the below:

    wobjVision.oframe.rot:=OrientZYX(VisionZRotation, VisionYRotation, VisionXRotation);



    EDIT: Hmm - It was not noticed, until NOW, that in the example all the values pumped into the num data for the Euler rotations are all zero. I dunno if that makes a difference. :confused_face:

    Edited once, last by SomeTekk ().

  • What vision system? And what frame is the vision system calibrated to? A robot-mounted vision would probably do offsets in Tool coordinates, whereas a fixed vision system might be calibrated to a WorkObject UFrame.


    Which is another thing: You're adjusting OFrame, but what is the UFrame of that WorkObject set up to? The last time I used a vision system that was fixed and gave corrections relative to a WorkObject, my UFrame had to be set up first, coordinated with the vision system, and only then would the vision offsets work when applied to the OFrame.


    This is the program I used for offsetting the OFrame:

    But, as I said, I had to create the UFrame first, and get the vision system aligned with the UFrame. Then, every point that was being offset by the vision had to be taught using that WorkObject:

    Code
        ! Trigger vision system, get offsets
        ! Only perform pickup if DoVision returns TRUE 
        ! Else, perform fault recovery and escape
        IF (DoVision(1,RACK_BASE) = TRUE) THEN
      
          !Move to pick up part    
          MoveL R1_Pre_Pick, v500, z10, toolgrip1\wobj:=Rack_Base;
          MoveL R1_Pick, v100, fine, toolgrip1\wobj:=Rack_Base;

    Rack_Base was my work object. The UFrame was set up to the tooling holding the rack of parts, and if the rack and parts were perfectly positioned, the program would work perfectly well with an OFrame of all 0s. But if the parts were off location, the OFrame adjustment would bring the end effector to the part perfectly.


    Remember, any rotations of the OFrame component are carried out around the origin of the OFrame, after the XYZ shifts have been applied. So if your origin is distant from your Pick location, very small rotations can result in very large XYZ motions as a side effect. If you make all your rotations 0, and only do XYZ shifts, does the motion behave as expected?

  • Thanks SkyeFIre

    I'm basically doing this


    "The last time I used a vision system that was fixed and gave corrections relative to a WorkObject, my UFrame had to be set up first, coordinated with the vision system, and only then would the vision offsets work when applied to the OFrame."

    The PLC is telling me the coord"


    As far as

    "What vision system? And what frame is the vision system calibrated to? A robot-mounted vision would probably do offsets in Tool coordinates, whereas a fixed vision system might be calibrated to a WorkObject UFrame."


    I wrote that down but I deleted . What was i thinking ?

    Anyway It's Cognex. We place the grid on top of the belt and i teach my work object and the vision guy teaches his user in the same place, so are coord match.


    I got it working, I just had to go for a walk,

    I'm going to post it once is done done

    Retired but still helping

  • This is what I end up doing



    PROC Pick()

    !***********************************************************************

    RecoveryArea :=1;

    ! Get values from PLC into variables

    ! Replace the necessary workobject parameters with these values

    VisionTranslationPoints.x:=Xoffset;

    VisionTranslationPoints.y:=Yoffset;

    VisionTranslationPoints.z:=0;

    VisionXRotation:=zangle;

    VisionYRotation:=0;

    VisionZRotation:=0;


    ! Load the individual values to rotate the oframe

    wobjVision.oframe.trans:=[VisionTranslationPoints.x,VisionTranslationPoints.y,VisionTranslationPoints.z];

    wobjVision.oframe.rot:=OrientZYX(VisionXRotation,VisionYRotation,VisionZRotation);


    !If cursor is over "\WObj:=wobjVision;" in particular "wobjVision", the software will display the original value

    !of the workobject (user) and the new introduced value (object)

    MoveL Offs(pPick,0,0,10),v3000,z1,tPointer\WObj:=wobjVision;


    TriggIO TriggVac, 10,\DOp:=do16_VacOn, 1;

    TriggL Offs(pPick,0,0,0),v500,TriggVac,fine,tPointer\WObj:=wobjVision;

    WaitTime 0.2;


    !Using the command below in some locations the robot will present

    ! error 50442 Robot axis configuration error

    !There robot was not even close to singularity

    !The MoveL Offs was replace by Move RelTool

    ! MoveL Offs(pPick,0,0,20),v2000,z1,tPointer\WObj:=wobjVision;


    pTemp:= CRobT (\Tool:= tPointer \WObj:= wobjvision);

    Movel RelTool(pTemp,0,0,-20),v2000,z10,tPointer\WObj:=wobjvision;


    ENDPROC

    Retired but still helping

Advertising from our partners