New Sensors
Hololink software provides tools necessary to control sensors connected to a Hololink
device. Supporting a new sensor is usually a matter of creating an object which has
methods for the device functions you need, then using those APIs in your application’s
operators. Let’s do this with an example MyCamera object, which has a register (0x100)
that we use to read the device version.
With this, we can create a simple program that reads this version register:
Following the call to hololink.start, the network control plane is available for
communication. Sensor objects should follow this pattern:
- A
configuremethod which uses the control plane to set up the data produced by the sensor. This method is called by the application code. - A
startmethod that the data receiver operator calls in its startup, which configures the sensor to begin producing data. - A
stopmethod, called when the data receiver is shut down, that stops the sensor data flow. - A
configure_convertermethod, which allows the sensor object to configure the next element in the application pipeline. This method is called by the application layer when the pipeline is being set up.
The configure_converter method allows the sensor to coordinate with the next layer of
the pipeline, where the raw data from the sensor is handled. For example, in a CSI-2
video application, the raw video data is framed by CSI-2 metadata and stored in an
encoded format (e.g. RAW10). Because the converter is a GPU accelerated process, it
likely has additional considerations that must be included when memory is allocated for
the received data (e.g. inclusion of GPU memory cache alignment). In our video
application, the sensor would know what the raw image dimensions would be, and the
converter can add to that the space necessary for CSI-2 framing data. Following that,
the converter object now knows how to best allocate memory for the network receiver.
The application layer, following the call to sensor.configure_converter, can now ask
the converter for help in allocating GPU memory. This memory is then passed to the
network receiver operator.
With the camera now configured to send traffic over the data plane, the application can
instantiate a RoceReceiverOp (or LinuxReceiverOperator) to receive data plane
traffic to the specific region of GPU memory. Finally, when application.run finishes
configuration, and calls our receiver operator’s start method, it will call
camera.start, which updates the camera to start sending video data.