RobotStudio event

how to assign data to pos through external files

Options
Hi, I am reading the coordinate [x,y,z] from external txt file into an array. My questions are: 1) how to assign the array to pos type? for example, I have input=[1,2,3], and I define VAR pos position; can I use position :=input? 2) as my position is a VAR (variable) already. When I define VAR pos position; VAR num input{3}; VAR robtarget Target_20:=[position,[0.499999903,0,0.86602546,0],[0,0,0,0],[9E9,9E9,9E9,9E9,9E9,9E9]]; the program has this error: the expression position is not a constant expression. How can I solve this problem? Thanks!

Comments

  • PerSvensson
    Options
    Hi this may he PROC myTest() VAR pos myPos; VAR num myPosArray{3}:=[1,2,3]; VAR robtarget myTarget; myPos.x:=myPosArray{1}; myPos.y:=myPosArray{2}; myPos.z:=myPosArray{3}; myTarget.trans:=myPos; ENDPROC
    Per Svensson
    Robotics and Vision Specialist
    Consat Engineering
  • WuYue
    Options
    Hi, PerSvensson, Thanks for your reply! It works!