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

File subsystems.hpp

Core API subsystems.

Includes the majority of the subsystems that are used when using the SLAMcore API. Along with their definition, we define load_minimal, save_minimal helper functions as well as the operator<< for storing/dumping their types.

Note

Notice that the majority of the classes are suffixed with *Interface. That’s because when you get access to the corresponding instance, you do via a pointer type (namely std::shared_ptr or the class member aliases Ptr, CPtr) and not through the actual class instance.

Helper functions for slamcore::SubsystemType

template<class Archive>
static inline void load_minimal(const Archive&, SubsystemType &obj, const std::string &value)
template<class Archive>
static inline std::string save_minimal(const Archive&, const SubsystemType &obj)
static inline std::ostream &operator<<(std::ostream &os, const SubsystemType obj)

Enums

enum class SubsystemType : EnumBaseT

Subsystem types. For every one of these enum cases there is a corresponding <enum-name>Interface class.

Values:

enumerator CameraSensorsInfo
enumerator MobileRobot
enumerator HeightMapping
enumerator Trajectory
enumerator Count
namespace slamcore

Main namespace for the SLAMcore public API

Get information about the client library

Helper functions for slamcore::SubsystemType

template<class Archive>
static inline void load_minimal(const Archive&, SubsystemType &obj, const std::string &value)
template<class Archive>
static inline std::string save_minimal(const Archive&, const SubsystemType &obj)
static inline std::ostream &operator<<(std::ostream &os, const SubsystemType obj)

Helper conversion methods

slamcore::ImageFormat \(\leftrightarrow\) BytesPerPixel

Enums

enum class SubsystemType : EnumBaseT

Subsystem types. For every one of these enum cases there is a corresponding <enum-name>Interface class.

Values:

enumerator CameraSensorsInfo
enumerator MobileRobot
enumerator HeightMapping
enumerator Trajectory
enumerator Count
class CameraSensorsInfoInterface : public SubsystemInterface
#include <subsystems.hpp>

Subsystem to access factory camera calibration.

Public Types

using Ptr = std::shared_ptr<CameraSensorsInfoInterface>
using CPtr = std::shared_ptr<const CameraSensorsInfoInterface>

Public Functions

inline virtual SubsystemType type() const

Type of the object.

virtual ~CameraSensorsInfoInterface() = default
virtual std::vector<SensorIDT> getCameraList() const = 0

Return the IDs for camera sensors in the system.

virtual Vector getCameraSensorSize(const SensorIDT sid) const = 0

Get camera sensor image dimensions.

virtual ImageFormat getCameraImageFormat(const SensorIDT sid) const = 0

Get camera sensor image format.

virtual Vector getCameraFactoryFocalLength(const SensorIDT sid) const = 0

Get camera sensor focal length (factory).

virtual Vector getCameraFactoryPrincipalPoint(const SensorIDT sid) const = 0

Get camera sensor principal point (factory).

virtual std::string getCameraFactoryDistortionModel(const SensorIDT sid) const = 0

Get camera sensor distortion model (factory).

virtual Vector getCameraFactoryDistortionParams(const SensorIDT sid) const = 0

Get camera sensor distortion coefficients (factory).

virtual Matrix getCameraFactoryTSC(const SensorIDT sid) const = 0

Get camera sensor to IMU transformation (factory).

Public Static Attributes

static constexpr SubsystemType Type = SubsystemType::CameraSensorsInfo
class HeightMappingSubsystemInterface : public SubsystemInterface
#include <subsystems.hpp>

Subsystem for accessing height maps.

Public Types

using Ptr = std::shared_ptr<HeightMappingSubsystemInterface>
using CPtr = std::shared_ptr<const HeightMappingSubsystemInterface>

Public Functions

inline virtual SubsystemType type() const

Type of the object.

virtual ~HeightMappingSubsystemInterface() = default
template<typename _Rep = int64_t, typename _Period = std::ratio<1>>
inline bool fetch(const std::chrono::duration<_Rep, _Period> &timeout = std::chrono::seconds(0))

