File slam_system_callback.hpp

Main SLAM API class, integrating everything.

namespace slamcore

Helper conversion methods

slamcore::ImageFormat \(\leftrightarrow\) BytesPerChannel

Get information about the client library

class SLAMSystemCallbackInterface : public SLAMSystemInterface
#include <slam_system_callback.hpp>

Main object for creating, executing and interacting with the SLAM procedure. Use it as a standard device (open \(\rightarrow\) start streaming \(\rightarrow\) grab data \(\rightarrow\) close).

A standard way of getting SLAM up ‘n running would be the following. To simplify the procedure, error handling is not shown, see hello_world_all_streams.cpp for a minimal working example of this:

// Initialise the library

// Create a system configuration
v0::SystemConfiguration cfg;

// create a SLAM System
slamcore::SLAMSystemCallbackInterface::Ptr slam = slamcore::createSLAMSystem(cfg);

// register any callbacks
 [](const slamcore::PoseInterface<slamcore::camera_clock>::CPtr& pose)
   // do something with the pose!
// ...


// enable the streams you need
slam->setStreamEnabled(slamcore::Stream::Pose, true);
// ...


// poll for data

// cleanup SLAM

// clean up the library

See also


Public Functions

virtual ~SLAMSystemCallbackInterface() = default
template<Stream stream>
inline void registerCallback(const std::function<void(const std::shared_ptr<const StreamType_t<stream>>&)> &fn)

Register a callback.

   Can register one callback per stream, repeated calls with the same stream will overwrite
   the previously registered callback.

If the callback is empty then any registered callback on that stream will be removed.

Template Parameters

stream – The stream to register the callback on


fn – The function to register, must have the signature void(const std::shared_ptr<const InterfaceT>&) where InterfaceT is the corresponding type to the stream.

template<typename Rep, typename Period>
inline bool spin(std::chrono::duration<Rep, Period> timeout)

Spin waiting for next frame and invoke the corresponding registered callbacks (in the current thread)



  • positive - Wait for the next frame up to the given duration

  • zero - Wait indefinitely for the next frame

  • negative - Try to invoke registered callbacks if the next frame is available, otherwise return immediately.


true The next frame was available


false No new frame available

inline bool spin()

Helper function to spin indefinitely.

Protected Functions

virtual void registerCallbackImpl(Stream, const std::function<void(const ConstTaggedObject&)>&) = 0
virtual bool spinImpl(std::chrono::nanoseconds timeout) = 0

Private Types

template<Stream stream>
using StreamType_t = typename StreamType<stream>::type