RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
Loading...
Searching...
No Matches
rtabmap::Link Class Reference

Directed constraint between two nodes in RTAB-Map's pose graph. More...

#include <Link.h>

Public Types

enum  Type {
  kNeighbor , kGlobalClosure , kLocalSpaceClosure , kLocalTimeClosure ,
  kUserClosure , kVirtualClosure , kNeighborMerged , kPosePrior ,
  kLandmark , kGravity , kEnd , kSelfRefLink = 97 ,
  kAllWithLandmarks = 98 , kAllWithoutLandmarks = 99 , kUndef = 99
}
 Link category and filter sentinels. More...
 

Public Member Functions

 Link ()
 Default constructor; creates an invalid link (kUndef).
 
 Link (int from, int to, Type type, const Transform &transform, const cv::Mat &infMatrix=cv::Mat::eye(6, 6, CV_64FC1), const cv::Mat &userData=cv::Mat())
 Constructs a link between two nodes.
 
bool isValid () const
 
int from () const
 
int to () const
 
const Transformtransform () const
 
Type type () const
 
std::string typeName () const
 
const cv::Mat & infMatrix () const
 
double rotVariance (bool minimum=true) const
 Rotation variance derived from the information matrix diagonal (roll, pitch, yaw).
 
double transVariance (bool minimum=true) const
 Translation variance derived from the information matrix diagonal (x, y, z).
 
void setFrom (int from)
 
void setTo (int to)
 
void setTransform (const Transform &transform)
 
void setType (Type type)
 
void setInfMatrix (const cv::Mat &infMatrix)
 Sets the 6x6 information matrix (CV_64FC1); diagonal entries must be positive and finite.
 
const cv::Mat & userDataRaw () const
 
const cv::Mat & userDataCompressed () const
 
void uncompressUserData ()
 Decompresses user data into userDataRaw() if compressed data is stored.
 
cv::Mat uncompressUserDataConst () const
 
Link merge (const Link &link, Type outputType) const
 Chains this link (from → to) with link (to → link.to).
 
Link inverse () const
 

Static Public Member Functions

static std::string typeName (Type type)
 

Detailed Description

Directed constraint between two nodes in RTAB-Map's pose graph.

A link connects signature from() to signature to() with a relative Transform and an information matrix (inverse covariance) used by graph optimization. Links are stored on Signature objects and persisted in the database; they define odometry chains, loop closures, landmarks, and priors.

The transform is expressed from the from node frame to the to node frame (i.e. pose of to relative to from), unless type() indicates a special semantics (e.g. kPosePrior, kLandmark).

See also
Signature
Memory::addLink()

Definition at line 54 of file Link.h.

Member Enumeration Documentation

◆ Type

Link category and filter sentinels.

Values kSelfRefLink, kAllWithLandmarks, kAllWithoutLandmarks and kUndef are also used as query filters when retrieving links from memory or the database (they are not stored as link types on signatures).

Enumerator
kNeighbor 

Sequential odometry link between consecutive nodes.

kGlobalClosure 

Global loop closure added by global loop closure detection (i.e., using bags-of-words to find loop closures with other nodes in WM without using current estimated pose).

kLocalSpaceClosure 

Local loop closure added by proximity detection by space (i.e. using current estimated pose to find loop closures with nearby nodes in WM).

kLocalTimeClosure 

Local loop closure added by proximity detection by time (i.e. between nodes in STM).

kUserClosure 

User-defined loop closure constraint.

kVirtualClosure 

Virtual link added to keep the path linked to local map.

kNeighborMerged 

Merged neighbor link after graph reduction.

kPosePrior 

Absolute pose prior in the world frame (from == to).

kLandmark 

Observation of a landmark: from is the observer node, to is a negative landmark id.

kGravity 

Gravity direction constraint on the base frame (from == to).

kEnd 

Sentinel: number of link types that can be stored.

kSelfRefLink 

Filter: links where from == to (e.g. kPosePrior, kGravity).

kAllWithLandmarks 

Filter: all link types including kLandmark.

kAllWithoutLandmarks 

Filter: all link types except kLandmark.

kUndef 

Undefined type or invalid link.

Definition at line 64 of file Link.h.

Constructor & Destructor Documentation

◆ Link()

