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.

#pragma once

#include "../structs/frame_struct.hpp"

class IReader {

public:
  virtual ~IReader() {}

  virtual std::vector<std::shared_ptr<FrameStruct>> GetCurrentFrame() = 0;

  virtual std::vector<unsigned int> GetType() = 0;

  virtual bool HasNextFrame() = 0;

  virtual void NextFrame() = 0;

  virtual void Reset() = 0;

  virtual void GoToFrame(unsigned int frame_id) = 0;

  virtual unsigned int GetCurrentFrameId() = 0;

  virtual unsigned int GetFps() = 0;
};

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 updated