RobotStudio event

variable Robtarget

Hello to all..
i am trying this code....
X-Coordinates := a;                              (From external plc)
Y-Coordinates := b;                              (From external plc)
Z-Coordinates := c;                              (From external plc)

VAR Robtarget delta
delta.trans.x := a;                                 (From variable a to robtarget trans.x)
delta.trans.y := b;                                 (From variable b to robtarget trans.y)
delta.trans.z:= c;

i am getting an error. I am writing the code in Robot Pendant, and to equate the variable a,b,c with trans.x,trans.y,trans.z values of robtarget , when i use the assign function ":=" and data type Robtarget. I can select robtarget "delta" but how to write trans.x,trans.y,trans.z to move values from a,b,c to robtarget delta. if i select all and write it myself it gives error.  If some guidance on how to write and use each value trans.x,trans.y,z..

Comments

  • Are a, b and c declared as num type?  After selecting delta, edit, abc.  Type .trans.x and such.
    Lee Justice
  • yes sir..
    a,b and c are num type. as the coordinates data from plc is moved into a,b and c.
  • i use the same method as you respectable mentioned, selected delta and edit. when write ".trans.x" etc and equate it with "a".
    a:= delta.trans.x 
    it turns the writing "trnas.x" into red colour like wrong syntax or something. 

  • delta.trans.x:=a; is correct syntax.  Did you make a typo? 

    it turns the writing "trnas.x" into red colour like wrong syntax or something. 

    notice in your reply, trnas.  Make sure you don't leave out required . where needed.
    Lee Justice
  • Sorry for the late reply i was suffering from fever. 
    Sir, that issue is resolved the problem was not with the "trans.x" syntax. In the motion command right after the trans.x, trans.y and trans.z values i have to use "Wobj1" from optional arguments for my job which i was missing. 
  • There is a query regarding programming if you kindly give it a check
    For some numeric value like "4" saved as Input sent from the external plc,

    if i see the IO tab the value is shown "4" but saving the value in some variable "reg1", and check the Program data > "num" reg1 it is 3.999999..

    Using this variable in IF command generates an error like " IF reg1 := 4 then" ... it always go for the second option "IF reg1 < 4 then"..
    i think Round() function can't be used in IF condition..

  • Round it first then.
    Lee Justice