RobotStudio event

shift axis based on "num data"

Hello everyone, I want to move the X axis of the robot at some point according to the data coming from the plc.
My codes are as follows. Can you help me how to do this? For example, which command should I use, or is there an example?
Thank you from now.

    VAR num x_axis_shift;
    PROC Axis_shift()
        ! Get data from plc to Group input and transfer this data to "x_axis_shift".
     x_axis_shift:= GInput (eksno);

     ! First Step
MoveJ [[405.52,9.16,1237.59],[0.00409069,-0.558241,0.829556,-0.0136706],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v1000, z50, tool0;
     ! Second Step
MoveJ [[1192.06,8.86,1237.58],[0.00408985,-0.55824,0.829557,-0.0136663],[0,-1,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v1000, z50, tool0;

! Step 3
! Move j or moveAbsJ, whichever is appropriate, will be used in the following steps.
! Shift the x axis according to the data in "x_axis_shift", for example if the value is "10",
 ! 10mm. to the right I want it to scroll.

! *****************************************************************************************************************************************************
!Move J 
MoveJ [[1384.03,-113.00,565.26],[0.00703595,0.547633,-0.836655,-0.00751999],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v100, fine, tool0;
!Move Absj
MoveAbsJ [[-4.67897,41.0717,3.25588,0.250736,46.8381,-71.2686],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]]\NoEOffs, v100, fine, tool0;
! *****************************************************************************************************************************************************

! Step 4
MoveJ [[1384.03,-113.09,554.50],[0.00704569,0.547649,-0.836645,-0.00752378],[-1,0,-1,0],[9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]], v1000, z50, tool0;



  • Offset
    Lee Justice
  • Hello Lemster.  Thank you for answering.  I tried for this for a while but I was not successful.  I defined a variable called
    var robtarget position1
    and wrote the position information to position1 as
    position1 Offs (position1, x_axis_shift, 0, 0),
    but unfortunately it did not work.  Can you explain to me how I should do it using the example I wrote?  Thank you.
  • lemster68
    lemster68 ✭✭✭
    Pseudo code follows:

    PERS position;
    PERS positions!;
    VAR num nOffs;

    nOffs:=some value from somewhere
    Position1:=Offs(position, nOffs,0,0);
    ! to verify
    MoveL position
    MoveL position1
    Lee Justice
  • Thank you Mr. Lemster. You are a wonderful person. I solved my problem with the example you gave. Please let me ask one more question. What should I do if I wanted to move only the 2nd axis or the 5th axis of the robot?
  • lemster68
    lemster68 ✭✭✭
    You need to use a jointtarget and use MoveAbsJ instruction.  Prior to that, you would take a snapshot of the robot's joint angles and add to the desired joint the desired number of degrees to move.
    Lee Justice