RobotStudio event

RelTool problem

Hi,
I'm having some problems with RelTool command. I'm making a program with IRB120 where I try to pick products from tray and then place them into a pallet using data I get from camera. Products need to placed into pallet with specific angle and they are randomly placed on the tray where they are picked. I'm using Offs command to do every other movement where info from camera is needed because that way I can use workobject that has same coordinate system as the camera does but I still need to use reltool at one point to fix the angle. The problem is that reltool moves the robot in all directions even though it is only given permission to rotate around z-axis. The point where it tries to reach with reltool command seem to be pretty random but it's always close to robots base. So why is it working like that? Here is a small sample of the code:

!First it moves to the products location and then picks it up
MoveL Offs(pKamera,nXOffset,nYOffset,60), v200, fine, tVacuum\WObj:=wobjPoiminta;
MoveL Offs(pKamera,nXOffset,nYOffset,7), v200, fine, tVacuum\WObj:=wobjPoiminta;
SetDO do2Vacuum, 1;
WaitTime 1;
MoveL Offs(pKamera,nXOffset,nYOffset,60), v200, fine, tVacuum\WObj:=wobjPoiminta;
!Robot moves above static pallet to the right position
MoveJ [[288.61,407.86,89.08],[0.019167,-0.999374,-0.0296428,0.00217687],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v100, fine, tVacuum\WObj:=wobjPoiminta;
!Here I try to correct the angle before placing the product into pallet but it all goes wrong right here
MoveL RelTool (pKamera, 0, 0, 0 \Rz:= nAngle2), v100, fine, tVacuum;
pKulma := CRobT(\Tool:=tVacuum \WObj:=wobjPoiminta);
MoveL Offs(pKulma,0,0,-20), v100, z0, tVacuum\WObj:=wobjPoiminta;
SetDO do2Vacuum, 0;
WaitTime 1;
MoveL Offs(pKulma,0,0,20), v100, z0, tVacuum\WObj:=wobjPoiminta;

Comments

  • reltool rotates about the TCP of the tool used in the move instruction.
    Where is your tVacuum tool's TCP? If it is off to one side of the tool the tool will rotate in a strange way.
  • TCP of the vacuum tool is defined like this: [TRUE,[[0,0,178.8],[1,0,0,0]],[1,[0,0,50],[1,0,0,0],0,0,0]]. The tool itself is a multitool so it has vacuum and pen holder but both are defined as separate tools. The weird thing is that reltool works just fine if I isolate it to it's own module so for example if I have module that has just one routine and I use command MoveL RelTool (pKamera, 0, 0, 0 \Rz:= (any number here), v100, fine, tVacuum; it works just as I expect it would. But when I bring that same line of code to my larger program then it won't work at all and robot moves in x-, y- and z-axis even though it is only supposed to rotate around z-axis.
  • Don't you need to reference RelTool to a wobj also?


  • In your above code you have already offset the pKamera position (before your MoveJ), but in the reltool you do not have any x.y.z offset so the position will move as well as rotate?
  • I don't offset pKamera position with MoveL Offs. I just move relative to that point. pKamera position is set so that it matches the origin of the camera coordinate system. And yes the reltool command offsets the position even though I don't apply any x,y,z offset to it and thats the problem.

    jmf said:
    Don't you need to reference RelTool to a wobj also?



    I don't think so because reltool works in tool coordinate system. Atleast in rapid manual the example code doesn't have reference to any wobj.
  • Sorry wrong words - the pKamera robtarget's position stays the same but the robots position has moved by the offset so you need to match that in the reltool move (but the x,y,z directions will probably be different as they are now relative to the tool not the workobject) .
    Also as jmf says you need to have the move relative to the same work object as the other moves using pKamera or that will also introduce an offset by the difference between wobj0 (base of robot) and your workobject 
    wobjPoiminta.
    The reltool offsets and rotations are relative to the tool but the robtarget's starting 
    position (before adding the offset) will be relative to the workobject used in the move command.
  • I'm not sure if I understand what you mean. I tried to fix it by adding new point just before the reltool command and then I use that point as reference in reltool but it didn't work. Here is the new code:
    MoveL Offs(pKamera,nXOffset,nYOffset,60), v200, fine, tVacuum\WObj:=wobjPoiminta;
    MoveL Offs(pKamera,nXOffset,nYOffset,7), v200, fine, tVacuum\WObj:=wobjPoiminta;
    SetDO do2Vacuum, 1;
    WaitTime 1;
    MoveL Offs(pKamera,nXOffset,nYOffset,60), v200, fine, tVacuum\WObj:=wobjPoiminta;
    MoveJ [[288.61,407.86,89.08],[0.019167,-0.999374,-0.0296428,0.00217687],[0,-1,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v100, fine, tVacuum\WObj:=wobjPoiminta;
    pKulma := CRobT(\Tool:=tVacuum \WObj:=wobjPoiminta);
    MoveL RelTool (pKulma, 0, 0, 0 \Rz:= nAngle2), v100, fine, tVacuum;
    pAseta := CRobT(\Tool:=tVacuum \WObj:=wobjPoiminta);
    MoveL Offs(pAseta,0,0,-20), v100, z0, tVacuum\WObj:=wobjPoiminta;
    SetDO do2Vacuum, 0;
    WaitTime 1;
    MoveL Offs(pAseta,0,0,20), v100, z0, tVacuum\WObj:=wobjPoiminta;

    I have the smaller test program also which has one MoveL Offs and one reltool command. Both reference the same point and it works perfectly. I use wobj0 in that program.

    If I completely missed the point you were making could you try to elaborate your previous answer?
  • Okay after reading your comment again few hours later I finally understood what you meant. I changed workobject in reltools reference point to wobj0 and now it works.
    Thank you for help!