More cleanup

release/4.3a0
Frank Dellaert 2024-10-24 13:21:29 -07:00
parent bec4afa3f8
commit 68c9da8c4e
3 changed files with 18 additions and 16 deletions

View File

@ -68,7 +68,7 @@ class GTSAM_EXPORT LabeledSymbol {
} }
/// @} /// @}
/// @name API /// @name Standard API
/// @{ /// @{
/// Cast to Key /// Cast to Key
@ -103,15 +103,13 @@ class GTSAM_EXPORT LabeledSymbol {
bool operator!=(const LabeledSymbol& comp) const; bool operator!=(const LabeledSymbol& comp) const;
bool operator!=(Key comp) const; bool operator!=(Key comp) const;
/** Return a filter function that returns true when evaluated on a Key whose
* character (when converted to a LabeledSymbol) matches \c c. Use this with
* the Values::filter() function to retrieve all key-value pairs with the
* requested character.
*/
/// @} /// @}
/// @name Advanced API /// @name Filtering
/// @{ /// @{
/// Return a filter function that returns true when evaluated on a Key whose
/// character (when converted to a LabeledSymbol) matches \c c. Use this with
/// the Values::filter() function to retrieve all key-value pairs with the
/// requested character.
/// Checks only the type /// Checks only the type
static std::function<bool(Key)> TypeTest(unsigned char c); static std::function<bool(Key)> TypeTest(unsigned char c);
@ -123,6 +121,10 @@ class GTSAM_EXPORT LabeledSymbol {
static std::function<bool(Key)> TypeLabelTest(unsigned char c, static std::function<bool(Key)> TypeLabelTest(unsigned char c,
unsigned char label); unsigned char label);
/// @}
/// @name Advanced API
/// @{
/// Converts to upper/lower versions of labels /// Converts to upper/lower versions of labels
LabeledSymbol upper() const { return LabeledSymbol(c_, toupper(label_), j_); } LabeledSymbol upper() const { return LabeledSymbol(c_, toupper(label_), j_); }
LabeledSymbol lower() const { return LabeledSymbol(c_, tolower(label_), j_); } LabeledSymbol lower() const { return LabeledSymbol(c_, tolower(label_), j_); }
@ -152,20 +154,20 @@ class GTSAM_EXPORT LabeledSymbol {
#endif #endif
}; // \class LabeledSymbol }; // \class LabeledSymbol
/** Create a symbol key from a character, label and index, i.e. xA5. */ /// Create a symbol key from a character, label and index, i.e. xA5.
inline Key mrsymbol(unsigned char c, unsigned char label, size_t j) { inline Key mrsymbol(unsigned char c, unsigned char label, size_t j) {
return (Key)LabeledSymbol(c, label, j); return (Key)LabeledSymbol(c, label, j);
} }
/** Return the character portion of a symbol key. */ /// Return the character portion of a symbol key.
inline unsigned char mrsymbolChr(Key key) { return LabeledSymbol(key).chr(); } inline unsigned char mrsymbolChr(Key key) { return LabeledSymbol(key).chr(); }
/** Return the label portion of a symbol key. */ /// Return the label portion of a symbol key.
inline unsigned char mrsymbolLabel(Key key) { inline unsigned char mrsymbolLabel(Key key) {
return LabeledSymbol(key).label(); return LabeledSymbol(key).label();
} }
/** Return the index portion of a symbol key. */ /// Return the index portion of a symbol key.
inline size_t mrsymbolIndex(Key key) { return LabeledSymbol(key).index(); } inline size_t mrsymbolIndex(Key key) { return LabeledSymbol(key).index(); }
/// traits /// traits

View File

@ -55,7 +55,7 @@ class TranslationFactor : public NoiseModelFactorN<Point3, Point3> {
: Base(noiseModel, a, b), measured_w_aZb_(w_aZb.point3()) {} : Base(noiseModel, a, b), measured_w_aZb_(w_aZb.point3()) {}
/** /**
* @brief Caclulate error: (norm(Tb - Ta) - measurement) * @brief Calculate error: (norm(Tb - Ta) - measurement)
* where Tb and Ta are Point3 translations and measurement is * where Tb and Ta are Point3 translations and measurement is
* the Unit3 translation direction from a to b. * the Unit3 translation direction from a to b.
* *
@ -120,7 +120,7 @@ class BilinearAngleTranslationFactor
using NoiseModelFactor2<Point3, Point3, Vector1>::evaluateError; using NoiseModelFactor2<Point3, Point3, Vector1>::evaluateError;
/** /**
* @brief Caclulate error: (scale * (Tb - Ta) - measurement) * @brief Calculate error: (scale * (Tb - Ta) - measurement)
* where Tb and Ta are Point3 translations and measurement is * where Tb and Ta are Point3 translations and measurement is
* the Unit3 translation direction from a to b. * the Unit3 translation direction from a to b.
* *

View File

@ -119,7 +119,7 @@ class GTSAM_EXPORT TranslationRecovery {
* @param betweenTranslations relative translations (with scale) between 2 * @param betweenTranslations relative translations (with scale) between 2
* points in world coordinate frame known a priori. * points in world coordinate frame known a priori.
* @param rng random number generator * @param rng random number generator
* @param intialValues (optional) initial values from a prior * @param initialValues (optional) initial values from a prior
* @return Values * @return Values
*/ */
Values initializeRandomly( Values initializeRandomly(
@ -156,7 +156,7 @@ class GTSAM_EXPORT TranslationRecovery {
* points in world coordinate frame known a priori. Unlike * points in world coordinate frame known a priori. Unlike
* relativeTranslations, zero-magnitude betweenTranslations are not treated as * relativeTranslations, zero-magnitude betweenTranslations are not treated as
* hard constraints. * hard constraints.
* @param initialValues intial values for optimization. Initializes randomly * @param initialValues initial values for optimization. Initializes randomly
* if not provided. * if not provided.
* @return Values * @return Values
*/ */