RobotStudio event

Problem writing RobTarget

Options

When I try to write a RobTarget to the controller, I then get the following error: An argument specified by the client is not valid for this type of operation.

The data that I use, works fine by other rapid types, for example Pos or Orient.

Code:

string[] valName = { Controller.GetTaskName(), moduleName, name };

RobTarget data;

data = (RobTarget)Controller.GetRapid().GetRapidData(valName).Value ;

data.Trans.X = (float)x;

data.Trans.Y = (float)y;

data.Trans.Z = (float)z;

data.Rot.Q1 = (double)q1;

data.Rot.Q2 = (double)q2;

data.Rot.Q3 = (double)q3;

data.Rot.Q4 = (double)q4;

data.Robconf.Cf1 = (int)config1;

data.Robconf.Cf4 = (int)config4;

data.Robconf.Cf6 = (int)config6;

data.Robconf.Cfx = (int)configX;

System.Array arr = (System.Array)axis;

data.Extax.Eax_a = (float)arr.GetValue(0);

data.Extax.Eax_b = (float)arr.GetValue(1);

data.Extax.Eax_c = (float)arr.GetValue(2);

data.Extax.Eax_d = (float)arr.GetValue(3);

data.Extax.Eax_e = (float)arr.GetValue(4);

data.Extax.Eax_f = (float)arr.GetValue(5);

Controller.GetRapid().GetRapidData(valName).Value = data;

The error will occure at the last line of code.

 

Comments

  • ReneK
    Options

    Hi,

    is the robtarget defined as a variable or a constant in the RAPID code? As far as I know, you cannot write to a RAPID constant.

    BR

    Ren?

     

  • berrie
    Options

    Thnks Rene, that was the problem.