RobotStudio event

Rotate Robot

Options
Hi, All

I have  many questions. I get Position X , Position Y, Angle of component from camera,but I don't know how to use command(Rapid) for robot move to new Position.

I know I can use command MoveL offs( ... ); for move new position x ,y .But I don't know how to use command for Rotate(Angle).

Ex. Values from camera       Delta x = 10 mm.  ,  Delta y = 20 mm.  , Delta Angle = 5°

I use 
MoveL Offs(robot_cur,10,20,0),v100,fine,tool0;


I sorry if you understand, I use google translate.
Thank for help.

Comments

  • Hello Samucha
    I understand that you want to rotate the position after you have made an offset.
    Please read the help section about orient in RobotStudio.

    It its possible to use OrientZYX(anglez, angley, anglex) instead of the object orient1 if needed.
    VAR robtarget p20;VAR orient orient1;
    
    <div>orient1 := [0.707, 0, 0.707, 0];</div><div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>p20 := CRobT(\Tool:=tool0\wobj:=wobj0);</div><div>p20 := Offs(p20,10,0,0);</div><div><b>p20.rot := orient1; // </b><b>p20.rot := OrientZYX(30,30,30); 
    
    Hope it was the answer you're looking for
    /Oskar</b></div>
  • Samucha
    Options
    Hi, OskarHenriksson
    Thanks for reply.

    <b>p20.rot := OrientZYX(30,30,30);
    
    30 is Angle ?   If I want to rotate z-axis only. What is command to use?
    </b><pre class="CodeBlock"><b></b>But I try this command p20.rot<b> :=</b> OrientZYX(30,0,0);  . It not work.
    
    <span>Thanks for help.</span>
    </pre>
  • Pavel Riabichev
    edited July 2016
    Options
    Example:

        PERS robtarget p10:=[[423.76,413.882,0],[3.78552E-08,0.866025,0.5,2.18557E-08],[0,2,0,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];
        VAR num anglex;
        VAR num angley;
        VAR num anglez;

        PROC main()

            !Get current angles for p10
            anglex:=EulerZYX(\X,p10.rot);
            angley:=EulerZYX(\Y,p10.rot);
            anglez:=EulerZYX(\Z,p10.rot);

             p10.rot:=OrientZYX(anglez,angley,anglex);
             MoveJ p10,v1000,z50,tool0\WObj:=wobj0;
             WaitRob\InPos;

                p10.rot:=OrientZYX(anglez+30,angley,anglex);

                MoveJ p10,v1000,z50,tool0\WObj:=wobj0;
                WaitRob\InPos;

    ENDPROC
  • sturner
    Options
    Check out the RelTool function... this will allow you to use a position and optional rotation in degrees

    Basic examples
    The following examples illustrate the function RelTool.
    Example 1
    MoveL RelTool (p1, 0, 0, 100), v100, fine, tool1;
    The robot is moved to a position that is 100 mm from p1 in the z direction of the tool.
    Example 2
    MoveL RelTool (p1, 0, 0, 0 \Rz:= 25), v100, fine, tool1;
    The tool is rotated 25° around its z-axis.
  • Marcello
    Options
    try to combine offset and reltool in the same command

    MoveL Offs(RelTool(robot_cur,0,0,0\Rx:=0\Ry:=0\Rz:=5),10,20,0),v100,fine,tool0;



  • John_Verheij
    John_Verheij ✭✭✭
    edited August 2016
    Options
    It depends if you want to use the "active tool coordinate system" or "object coordinate system". In case of the  "active tool coordinate system", then you can use the function RelTool as stated above. 
    In your first post you indicate using the function Offs for translation, which uses the "object coordinate system". If this is also the case for the rotations, i would recommend just quaternion multiplications.  Remark, you have to be careful in which order you apply the rotations, for example the function "RelTool" and "OrientZYX" uses the ZYX order. You can think of a function like this:

    <div>&nbsp; FUNC robtarget Angle(robtarget Point,num Rx,num Ry,num Rz,\switch ZYX|switch XYZ|switch ZXY)<br></div><div>&nbsp; &nbsp; VAR robtarget PointRot;<br></div><div>&nbsp; &nbsp; VAR orient rot;<br><div class="post-text-align-left"><br></div></div><div>&nbsp; &nbsp; ! copy robtarget<br></div><div>&nbsp; &nbsp; PointRot:=Point;
    </div><div><br></div><div>&nbsp; &nbsp; ! rotate 180 degrees around x-axis to get "object coordinate system<br></div><div>&nbsp; &nbsp; PointRot.Rot:=Point.rot*OrientZYX(0,0,180);
    </div><div><br></div><div>&nbsp; &nbsp; ! choose rotation order and define rotation<br></div><div>&nbsp; &nbsp; IF present(XYZ) THEN<br></div><div>&nbsp; &nbsp; &nbsp; rot:=OrientZYX(0,0,Rx)*OrientZYX(0,Ry,0)*OrientZYX(Rz,0,0);<br></div><div>&nbsp; &nbsp; ELSEIF present(ZXY) THEN<br></div><div>&nbsp; &nbsp; &nbsp; rot:=OrientZYX(Rz,0,0)*OrientZYX(0,0,Rx)*OrientZYX(0,Ry,0);<br></div><div>&nbsp; &nbsp; ELSE<br></div><div>&nbsp; &nbsp; &nbsp; ! OrientZYX uses the order: rotation around Z-axis, rotation around the new Y-axis, rotation around the new X-axis<br></div><div>&nbsp; &nbsp; &nbsp; rot:=OrientZYX(Rz,Ry,Rx);<br></div><div>&nbsp; &nbsp; ENDIF<br></div><div><br></div><div>&nbsp; &nbsp; ! apply rotation and rotate back 180 degrees around x-axis<br></div><div>&nbsp; &nbsp; PointRot.Rot:=PointRot.Rot*rot*OrientZYX(0,0,180);<br></div><div><br></div><div>&nbsp; &nbsp; ! return rotated robtarget<br></div><div>&nbsp; &nbsp; RETURN PointRot;<br></div><div>&nbsp; ENDFUNC</div>