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

File optimised_trajectory.hpp

Optimised Trajectory API subsystem.

Functions

void writeTrajectory(const slamcore::PoseListInterface<slamcore::camera_clock> &trajectory, const slamcore::TrackingStatusListInterface &trackingStatus, const std::string &filepath)

Write given trajectory to a file at filepath.

Parameters
  • trajectory – Poses to write.

  • trackingStatus – Tracking status to write.

  • filepath – Where to write the trajectory.

namespace slamcore

Main namespace for the Slamcore public API

Helper conversion methods

slamcore::ImageFormat \(\leftrightarrow\) BytesPerChannel

Get information about the client library

Functions

void writeTrajectory(const slamcore::PoseListInterface<slamcore::camera_clock> &trajectory, const slamcore::TrackingStatusListInterface &trackingStatus, const std::string &filepath)

Write given trajectory to a file at filepath.

Parameters
  • trajectory – Poses to write.

  • trackingStatus – Tracking status to write.

  • filepath – Where to write the trajectory.

class OptimisedTrajectorySubsystemInterface : public SubsystemInterface
#include <optimised_trajectory.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::OptimmisedTrajectorySubsystemInterface>();

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

// You can retrieve some data
const auto optimisedTrajectory = subsystem->getTrajectory();

Note

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

Note

Not thread safe.

Public Types

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

Public Functions

virtual ~OptimisedTrajectorySubsystemInterface() = 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>> getTrajectory() const = 0

Get Optimised Trajectory.

Note

For some positioning modes this can return nullptr

Protected Functions

virtual bool fetchImpl(const std::chrono::milliseconds timeout_ms) = 0
class TrajectoryHelper
#include <optimised_trajectory.hpp>

Client-side helper meant to help aggregate tracking statuses and poses into trajectories

It also helps write out trajectories to disk in a consistent and unified format

Note

The helper is not thread-safe

Public Types

using TrackingStatusList = std::vector<std::pair<TrackingStatus, camera_clock::time_point>>

Public Functions

~TrajectoryHelper()
TrajectoryHelper()
void feed(ConstTaggedObject obj)

Either pass every single object through the helper or at the very least poses, metadata and frame syncs.

Parameters

obj[in] object as returned from polling or callback SLAM

const PoseListInterface<camera_clock> &getUnoptimisedTrajectory() const
Returns

list of poses accumulated so far

const TrackingStatusList &getTrackingStatus() const

These are augmented with timestamps from the pose stream.

Returns

list of tracking statuses accumulated so far.

std::error_code writeTrajectories(const std::string &directory, const PoseListInterface<camera_clock> *optimisedTrajectory = nullptr, std::ostream *stream = nullptr) const
Parameters
  • directory[in] path to directory where the trajectories should be written. The directory needs to exist.

  • optimisedTrajectory[in] Optional pointer to optimised can be passed in from the OptimisedTrajectorySubsystem

  • stream[in] Optional pointer to std::ostream for verbose output

Returns

error_code indicating success

Private Members

std::unique_ptr<Impl> m_impl