Can i change transforms in a list of robtargets?

k_schmidk_schmid
edited July 11 in RAPID Programming
I am trying to get rid of globals and typing names in my program.
I want to change transforms of some targets

CONST string targetnames{5}:=["Target_R11_10","Target_R11_40","Target_R11_30","Target_R11_20","Target_R11_50"];
GetDataVal targetnames{1},current_robtarg1;! Is this a copy?
current_robtarg1.trans.z:=current_robtarg1.trans.z + z; ! will this change Target_R11_10?
Whats the best way to do it?


Are there global variables between tasks?
Also, anyway to reference tools and workobjects without names?
Thanks so much









Comments

  • lemster68lemster68 United States ✭✭✭
    k_schmid said:
    I am trying to get rid of globals and typing names in my program.
    I want to change transforms of some targets

    CONST string targetnames{5}:=["Target_R11_10","Target_R11_40","Target_R11_30","Target_R11_20","Target_R11_50"];
    This needs to be PERS, you cannot write a value to a CONST.  Also, must be PERS in all tasks for tasks to access the values and change them.

    GetDataVal targetnames{1},current_robtarg1;! Is this a copy?
    You need to declare this.

    current_robtarg1.trans.z:=current_robtarg1.trans.z + z; ! will this change Target_R11_10?
    Whats the best way to do it?

    Target_R11_10.trans.z:=current_robtarg1.trans.z + z; ! will this change Target_R11_10?
    This will.

    Are there global variables between tasks?
    Also, anyway to reference tools and workobjects without names?
    I have to think about that some.

    Thanks so much










    Lee Justice
  • k_schmidk_schmid
    edited July 11
    Wait: CONST string targetnames are just names for lookup, the targets are PERS..., not writing to that array.
    GetDataVal targetnames{1},current_robtarg1;! Is this a copy?
    Is declared of course.

    So is GetDataVala making a copy of my target implicitly? How do i reference a target without making a copy if it is?


  • lemster68lemster68 United States ✭✭✭
    I see, my oversight about just target names.  No, it does not make a copy, per se, it writes the values from the target into the destination variable.
    Lee Justice
  • MickyMicky Germany ✭✭✭
    Hello, 
    GetDataVal copies the value of the data declaration into a variable.
    If you modify the copied data, you have to use SetDataVal to write the new value back into the named data declaration.

    /Br
    Micky
  • Ah thanks so much, I check that
Sign In or Register to comment.