RobotStudio event

Use RelTool function not inside a Move instruction

Options
Hello,

I have a doubt about the use of RelTool not within a Move instruction. To clarify what I mean, I'll make an example:

CONST robtarget Target_10:=[[0,550,300],[-0.000000005,0.707106781,0.707106781,0.000000005],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

CONST robtarget Home:=[[302,0,558],[0,0,1,0],[0,0,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

PERS wobjdata wobj1:=[FALSE,TRUE,"",[[1000,0,0],[0.707106781,0,0,0.707106781]],[[0,0,0],[1,0,0,0]]];

PERS robtarget p1;

PROC main()
        
        
    MoveJ Home,vmax,fine,tool0\WObj:=wobj0;
    
    IF bMod = 1 THEN   !bMod is a DI that I used in the simulation to distinguish the 2 cases
        
        p1:= RelTool(Target_10,100,0,0);
        MoveJ p1, v100,fine,tool0\WObj:=wobj1;
        
        
        
    ELSE
        
        MoveJ RelTool(Target_10,100,0,0), v100,fine,tool0\WObj:=wobj1;
        
        
    ENDIF
        
        
    ENDPROC


bMod allow me to choose between using RelTool inside the MoveJ instruction (bMod=0) or not. 
In the simulation I see that the robot reaches the same point in both cases, with translation coordinates: [0,650,300].
However, to me the case with bMod=1 does not make sense: it defines p1 as a displacement in the tool coordinate of tool frame of 100 mm along x axis, but regarding which workobject? I thought wobj0 since it is the workobject used in the previous motion to Home, but it's not like that; actually it's like it is considering wobj1 (you can see it from the coordinate values [0,650,300]).
So, while in the case bMod = 0 the robot know we are moving (and then computing the position) with respect to wob1, how does he know we are considering that wobj in case bMod = 1?
I was actually expecting Rapid to give me an error using RelTool not within a Move instruction.

Thank you


Comments

  • lemster68
    Options
    You have made it so that it will go to the same position.
    p1:= RelTool(Target_10,100,0,0)  =  RelTool(Target_10,100,0,0)
    The RelTool is relative to the tool coordinate system, not the workobject coordinate system.  It is also possible to use Offset function outside of a move instruction to manipulate points.  This is relative to the workobject coordinate system.  I fact, I have used the Offset function to displace a point, and then used the reltool function on that displaced position.
    Lee Justice
  • mandolas
    mandolas
    edited October 2023
    Options
    Hi...
    Technically what you are doing is the same thing, because when you execute:
    p1:= RelTool(Target_10,100,0,0);
    MoveJ p1, v100,fine,tool0\WObj:=wobj1;
    
    OR
    
    MoveJ RelTool(Target_10,100,0,0), v100,fine,tool0\WObj:=wobj1;
     See that the position "p1" is receiving the coordinates from "RelTool(Target_10,100,0,0)", so the final position will be the same, if the object is the same.
    MoveJ p1, v100,fine,tool0\WObj:=wobj1;
    ...
    MoveJ RelTool(Target_10,100,0,0), v100,fine,tool0\WObj:=wobj1;
    The object is used to manipulate the position, that is, if you use the Offs() function then the object will have its function, otherwise it will not, which is why the parameter is optional.
    The "\WObj:=wobj1", I use in case of possibility of future object change or position manipulation using the Offs() function, otherwise I do not use this parameter.