gtsam
Loading...
Searching...
No Matches
gtsam::LabeledSymbol Class Reference

Detailed Description

Customized version of gtsam::Symbol for multi-robot use.

This variation of Symbol stores two char values in addition to an integer key, which is useful for encoding a group for a variable. This was originally designed for multi-robot systems, which allows expressing "Pose 7 from robot B" as "xB7".

Standard API

 operator Key () const
 Cast to Key.
Key key () const
 return the integer version
unsigned char label () const
 Retrieve label character.
unsigned char chr () const
 Retrieve key character.
std::uint64_t index () const
 Retrieve key index.
 operator std::string () const
 Create a string from the key.
GTSAM_EXPORT std::ostream & operator<< (std::ostream &os, const LabeledSymbol &symbol)
 Output stream operator that can be used with key_formatter (see Key.h).

Public Member Functions

Constructors
 LabeledSymbol ()
 Default constructor.
 LabeledSymbol (const LabeledSymbol &key)
 Copy constructor.
 LabeledSymbol (unsigned char c, unsigned char label, std::uint64_t j)
 Constructor fro characters c and label, and integer j.
 LabeledSymbol (Key key)
 Constructor that decodes an integer Key.
Testable
void print (const std::string &s="") const
 Prints the LabeledSymbol with an optional prefix string.
bool equals (const LabeledSymbol &expected, double tol=0.0) const
 Checks if this LabeledSymbol is equal to another, tolerance is ignored.
Comparison
bool operator< (const LabeledSymbol &comp) const
bool operator== (const LabeledSymbol &comp) const
bool operator== (Key comp) const
bool operator!= (const LabeledSymbol &comp) const
bool operator!= (Key comp) const
Advanced API
LabeledSymbol upper () const
 Converts to upper/lower versions of labels.
LabeledSymbol lower () const
LabeledSymbol newChr (unsigned char c) const
 Create a new symbol with a different character.
LabeledSymbol newLabel (unsigned char label) const
 Create a new symbol with a different label.

Static Public Member Functions

Filtering

Return a filter function that returns true when evaluated on a Key whose character (when converted to a LabeledSymbol) matches c.

Use this with the Values::filter() function to retrieve all key-value pairs with the requested character.

static std::function< bool(Key)> TypeTest (unsigned char c)
 Checks only the type.
static std::function< bool(Key)> LabelTest (unsigned char label)
 Checks only the robot ID (label_).
static std::function< bool(Key)> TypeLabelTest (unsigned char c, unsigned char label)
 Checks both type and the robot ID.

Protected Attributes

unsigned char c_
unsigned char label_
std::uint64_t j_

The documentation for this class was generated from the following files:
  • /tmp/gtsam-4.3.0-doxygen.rsXPUS/source/gtsam/inference/LabeledSymbol.h
  • /tmp/gtsam-4.3.0-doxygen.rsXPUS/source/gtsam/inference/LabeledSymbol.cpp