Sunday, December 29, 2019

Getting camera pose data from the Intel RealSense T265 in LabView using the .NET wrapper

The c++ dll uses a class called pipline to manage the streaming data from the RealSense T265.  After struggling with the instantiation of the c++ class, I decided to to use the c# wrapper.
LabView isn't perfect at handling .NET dll's, but the .NET wrapper of the realsense2.dll works.

First off, you have to create two constructor nodes.  They instantiate the classes pipeline and config.  Pipeline controls the stream of data, and config defines the type of data stream.  When connecting to the T265, the stream type in a 6 Degree Of Freedom (6DOF).

Once created, a while loop needs to execute to read the pose data frames.  The frames contain the camera's translation and rotation/orientation quaternion relative to the location and rotation when the pipeline was started.  Every time the pipeline starts the translation is reset back to 0,0,0 (x,y,z), and the quaternion is 1,0,0,0 (w,x,y,z or  w+xi+yj+zk ).

Inside the loop, the pipeline method WaitForFrames returns a FrameSet from the frame queue.
The frameSet contains the PoseFrame property.
The PoseFrame contains a PoseData property.
The PoseData contains the Translation, Rotation properties, as well as others.
Inside the while loop the pose frame and frameSet must be disposed.  If not, the frame queue will be full in only 16 frames.   

Block diagram of  realsense .net wrapper as used with the T265.

Front panel


The core c++ code that is called by the .net wrapper is below:



edit 20200302
Look at this post for more info on using the quaternions:
https://lowtechllcblog.blogspot.com/2020/02/intel-realsense-t265-quaternion.html

No comments:

Post a Comment