rtabmap::Link::Link ( int  from,
int  to,
Type  type,
const Transform transform,
const cv::Mat &  infMatrix = cv::Mat::eye(6, 6, CV_64FC1),
const cv::Mat &  userData = cv::Mat() 
)

Constructs a link between two nodes.

Parameters
fromSource signature id.
toTarget signature id (negative for landmarks when type is kLandmark).
typeLink category.
transformRelative transform from from to to.
infMatrix6x6 information matrix (inverse covariance)
userDataOptional payload; compressed automatically if not already CV_8UC1.

Member Function Documentation

◆ typeName() [1/2]

static std::string rtabmap::Link::typeName ( Type  type)
static
Returns
Human-readable name for type (e.g. "Neighbor", "GlobalClosure").

◆ isValid()

bool rtabmap::Link::isValid ( ) const
inline
Returns
True if ids, transform, and type are valid for use in the graph.

Definition at line 104 of file Link.h.

◆ from()

int rtabmap::Link::from ( ) const
inline
Returns
Source signature id.

Definition at line 107 of file Link.h.

◆ to()

int rtabmap::Link::to ( ) const
inline
Returns
Target signature id (negative for a landmark).

Definition at line 109 of file Link.h.

◆ transform()

const Transform & rtabmap::Link::transform ( ) const
inline
Returns
Relative transform, from the from() frame to the to() frame.

Definition at line 111 of file Link.h.

◆ type()

Type rtabmap::Link::type ( ) const
inline
Returns
Link category (see Type).

Definition at line 113 of file Link.h.

◆ typeName() [2/2]

std::string rtabmap::Link::typeName ( ) const
inline

Definition at line 114 of file Link.h.

◆ infMatrix()

const cv::Mat & rtabmap::Link::infMatrix ( ) const
inline

Definition at line 115 of file Link.h.

◆ rotVariance()

double rtabmap::Link::rotVariance ( bool  minimum = true) const

Rotation variance derived from the information matrix diagonal (roll, pitch, yaw).

Parameters
minimumIf true, returns the largest diagonal entry (most uncertain axis); if false, returns the smallest non-zero entry.

◆ transVariance()

double rtabmap::Link::transVariance ( bool  minimum = true) const

Translation variance derived from the information matrix diagonal (x, y, z).

Parameters
minimumIf true, returns the largest diagonal entry; if false, the smallest non-zero entry.

◆ setFrom()

void rtabmap::Link::setFrom ( int  from)
inline

Definition at line 129 of file Link.h.

◆ setTo()

void rtabmap::Link::setTo ( int  to)
inline

Definition at line 130 of file Link.h.

◆ setTransform()

void rtabmap::Link::setTransform ( const Transform transform)
inline

Definition at line 131 of file Link.h.

◆ setType()

void rtabmap::Link::setType ( Type  type)
inline

Definition at line 132 of file Link.h.

◆ userDataRaw()

const cv::Mat & rtabmap::Link::userDataRaw ( ) const
inline
Returns
Uncompressed user data, empty unless it was set raw or uncompressUserData() was called.

Definition at line 137 of file Link.h.

◆ userDataCompressed()

const cv::Mat & rtabmap::Link::userDataCompressed ( ) const
inline
Returns
User data as stored/persisted, in compressed form.

Definition at line 139 of file Link.h.

◆ uncompressUserDataConst()

cv::Mat rtabmap::Link::uncompressUserDataConst ( ) const
Returns
Uncompressed user data without modifying internal storage.

◆ merge()

Link rtabmap::Link::merge ( const Link link,
Type  outputType 
) const

Chains this link (from → to) with link (to → link.to).

Parameters
linkSecond link; must satisfy this->to() == link.from().
outputTypeType of the merged link.
Returns
Single link from from() to link.to() with transform (T_{ac} = T_{ab} T_{bc}) (or null if either input transform is null). Information matrix handling depends on outputType:
  • kNeighborMerged: (\Omega_{ac} = (\Omega_{ab}^{-1} + \Omega_{bc}^{-1})^{-1}) (covariances add when both legs are diagonal and independent).
  • Other types: keeps the full information matrix of link unless (\Omega_{ab}(0,0) < \Omega_{bc}(0,0)) (i.e. the smaller x information entry).

◆ inverse()

Link rtabmap::Link::inverse ( ) const
Returns
Link with swapped endpoints and inverted transform.

The documentation for this class was generated from the following file: