Items with no label
3335 Discussions

D435 Asynchrous capture : Programming issue

MAbdo2
New Contributor I
1,388 Views

I am trying to convert my (working) program from a synchronous-pipe-based approach to an asynchronous-callback appraoch.

I have reviewed the document in https://github.com/IntelRealSense/librealsense/blob/master/doc/rs400_support.md , and I am using to convert my program.

 

The snippet shown below illustrate my code. The line that starts with  " _Sensor.start" throws and exception.

 

1) Can anyone provide a "Hello world" application that simply perform asynchronous capture, or just correct my code below?

2) Also, it is not clear to me how the callback is defined and called. The document does not have adequate information

 

Thanks,

 

Mo

 

void ALV_IntelRealSenseRS2_Initialize()

{

 rs2::context context;

 

 auto devices = context.query_devices();

 // Get the 1st device

 auto RealSenseDevice = devices[0];

 std::vector<rs2::sensor> Sensors = RealSenseDevice.query_sensors();

 for (rs2::sensor Sensor : Sensors)

 {

  if (!strncmp("Stereo Module", Sensor.get_info(RS2_CAMERA_INFO_NAME), strlen("Stereo Module")))

  {

   printf("ALV_IntelRealsenseRS2 : ALV_IntelRealSenseRS2_Initialize : Found the Stereo Module Sensor\n");

   _Sensor = Sensor;

   break;

  }

 }

 _Sensor.start([](rs2::frame frame) {

  auto pixels = frame.get_data(); // pointer to frame data

 });

}​

0 Kudos
1 Solution
MartyG
Honored Contributor III
169 Views

The subject of asynchronous capture is discussed in the link below.

 

https://github.com/IntelRealSense/librealsense/issues/2647

View solution in original post

0 Kudos
1 Reply
MartyG
Honored Contributor III
170 Views

The subject of asynchronous capture is discussed in the link below.

 

https://github.com/IntelRealSense/librealsense/issues/2647

0 Kudos
Reply