Update the internal state with the most recent data.

virtual std::shared_ptr<const Map2DInterface> get() const = 0

Get the map data.

Public Static Attributes

static constexpr SubsystemType Type = SubsystemType::HeightMapping

Protected Functions

virtual bool fetchImpl(const std::chrono::milliseconds timeout_ms) = 0
class MobileRobotSubsystemInterface : public SubsystemInterface
#include <subsystems.hpp>

Subsystem for feeding mobile robots wheel odometry.

Public Types

using Ptr = std::shared_ptr<MobileRobotSubsystemInterface>
using CPtr = std::shared_ptr<const MobileRobotSubsystemInterface>

Public Functions

inline virtual SubsystemType type() const

Type of the object.

virtual ~MobileRobotSubsystemInterface() = default
virtual std::error_code feedOdometry(const PoseInterface<odometry_clock>::CPtr wo) = 0

Feed wheel odometry from an external source.

Public Static Attributes

static constexpr SubsystemType Type = SubsystemType::MobileRobot
class SubsystemInterface
#include <subsystems.hpp>

Common interface for all the objects - enables runtime polymorphism.

Subclassed by CameraSensorsInfoInterface, HeightMappingSubsystemInterface, MobileRobotSubsystemInterface, TrajectorySubsystemInterface

Public Types

using Ptr = std::shared_ptr<SubsystemInterface>
using CPtr = std::shared_ptr<const SubsystemInterface>

Public Functions

virtual ~SubsystemInterface() = default
inline virtual SubsystemType type() const

Type of the object.

Protected Functions

inline SubsystemInterface()
class TrajectorySubsystemInterface : public SubsystemInterface
#include <subsystems.hpp>

Subsystem for accessing trajectories.

A common way of using this subsystem would be as follows:

// Get subsystem from the SLAM system
const auto subsystem = slam->getSubsystem<slamcore::TrajectorySubsystemInterface>();

// Fetch most recent trajectories
subsystem->fetch();

// You can retrieve some data
const auto unoptimisedTrajectory = subsystem->getUnoptimisedTrajectory();
const auto optimisedTrajectory = subsystem->getOptimisedTrajectory();
const auto trackingStatus = subsystem->getTrackingStatus();

// Or you can write the trajectories as csv files to an output directory
subsystem->write("trajectories");

Note

There are some positioning modes where the optimised trajectory is not produced. In these cases, getOptimisedTrajectory will return nullptr.

Note

Not thread safe.

Public Types

using Ptr = std::shared_ptr<TrajectorySubsystemInterface>
using CPtr = std::shared_ptr<const TrajectorySubsystemInterface>

Public Functions

inline virtual SubsystemType type() const

Type of the object.

virtual ~TrajectorySubsystemInterface() = default
template<typename _Rep = int64_t, typename _Period = std::ratio<1>>
inline bool fetch(const std::chrono::duration<_Rep, _Period> &timeout = std::chrono::seconds(0))

Update the internal state with the most recent data.

virtual std::shared_ptr<const PoseListInterface<camera_clock>> getUnoptimisedTrajectory() const = 0

Get Unoptimised Trajectory.

virtual std::shared_ptr<const TrackingStatusListInterface> getTrackingStatus() const = 0

Get Tracking Status.

virtual std::shared_ptr<const PoseListInterface<camera_clock>> getOptimisedTrajectory() const = 0

Get Optimised Trajectory.

Note

For some positioning modes this can return nullptr

virtual TrajectoryPaths write(const std::string &outputDirectory) const = 0

Write trajectories as csv files in given output directory.

Public Static Attributes

static constexpr SubsystemType Type = SubsystemType::Trajectory

Protected Functions

virtual bool fetchImpl(const std::chrono::milliseconds timeout_ms) = 0
struct TrajectoryPaths
#include <subsystems.hpp>

Public Members

std::string UnoptimisedTrajectory
std::string OptimisedTrajectory