5 Replies Latest reply on Mar 13, 2017 10:45 AM by Intel Corporation

    QueryPersonData() causes 'System.AccessViolationException' occurred in libpxcclr.cs.dll

    YanivSheffer

      Hi all,

       

      I'm trying to retrieve a personData from bodyTracking module using R200 camera.

      I have a while senseManager acquire frames loop and in it I'm using a personTrackingData ptd and querying it to get the Person instance:

       

      ...

      ...

      ...

      while (sm.AcquireFrame(true).IsSuccessful())

      {

           Thread.Sleep(1000);

       

           // ptm is a PXCMPersonTrackingModule instance

           PXCMPersonTrackingData ptd = ptm.QueryOutput();

          PXCMPersonTrackingData.Person p = ptd.QueryPersonData(PXCMPersonTrackingData.AccessOrderType.ACCESS_ORDER_BY_ID, 0);

       

           // Get the data

           tracker.numberOfPeople = ptd.QueryNumberOfPeople();

           tracker.trackingState = ptd.GetTrackingState();

           person.presonID = p.QueryTracking().QueryId();

           person.pointInfo = p.QueryTracking().QueryCenterMass().world;

           printData(person, tracker);

           // Resume next frame processing

           sm.ReleaseFrame();

      }

       

      // Clean up

      sm.Dispose();

      ...

      ...

      ...

       

      On the marked line I get an unhandled exception of type 'System.AccessViolationException' occurred in libpxcclr.cs.dll error.

      (Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.)

       

      I read a bit in this issue and saw that it could be caused by using 2 instances of SenseManagers running and using the same resources from 2 threads.

      I don't know what it's have to do with QueryPersonData() function I call.

       

      Anyone has an idea that can help me solve this problem?

       

      Yaniv