RobotStudio event

RapidData / RobTarget exception when reading

Options

I keep getting an exception that causes a crash in my app. Here is the exception:

ABB.Robotics.GenericControllerException:  Invalid client id.
   ved Adapters.Data.Get()
   ved ABB.Robotics.Controllers.RapidDomain.RapidData.get_Value()

Here is the code ( compacted a bit )

RapidData rd;
RobTarget rt;


rd = theController.Rapid.GetRapidData("TaskSystem","SysMain","robtargetCurrentPos");
rd.ValueChanged+=new EventHandler<DataValueChangedEventArgs>(rd_ValueChanged);
               
               
rt = (RobTarget)rd.Value;
log.Debug("initialization rtCurrent was:"+rt.ToString()); //CRASH HERE

Basically I wish to read a robtarget from a task that updates the robtarget variable.... So this should not require mastership...

Laro882010-02-10 17:07:33

Comments

  • Laro88
    Options
    It appears that the read code somehow violates the Mastership requirement, don't know why though.
    Here is some code that actually works without requiring mastership. Basically it only finds the RapidData and hooks up to its changed event.

    Hookup snippet:
    rd = theController.Rapid.GetRapidData("TaskX","ModuleY","robtargetZ");
                    rd.ValueChanged+=new EventHandler<DataValueChangedEventArgs>(rd_ValueChanged);
    //Note that RapidData rd is declared in class scope to avoid destruction by mem cleanup.

    Event reception snippet:
    void rd_ValueChanged(object sender, DataValueChangedEventArgs e)
            {
                RobTarget rtChanged = (RobTarget)rd.Value;
               
                Position p = new Position(rtChanged.Trans.X,
                                          rtChanged.Trans.Y, ...........