IReaders
IReader's job is to be able to load data from a frame source into a FrameStruct for each frame type in the frame source
IReaders interface with the frame source and create FrameStructs.
Based on the config yaml the Sensor Stream Server will create an IReader to pull data and create FrameStructs.
If you want to add a new sensor interface, you will need to make an implementation of the IReader interface that can pull data from the hardware and create a FrameStruct.

​IReader Interface​

1
#pragma once
2
​
3
#include "../structs/frame_struct.hpp"
4
​
5
class IReader {
6
​
7
public:
8
virtual ~IReader() {}
9
​
10
virtual std::vector<std::shared_ptr<FrameStruct>> GetCurrentFrame() = 0;
11
​
12
virtual std::vector<unsigned int> GetType() = 0;
13
​
14
virtual bool HasNextFrame() = 0;
15
​
16
virtual void NextFrame() = 0;
17
​
18
virtual void Reset() = 0;
19
​
20
virtual void GoToFrame(unsigned int frame_id) = 0;
21
​
22
virtual unsigned int GetCurrentFrameId() = 0;
23
​
24
virtual unsigned int GetFps() = 0;
25
};
Copied!

How IReader is interacted with by Sensor Stream Server

  • Sensor Stream Server is what uses the IReader
  • When Sensor Stream Server is started it reads the config.yaml to understand reader_type
    • frames
      • which can then be MultiImageReader or ImageReader based on the parameter "path"
    • video
    • kinect
      • takes in parameters to build new ExtendedAzureConfig
    • iphone
  • It then creates an IReader using the parameters
  • It then asks for "GetType()" which the IReader will respond with and array of types
    • 0 - color
    • 1- depth
    • 2 - ir
    • 3 - confidence (iphone)
    • IReader knows how to respond based on the parameters it was passed when built
  • That will create IEncoders for each type
  • It then asks for "GetFps()"
    • IReader knows how to respond based on the parameters it was passed when built
  • It then calls "GetCurrentFrame()" which gets provides a frame struct
    • This is then encoded by the associated encoders
  • It then calls HasNextFrame() and then NextFrame(), otherwise it calls Reset()

Available IReader Implementations

Last modified 6mo ago