I try to write to a RobTarget object position which is existed, but it doesn’t work, as I run the program, the exception will be thrown. the exception is exactly what I catch in the below"Get value problem"
I try to modify the codes in the following, refering to RAB manual.But it still doesn’t work. The last line: It seems that I can’t deliver the aRobTarget back to rdp1.value, there always an error when executing"Get value problem". Who knows how to deal with it.
using (Mastership m = Mastership.Request(controller.Rapid))
{
RapidData rdp1 = this.controller.Rapid.GetRapidData(“T_ROB1”, “MainModule”, “p1”);
RobTarget aRobTarget;
IRapidData IRD;
if (rdp1 == null)
{
throw new Exception(“Could not find p1!”);
}
try
{
IRD = rdp1.Value;
aRobTarget = (RobTarget)IRD;
aRobTarget.Trans.X = aRobTarget.Trans.X + Convert.ToSingle(this.numericUpDownX.Value);
aRobTarget.Trans.Y = aRobTarget.Trans.Y + Convert.ToSingle(this.numericUpDownY.Value);
aRobTarget.Trans.Z = aRobTarget.Trans.Z + Convert.ToSingle(this.numericUpDownZ.Value);
rdp1.Value = aRobTarget;
}
catch (GeneralException ex)
{
throw new ApplicationException(“Get value problem”, ex);
}
rdp1.Dispose();
}