Template Class Localization

Class Documentation

template<typename TransformationType>
class Localization

Localization pipeline that creates frames, estimates pose, and maintains tracking state.

Consumes sensor data, matches current observations against local map data, computes camera pose, and orchestrates keyframe promotion.

Public Types

using LocalizationTyped = Localization<TransformationType>

Typed alias for the Localization class template.

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<LocalizationTyped>

Unique pointer alias for Localization.

using shared_ptr = std::shared_ptr<LocalizationTyped>

Shared pointer alias for Localization.

using weak_ptr = std::weak_ptr<LocalizationTyped>

Weak pointer alias for Localization.

Public Functions

~Localization()

Destructor of the Localization object.

void run(data_type::SensorData::weak_ptr data_)

This is the localization main function.

Note

Compute its pose in world coordinates using a local buffer. The created frame with the local buffer of frames will hold the most recent keyframes and decide with which to create keyframes.

Parameters:

data_ – Input sensor data for the current timestep.

inline pose_t get_camera_world_pose()

Getter for the current camera pose in world reference.

Returns:

Transformation from current frame to world frame.

inline bool is_lost() const

Function that can be used to tell if the localization module is lost or if it is still localization keypoints on the image.

Returns:

True if lost, false otherwise.

point2d_t::vector get_all_frame_keypoints()

Outputs all the latest keypoints detected in the current frame.

Returns:

All the keypoints detected in the current frame.

point2d_t::vector get_inlier_keypoints()

Retrieves the set of inlier keypoints obtained in pose estimation.

Returns:

Inlier keypoints from pose estimation.

Public Static Functions

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

Allocates a new object of type Localization.

Parameters:
  • map_Slam system map.

  • covisibilityGraph_Slam system covisibility graph.

Returns:

Unique pointer to the created Localization object.

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

Allocates a new object of type Localization.

Parameters:
  • map_Slam system map.

  • covisibilityGraph_Slam system covisibility graph.

Returns:

Shared pointer to the created Localization object.

Private Functions

Localization(const map::Map::shared_ptr map_, const CovisibilityPointer covisibilityGraph_)

Constructor for the Localization object.

Parameters:
  • map_ – SLAM system map.

  • covisibilityGraph_Slam system covisibility graph.

output_t<Frame::shared_ptr> __create_frame(data_type::SensorData::weak_ptr data_)

Creates a new Frame object from the input data.

Parameters:

data_ – Input sensor data.

Returns:

Output structure with the created frame or error info.

void __localize(const Frame::shared_ptr frame_)

Estimate world pose of current frame from local world-data buffer.

Parameters:

frame_ – Current frame.

bool __pose_estimation(const Frame::shared_ptr frame_, const WorldData &worldData_, std::vector<bool> &inliers_, match_t<index_t>::vector &matches_, const bool checkPoseLimits_)

Estimate frame pose from 2D-3D correspondences.

Parameters:
  • frame_ – Current frame.

  • worldData_ – Buffered world data used for matching.

  • inliers_ – Output inlier mask for selected correspondences.

  • matches_ – Output 2D-3D match list.

  • checkPoseLimits_ – Whether to enforce configured pose limits.

Returns:

true when pose estimation succeeds, otherwise false.

void __select_reference_keyframe(const Frame::shared_ptr frame_, const WorldData &worldData_, const std::vector<bool> &inliers_, const match_t<index_t>::vector &matches_)

Selects the reference keyframe for the current frame.

Parameters:
  • frame_ – Current frame.

  • worldData_ – Observations and IDs for map 3D points.

  • inliers_ – Inlier mask from pose estimation.

  • matches_ – 2D-3D matches from pose estimation.

Private Members

map::Map::shared_ptr _map

Map pointer (under development)

CovisibilityPointer _covisibilityGraph

Covisibility graph object.

pose_t _currentCameraWorldPose

Relative transformation from the current frame to the world frame.

LocalizationState _state

Tracking state.

FramesBufferTyped::unique_ptr _framesBuffer

Local visual odometry frames.