Template Class FramesBuffer

Class Documentation

template<typename TransformationType>
class FramesBuffer

Maintains temporal localization buffer and keyframe-promotion logic.

Stores recent frames and keyframe references, gathers world data from nearby keyframes, and decides when to create and submit new keyframes.

Public Types

using FramesBufferTyped = FramesBuffer<TransformationType>

Typed alias for the FramesBuffer class template.

using CovisibilityTyped = covisibility_graph::CovisibilityGraph<TransformationType>

Auxiliary typedefs for covisibility graph point definition.

using CovisibilityPointer = CovisibilityTyped::shared_ptr

Shared pointer alias for the covisibility graph.

using unique_ptr = std::unique_ptr<FramesBufferTyped>

Unique pointer alias for FramesBuffer.

Public Functions

inline FramesBuffer(const map::Map::shared_ptr map_, const CovisibilityPointer covisibilityGraph_)

Construct a new FramesBuffer object.

Parameters:
  • map_Slam system map.

  • covisibilityGraph_Slam system covisibility graph.

~FramesBuffer() = default

Destroys the FramesBuffer object.

inline bool frame_buffer_full() const

Check whether temporal frame buffer reached configured capacity.

Returns:

true when buffer size is at or above configured limit.

void query_3d_points(const pose_t &priorPose_)

Query map data near the provided prior pose into internal buffer.

Parameters:

priorPose_ – Prior camera pose used to query local map neighborhood.

inline bool is_empty() const

Check whether queried world-data buffer is empty.

Returns:

true if no world data is available, otherwise false.

inline const WorldData &get_world_data() const

Getter for world data in the buffer (3d points, descriptors, observations, point IDs).

Returns:

Const reference to buffered WorldData.

bool insert_new_frame(Frame::shared_ptr frame_, const LocalizationState state_, const bool forceKeyframeCreation_ = false)

Insert a frame and optionally create a new keyframe.

Parameters:
  • frame_ – Current frame instance.

  • state_ – Current localization state.

  • forceKeyframeCreation_ – Force keyframe creation for this frame.

Returns:

true when a new keyframe was created, otherwise false.

void reset_buffer()

Resets the buffer. Cleans all frames and other data.

inline keyframe_id_t::ordered get_keyframes_in_buffer() const

Getter for the IDs of all the keyframes in the VO buffer.

Returns:

Ordered set of keyframe IDs currently in the buffer.

inline bool check_tracking_state()

Checks if the localization is lost using the buffer.

Returns:

true if tracking still has support in the buffer.

Public Static Functions

static inline unique_ptr make_unique(const map::Map::shared_ptr map_, const CovisibilityPointer covisibilityGraph_)

Allocates a new object of type FramesBuffer.

Parameters:
  • map_Slam system map.

  • covisibilityGraph_Slam system covisibility graph.

Returns:

Unique pointer to created FramesBuffer object.

Private Functions

void __add_frame_to_buffer(const Frame::shared_ptr frame_)

Adds a new frame to the buffer. The buffer will own the frame.

Parameters:

frame_Frame to append to the temporal buffer.

bool __keyframe_creation_decision(Frame::shared_ptr &frame_, const bool force_ = false)

Decide whether a new keyframe should be created.

Parameters:
  • frame_ – Output frame chosen for keyframe creation when decision is positive.

  • force_ – Force keyframe creation if true.

Returns:

true if keyframe should be created, otherwise false.

bool __keyframe_creation(const Frame::shared_ptr frame_)

Create and submit a keyframe from the selected frame.

Parameters:

frame_Frame to upgrade to a keyframe.

Returns:

true if keyframe creation succeeded, otherwise false.

void __add_to_observable_keyframes(const frame_id_t frameToAddId_)

Add frame reference-keyframe contribution to observable counts.

Parameters:

frameToAddId_Frame ID whose reference keyframe will be counted.

void __remove_from_observable_keyframes(const frame_id_t frameToEraseId_)

Remove frame reference-keyframe contribution from observable counts.

Parameters:

frameToEraseId_Frame ID whose reference contribution will be removed.

void __fix_point3d_scale(const Frame::shared_ptr frame_, const keyframe_id_t newKeyframeId_)

Estimate scale correction for frame 3D points after keyframe creation.

Parameters:
  • frame_ – Current frame.

  • newKeyframeId_ – ID of keyframe created from current frame.

void __ensure_depth_map(const Frame::shared_ptr frame_)

Ensure frame has usable depth map data.

Parameters:

frame_Frame to validate or augment with depth.

Private Members

map::Map::shared_ptr _map

Pointer to the SLAM map object.

dictionary_t<frame_id_t, Frame::shared_ptr> _framesInBuffer

Local visual odometry frames.

keyframe_id_t::ordered _keyframesInBuffer

Ordered set with IDs of the keyframes in the VO buffer.

dictionary_t<keyframe_id_t, int> _observableKeyframes

Map with the counting of the number of times each keyframe in the buffer is a reference keyframe to the frames in the buffer.

WorldData _bufferData

3d points, descriptors, observations and point IDs in the buffer.

CovisibilityPointer _covisibilityGraph

Covisibility graph object.

mutable std::shared_mutex _mutex

Mutex for the buffer data.