RobotStudio event

Addressing a single value in an array

Hello all,

I'm trying to retrieve each individual joint angle from a jointtarget data, which is off the form:
jpos:=[[-10, 80,-30, 20, 0, 0] , [9E+09,9E+09,9E+09,9E+09,9E+09,9E+09]];

How do I address these values to a variable? For instance I want to assign each of the joint angle data to different variables like;
q1=-10;
q2=80;
q3=-30;
q4=20;
q5=0;
q6=0.

Thank you,
Gianluigi



Comments

  • Hi Gianluigi,
    To retrieve the elements from the jointtarget is not hard at all.

    We know the structure of a jointtarget is of the form;

     

    < dataobject of jointtarget >

      < robax of robjoint >

          <rax_1 of num >

          <rax_2 of num >

          <rax_3 of num >

          <rax_4 of num >

          <rax_5 of num >

          <rax_6 of num >

      < extax of extjoint >



        < eax_a of num >

        < eax_b of num >
        < eax_c of num >
        < eax_d of num >
        < eax_e of num >
        < eax_f of num >
     

    Thus, to get the angles of robot axes from jPosCurrent...


     

    PERS jointtarget jPosCurrent; 

    PERS num J1;

    PERS num J2;

    PERS num J3;

    PERS num J4;

    PERS num J5;

    PERS num J6;


     

    J1:=jPosCurrent.robax.rax_1;
    J2:=jPosCurrent.robax.rax_2;

    J3:=jPosCurrent.robax.rax_3;

    J4:=jPosCurrent.robax.rax_4;

    J5:=jPosCurrent.robax.rax_5;

    J6:=jPosCurrent.robax.rax_6;

     

    Regards,

     

    BigM
  • Klaus
    Klaus ✭✭
    I remark.
     

    If you use PERS remember to initilise value in decleration

     

    PERS Num PERSNume := Value;

     

    BR Klaus
    Best Regards

    Klaus Soenderhegn
    www.cadalysator.dk

  • Well, it was like rocket science to me :P

    Thank you so much BigM and Klaus!
    gianluigi2009-05-13 17:06:44