|
RTAB-Map 0.23.10
Real-Time Appearance-Based Mapping
|
Represents a node in RTAB-Map's pose graph. More...
#include <Signature.h>
Public Member Functions | |
| Signature () | |
| Default constructor. | |
| Signature (int id, int mapId=-1, int weight=0, double stamp=0.0, const std::string &label=std::string(), const Transform &pose=Transform(), const Transform &groundTruthPose=Transform(), const SensorData &sensorData=SensorData()) | |
| Constructor with explicit parameters. | |
| Signature (const SensorData &data) | |
| Constructor from sensor data. | |
| virtual | ~Signature () |
| Virtual destructor. | |
| float | compareTo (const Signature &signature) const |
| Compares this signature to another signature. | |
| bool | isBadSignature () const |
| Checks if this signature is considered "bad". | |
| int | id () const |
| Returns the signature ID. | |
| int | mapId () const |
| Returns the map ID. | |
| void | setWeight (int weight) |
| Sets the weight/importance of this signature. | |
| int | getWeight () const |
| Returns the weight/importance of this signature. | |
| void | setLabel (const std::string &label) |
| Sets a label/name for this signature. | |
| const std::string & | getLabel () const |
| Returns the label/name of this signature. | |
| double | getStamp () const |
| Returns the timestamp of this signature. | |
| void | addLinks (const std::list< Link > &links) |
| Adds multiple links from a list. | |
| void | addLinks (const std::map< int, Link > &links) |
| Adds multiple links from a map. | |
| void | addLink (const Link &link) |
| Adds a single link to this signature. | |
| bool | hasLink (int idTo, Link::Type type=Link::kUndef) const |
| Checks if this signature has a link to a target signature. | |
| void | changeLinkIds (int idFrom, int idTo) |
| Changes all link target IDs from one value to another. | |
| void | removeLinks (bool keepSelfReferringLinks=false) |
| Removes all links from this signature. | |
| void | removeLink (int idTo) |
| Removes a specific link to a target signature. | |
| void | removeVirtualLinks () |
| Removes all virtual links from this signature. | |
| void | addLandmark (const Link &landmark) |
| Adds a landmark observation to this signature. | |
| const std::map< int, Link > & | getLandmarks () const |
| Returns all landmark observations. | |
| void | removeLandmarks () |
| Removes all landmark observations. | |
| void | removeLandmark (int landmarkId) |
| Removes a specific landmark observation. | |
| void | setSaved (bool saved) |
| Sets whether this signature has been saved to the database. | |
| void | setModified (bool modified) |
| Sets the modification flag for this signature. | |
| const std::multimap< int, Link > & | getLinks () const |
| Returns all links from this signature. | |
| bool | isSaved () const |
| Checks if this signature has been saved to the database. | |
| bool | isModified () const |
| Checks if this signature has been modified. | |
| bool | isLinksModified () const |
| Checks if the links have been modified. | |
| void | removeAllWords () |
| Removes all visual words from this signature. | |
| void | changeWordsRef (int oldWordId, int activeWordId) |
| Changes visual word references from one word ID to another. | |
| void | setWords (const std::multimap< int, int > &words, const std::vector< cv::KeyPoint > &keypoints, const std::vector< cv::Point3f > &words3, const cv::Mat &descriptors) |
| Sets all visual words for this signature. | |
| bool | isEnabled () const |
| Checks if this signature is enabled. | |
| void | setEnabled (bool enabled) |
| Sets whether this signature is enabled. | |
| const std::multimap< int, int > & | getWords () const |
| Returns the visual words map. | |
| const std::vector< cv::KeyPoint > & | getWordsKpts () const |
| Returns the keypoints associated with visual words. | |
| int | getInvalidWordsCount () const |
| Returns the count of invalid visual words. | |
| const std::map< int, int > & | getWordsChanged () const |
| Returns the word ID change mapping. | |
| const cv::Mat & | getWordsDescriptors () const |
| Returns the feature descriptors for visual words. | |
| void | setWordsDescriptors (const cv::Mat &descriptors) |
| Sets the feature descriptors for visual words. | |
| void | setPose (const Transform &pose) |
| Sets the pose of this signature. | |
| void | setGroundTruthPose (const Transform &pose) |
| Sets the ground truth pose for evaluation. | |
| void | setVelocity (float vx, float vy, float vz, float vroll, float vpitch, float vyaw) |
| Sets the velocity of this signature. | |
| const std::vector< cv::Point3f > & | getWords3 () const |
| Returns the 3D points of visual words. | |
| const Transform & | getPose () const |
| Returns the pose of this signature. | |
| cv::Mat | getPoseCovariance () const |
| Gets the pose covariance matrix. | |
| const Transform & | getGroundTruthPose () const |
| Returns the ground truth pose. | |
| const std::vector< float > & | getVelocity () const |
| Returns the velocity of this signature. | |
| SensorData & | sensorData () |
| Returns mutable access to the sensor data. | |
| const SensorData & | sensorData () const |
| Returns const access to the sensor data. | |
| unsigned long | getMemoryUsed (bool withSensorData=true) const |
| Computes the memory usage of this signature. | |
Represents a node in RTAB-Map's pose graph.
The Signature class is a fundamental building block of RTAB-Map's graph-based mapping system. Each signature represents a unique location or pose in the map and contains:
Signatures are used for:
The class tracks modification state to optimize database updates, and provides methods to manage visual words, links, landmarks, and pose information.
Definition at line 83 of file Signature.h.
| rtabmap::Signature::Signature | ( | ) |
Default constructor.
Creates an empty signature with invalid ID (0), default map ID (-1), and all fields initialized to default values.
| rtabmap::Signature::Signature | ( | int | id, |
| int | mapId = -1, |
||
| int | weight = 0, |
||
| double | stamp = 0.0, |
||
| const std::string & | label = std::string(), |
||
| const Transform & | pose = Transform(), |
||
| const Transform & | groundTruthPose = Transform(), |
||
| const SensorData & | sensorData = SensorData() |
||
| ) |
Constructor with explicit parameters.
Creates a signature with the specified parameters. The sensor data ID will be automatically set to match the signature ID if not already set.
| id | Unique signature ID (must be > 0 for valid signature) |
| mapId | Map ID this signature belongs to (default: -1 for no map) |
| weight | Weight/importance of this signature (default: 0) |
| stamp | Timestamp in seconds (default: 0.0) |
| label | Optional label/name for this signature (default: empty) |
| pose | Current pose of the signature (default: identity null transform) |
| groundTruthPose | Ground truth pose for evaluation (default: null transform) |
| sensorData | Sensor data captured at this location (default: empty) |
| rtabmap::Signature::Signature | ( | const SensorData & | data | ) |
Constructor from sensor data.
Creates a signature from sensor data. The signature ID is taken from the sensor data ID, and the ground truth pose is extracted from the sensor data if available.
| data | Sensor data to create signature from |
| float rtabmap::Signature::compareTo | ( | const Signature & | signature | ) | const |
Compares this signature to another signature.
Computes a similarity score between this signature and another signature based on their visual words. The comparison uses bag-of-words matching to determine how similar the two locations are.
| signature | The signature to compare against |
| bool rtabmap::Signature::isBadSignature | ( | ) | const |
Checks if this signature is considered "bad".
A signature is considered bad if it has no valid visual words (all words are invalid or the signature has no words at all). Bad signatures cannot be used for place recognition.
|
inline |
Returns the signature ID.
Definition at line 168 of file Signature.h.
|
inline |
Returns the map ID.
Definition at line 174 of file Signature.h.
|
inline |
Sets the weight/importance of this signature.
The weight represents the importance or priority of this signature, typically set by Rehearsal mechanism (see Memory::rehearsal). Higher weights may be used to prioritize certain signatures during memory management or loop closure detection.
| weight | The weight value |
Definition at line 189 of file Signature.h.
|
inline |
Returns the weight/importance of this signature.
Definition at line 195 of file Signature.h.
|
inline |
Sets a label/name for this signature.
Labels are optional text identifiers that can be used to tag or categorize signatures (e.g., "room1", "corridor", "entrance").
| label | The label string |
Definition at line 208 of file Signature.h.
|
inline |
Returns the label/name of this signature.
Definition at line 214 of file Signature.h.
|
inline |
Returns the timestamp of this signature.
Definition at line 220 of file Signature.h.
| void rtabmap::Signature::addLinks | ( | const std::list< Link > & | links | ) |
Adds multiple links from a list.
Adds all links from the provided list to this signature's link collection.
| links | List of links to add |
from() equal to this signature's ID. | void rtabmap::Signature::addLinks | ( | const std::map< int, Link > & | links | ) |
Adds multiple links from a map.
Adds all links from the provided map to this signature's link collection.
| links | Map of target IDs to links |
from() equal to this signature's ID. to() values of the links). | void rtabmap::Signature::addLink | ( | const Link & | link | ) |
Adds a single link to this signature.
Adds a link connecting this signature to another signature. The link represents a constraint in the pose graph (e.g., neighbor, loop closure).
| link | The link to add |
from() must equal this signature's ID. to() must be different from this signature's ID (except for self-referring links like pose priors or gravity). | bool rtabmap::Signature::hasLink | ( | int | idTo, |
| Link::Type | type = Link::kUndef |
||
| ) | const |
Checks if this signature has a link to a target signature.
| idTo | Target signature ID (0 to check for any link of the specified type) |
| type | Link type to check for (default: Link::kUndef to check any type) |
| void rtabmap::Signature::changeLinkIds | ( | int | idFrom, |
| int | idTo | ||
| ) |
Changes all link target IDs from one value to another.
Updates all links that point to idFrom to point to idTo instead. This is useful when merging or reorganizing the graph.
| idFrom | Original target ID |
| idTo | New target ID |
| void rtabmap::Signature::removeLinks | ( | bool | keepSelfReferringLinks = false | ) |
Removes all links from this signature.
| keepSelfReferringLinks | If true, preserves self-referring links (pose priors, gravity) that have from() == to() |
| void rtabmap::Signature::removeLink | ( | int | idTo | ) |
Removes a specific link to a target signature.
| idTo | Target signature ID of the link to remove |
| void rtabmap::Signature::removeVirtualLinks | ( | ) |
Removes all virtual links from this signature.
Virtual links are links of type Link::kVirtualClosure.
| void rtabmap::Signature::addLandmark | ( | const Link & | landmark | ) |
Adds a landmark observation to this signature.
Landmarks are persistent features in the environment that can be observed from multiple locations. This method adds a link representing the observation of a landmark from this signature's location.
| landmark | Link representing the landmark observation |
|
inline |
Returns all landmark observations.
Definition at line 332 of file Signature.h.
| void rtabmap::Signature::removeLandmark | ( | int | landmarkId | ) |
Removes a specific landmark observation.
| landmarkId | The landmark ID to remove |
|
inline |
Sets whether this signature has been saved to the database.
| saved | True if saved, false otherwise |
Definition at line 349 of file Signature.h.
|
inline |
Sets the modification flag for this signature.
Marks the signature as modified (or unmodified). When set to true, also marks links as modified.
| modified | True if modified, false otherwise |
Definition at line 359 of file Signature.h.
|
inline |
Returns all links from this signature.
Definition at line 365 of file Signature.h.
|
inline |
Checks if this signature has been saved to the database.
Definition at line 371 of file Signature.h.
|
inline |
Checks if this signature has been modified.
Returns true if either the signature data or links have been modified.
Definition at line 380 of file Signature.h.
|
inline |
Checks if the links have been modified.
Definition at line 386 of file Signature.h.
| void rtabmap::Signature::removeAllWords | ( | ) |
Removes all visual words from this signature.
Clears all visual words, keypoints, 3D points, and descriptors. The signature will be disabled after this operation.
| void rtabmap::Signature::changeWordsRef | ( | int | oldWordId, |
| int | activeWordId | ||
| ) |
Changes visual word references from one word ID to another.
Updates all occurrences of oldWordId to activeWordId in the visual words. This is used when words are merged or reorganized in the dictionary.
| oldWordId | The original word ID to replace |
| activeWordId | The new word ID to use |
_wordsChanged for reference. | void rtabmap::Signature::setWords | ( | const std::multimap< int, int > & | words, |
| const std::vector< cv::KeyPoint > & | keypoints, | ||
| const std::vector< cv::Point3f > & | words3, | ||
| const cv::Mat & | descriptors | ||
| ) |
Sets all visual words for this signature.
Sets the complete visual word representation including word IDs, keypoints, 3D points, and descriptors. All arrays must have matching sizes.
| words | Multimap of word IDs to keypoint indices (allows duplicate words). The keypoint indices match the keypoints, points and descriptors. |
| keypoints | Vector of 2D keypoints in image coordinates. The keypoints must be in the same order as the words. |
| words3 | Vector of 3D points in base_link frame (with localTransform applied). The points must be in the same order as the words. |
| descriptors | Feature descriptors matrix (one row per word). The descriptors must be in the same order as the words. |
_invalidWordsCount.
|
inline |
Checks if this signature is enabled.
Enabled signatures can be used for place recognition and loop closure detection. More explicitly, it means that the signature is registered to the VWDictionary (see Memory::enableWordsRef).
Definition at line 436 of file Signature.h.
|
inline |
Sets whether this signature is enabled.
| enabled | True to enable, false to disable |
Definition at line 442 of file Signature.h.
|
inline |
Returns the visual words map.
Returns a multimap of word IDs to keypoint indices. The multimap allows duplicate word IDs (a word can appear multiple times in the signature).
Definition at line 452 of file Signature.h.
|
inline |
Returns the keypoints associated with visual words.
Definition at line 458 of file Signature.h.
|
inline |
Returns the count of invalid visual words.
Invalid words are those with ID <= 0. These words cannot be used for place recognition. However, they are still used for transform estimation after loop closures are detected with the valid words.
Definition at line 469 of file Signature.h.
|
inline |
Returns the word ID change mapping.
Returns a map of old word IDs to new word IDs, tracking changes made through changeWordsRef().
Definition at line 479 of file Signature.h.
|
inline |
Returns the feature descriptors for visual words.
Definition at line 485 of file Signature.h.
| void rtabmap::Signature::setWordsDescriptors | ( | const cv::Mat & | descriptors | ) |
Sets the feature descriptors for visual words.
Updates the descriptors matrix. The number of rows must match the number of visual words.
| descriptors | Descriptors matrix (one row per word) |
|
inline |
Sets the pose of this signature.
The pose represents the position and orientation of this signature in the odometry coordinate frame. To get the pose in map coordinate frame, use the map correction transform computed by graph optimization and apply it to this pose.
| pose | The transform representing the pose in the odometry coordinate frame. |
Definition at line 519 of file Signature.h.
|
inline |
Sets the ground truth pose for evaluation.
Ground truth poses are used for evaluating localization accuracy and comparing against the estimated pose.
| pose | The ground truth transform |
Definition at line 529 of file Signature.h.
|
inline |
Sets the velocity of this signature.
Sets the 6DOF velocity (linear and angular) at the time this signature was captured.
| vx | Linear velocity in x direction (m/s) |
| vy | Linear velocity in y direction (m/s) |
| vz | Linear velocity in z direction (m/s) |
| vroll | Angular velocity around x axis (rad/s) |
| vpitch | Angular velocity around y axis (rad/s) |
| vyaw | Angular velocity around z axis (rad/s) |
Definition at line 544 of file Signature.h.
|
inline |
Returns the 3D points of visual words.
Returns the 3D coordinates of visual words in the base_link frame (with localTransform applied).
Definition at line 562 of file Signature.h.
|
inline |
Returns the pose of this signature.
Definition at line 569 of file Signature.h.
| cv::Mat rtabmap::Signature::getPoseCovariance | ( | ) | const |
Gets the pose covariance matrix.
Gets the covariance matrix representing the uncertainty between the current pose and the previous pose (e.g, from the odometry link with the previous signature).
|
inline |
Returns the ground truth pose.
Definition at line 585 of file Signature.h.
|
inline |
Returns the velocity of this signature.
Definition at line 591 of file Signature.h.
|
inline |
Returns mutable access to the sensor data.
Definition at line 597 of file Signature.h.
|
inline |
Returns const access to the sensor data.
Definition at line 603 of file Signature.h.
| unsigned long rtabmap::Signature::getMemoryUsed | ( | bool | withSensorData = true | ) | const |
Computes the memory usage of this signature.
Calculates the approximate memory footprint of this signature, including visual words, links, sensor data, and other internal structures.
| withSensorData | If true, includes sensor data in the calculation |