You’re reading an older version of the Slamcore SDK documenation. The latest one is 23.04.

File sensor_source_interface.hpp

Sensor sources.

Sensor source interfaces to feed data into SLAM

namespace slamcore

Main namespace for the Slamcore public API

Helper conversion methods

slamcore::ImageFormat \(\leftrightarrow\) BytesPerChannel

Get information about the client library

class SensorSourceInterface
#include <sensor_source_interface.hpp>

Customers wishing to feed sensor data to Slamcore SLAM must implement the following lifecycle interface together with one or more of the above sensor data interfaces.

Slamcore will call into the interfaces according to this lifecycle flowchart:

      +------------> open()
      |                |
      |                v
      |        registerCallback(...)
      |                |
      |                v
      |   +--------> start()
      |   |            |
      |   |           ... // implementer invokes data callbacks
      |   |            |
      |   |            v
      |   +--------- stop()
      |                |
      |                v
      |        registerCallback(nullptr) // deregister
      |                |
      |                v
      +------------- close()

Slamcore will invoke lifecycle methods SensorSourceInterface::open, SensorSourceInterface::close, SensorSourceInterface::start, SensorSourceInterface::stop, and <sensor interface at hand>::registerCallback from a single thread.

Public Functions

virtual ~SensorSourceInterface()
virtual std::string getSerial() const = 0

Returns the unique serial identifier associated with this sensor source.

Note

Must be one of the device(s) identifiers agreed upon with Slamcore in design phase.

virtual std::vector<SensorIDT> listSensors() const = 0

Lists all the sensors this source is able to provide.

virtual std::error_code open() = 0

Request to open the sensor source.

Slamcore might register data callbacks after calling this method.

Slamcore might call this method multiple times. Implementers can return slamcore::errc::device_already_open in that case.

virtual std::error_code close() = 0

Request to close the sensor source.

Slamcore will not register data callbacks after calling this method.

Slamcore might call this method multiple times. Implementers can return slamcore::errc::device_not_open in that case.

virtual std::error_code start() = 0

Request to start streaming data.

Slamcore will not register data callbacks after calling this method.

Implementers might start invoking registered data callbacks after Slamcore calls this method.

Slamcore might call this method multiple times. Implementers can return slamcore::errc::device_already_running in that case.

virtual std::error_code stop() = 0

Request to stop streaming data.

Slamcore might deregister data callbacks after calling this method.

Implementers must not invoke registered data callbacks after Slamcore calls this method.

Slamcore might call this method multiple times. Implementers can return slamcore::errc::device_not_running in that case.

virtual bool isOpen() const = 0

Returns true if the device is open.

virtual bool isRunning() const = 0

Returns true if the device is running.

This method must be re-entrant. Slamcore will call this method from within the registered data callbacks.