Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | List of all members
gtsam::TranslationRecovery Class Reference

#include <TranslationRecovery.h>

Public Types

using KeyPair = std::pair< Key, Key >
 
using TranslationEdges = std::vector< BinaryMeasurement< Unit3 > >
 

Public Member Functions

void addPrior (const std::vector< BinaryMeasurement< Unit3 >> &relativeTranslations, const double scale, const std::vector< BinaryMeasurement< Point3 >> &betweenTranslations, NonlinearFactorGraph *graph, const SharedNoiseModel &priorNoiseModel=noiseModel::Isotropic::Sigma(3, 0.01)) const
 Add 3 factors to the graph: More...
 
NonlinearFactorGraph buildGraph (const std::vector< BinaryMeasurement< Unit3 >> &relativeTranslations) const
 Build the factor graph to do the optimization. More...
 
Values initializeRandomly (const std::vector< BinaryMeasurement< Unit3 >> &relativeTranslations, const std::vector< BinaryMeasurement< Point3 >> &betweenTranslations, const Values &initialValues=Values()) const
 Version of initializeRandomly with a fixed seed. More...
 
Values initializeRandomly (const std::vector< BinaryMeasurement< Unit3 >> &relativeTranslations, const std::vector< BinaryMeasurement< Point3 >> &betweenTranslations, std::mt19937 *rng, const Values &initialValues=Values()) const
 Create random initial translations. More...
 
Values run (const TranslationEdges &relativeTranslations, const double scale=1.0, const std::vector< BinaryMeasurement< Point3 >> &betweenTranslations={}, const Values &initialValues=Values()) const
 Build and optimize factor graph. More...
 
 TranslationRecovery ()=default
 Default constructor. More...
 
 TranslationRecovery (const LevenbergMarquardtParams &lmParams, bool use_bilinear_translation_factor=false)
 Construct a new Translation Recovery object. More...
 

Static Public Member Functions

static TranslationEdges SimulateMeasurements (const Values &poses, const std::vector< KeyPair > &edges)
 Simulate translation direction measurements. More...
 

Private Attributes

LevenbergMarquardtParams lmParams_
 
TranslationEdges relativeTranslations_
 
const bool use_bilinear_translation_factor_ = false
 

Detailed Description

Definition at line 51 of file TranslationRecovery.h.

Member Typedef Documentation

◆ KeyPair

Definition at line 53 of file TranslationRecovery.h.

◆ TranslationEdges

Definition at line 54 of file TranslationRecovery.h.

Constructor & Destructor Documentation

◆ TranslationRecovery() [1/2]

gtsam::TranslationRecovery::TranslationRecovery ( const LevenbergMarquardtParams lmParams,
bool  use_bilinear_translation_factor = false 
)
inline

Construct a new Translation Recovery object.

Parameters
lmParamsparameters for optimization.

Definition at line 71 of file TranslationRecovery.h.

◆ TranslationRecovery() [2/2]

gtsam::TranslationRecovery::TranslationRecovery ( )
default

Default constructor.

Member Function Documentation

◆ addPrior()

void TranslationRecovery::addPrior ( const std::vector< BinaryMeasurement< Unit3 >> &  relativeTranslations,
const double  scale,
const std::vector< BinaryMeasurement< Point3 >> &  betweenTranslations,
NonlinearFactorGraph graph,
const SharedNoiseModel priorNoiseModel = noiseModel::Isotropic::Sigma(3, 0.01) 
) const

Add 3 factors to the graph:

  • A prior on the first point to lie at (0, 0, 0)
  • If betweenTranslations is non-empty, between factors provided by it.
  • If betweenTranslations is empty, a prior on scale of the first relativeTranslations edge.
Parameters
relativeTranslationsunit translation directions between translations to be estimated
scalescale for first relative translation which fixes gauge.
graphfactor graph to which prior is added.
betweenTranslationsrelative translations (with scale) between 2 points in world coordinate frame known a priori.
priorNoiseModelthe noise model to use with the prior.

Definition at line 119 of file TranslationRecovery.cpp.

◆ buildGraph()

NonlinearFactorGraph TranslationRecovery::buildGraph ( const std::vector< BinaryMeasurement< Unit3 >> &  relativeTranslations) const

Build the factor graph to do the optimization.

Parameters
relativeTranslationsunit translation directions between translations to be estimated
Returns
NonlinearFactorGraph

Definition at line 99 of file TranslationRecovery.cpp.

◆ initializeRandomly() [1/2]

Values TranslationRecovery::initializeRandomly ( const std::vector< BinaryMeasurement< Unit3 >> &  relativeTranslations,
const std::vector< BinaryMeasurement< Point3 >> &  betweenTranslations,
const Values initialValues = Values() 
) const

Version of initializeRandomly with a fixed seed.

Parameters
relativeTranslationsunit translation directions between translations to be estimated
betweenTranslationsrelative translations (with scale) between 2 points in world coordinate frame known a priori.
initialValues(optional) initial values from a prior
Returns
Values

Definition at line 183 of file TranslationRecovery.cpp.

◆ initializeRandomly() [2/2]

Values TranslationRecovery::initializeRandomly ( const std::vector< BinaryMeasurement< Unit3 >> &  relativeTranslations,
const std::vector< BinaryMeasurement< Point3 >> &  betweenTranslations,
std::mt19937 *  rng,
const Values initialValues = Values() 
) const

Create random initial translations.

Parameters
relativeTranslationsunit translation directions between translations to be estimated
betweenTranslationsrelative translations (with scale) between 2 points in world coordinate frame known a priori.
rngrandom number generator
initialValues(optional) initial values from a prior
Returns
Values

Definition at line 145 of file TranslationRecovery.cpp.

◆ run()

Values TranslationRecovery::run ( const TranslationEdges relativeTranslations,
const double  scale = 1.0,
const std::vector< BinaryMeasurement< Point3 >> &  betweenTranslations = {},
const Values initialValues = Values() 
) const

Build and optimize factor graph.

Parameters
relativeTranslationsthe relative translations, in world coordinate frames, vector of BinaryMeasurements of Unit3, where each key of a measurement is a point in 3D. If a relative translation magnitude is zero, it is treated as a hard same-point constraint (the result of all nodes connected by a zero-magnitude edge will be the same).
scalescale for first relative translation which fixes gauge. The scale is only used if betweenTranslations is empty.
betweenTranslationsrelative translations (with scale) between 2 points in world coordinate frame known a priori. Unlike relativeTranslations, zero-magnitude betweenTranslations are not treated as hard constraints.
initialValuesinitial values for optimization. Initializes randomly if not provided.
Returns
Values

Definition at line 191 of file TranslationRecovery.cpp.

◆ SimulateMeasurements()

TranslationRecovery::TranslationEdges TranslationRecovery::SimulateMeasurements ( const Values poses,
const std::vector< KeyPair > &  edges 
)
static

Simulate translation direction measurements.

Parameters
posesSE(3) ground truth poses stored as Values
edgespairs (a,b) for which a measurement w_aZb will be generated.
Returns
TranslationEdges vector of binary measurements where the keys are the cameras and the measurement is the simulated Unit3 translation direction between the cameras.

Definition at line 230 of file TranslationRecovery.cpp.

Member Data Documentation

◆ lmParams_

LevenbergMarquardtParams gtsam::TranslationRecovery::lmParams_
private

Definition at line 61 of file TranslationRecovery.h.

◆ relativeTranslations_

TranslationEdges gtsam::TranslationRecovery::relativeTranslations_
private

Definition at line 58 of file TranslationRecovery.h.

◆ use_bilinear_translation_factor_

const bool gtsam::TranslationRecovery::use_bilinear_translation_factor_ = false
private

Definition at line 63 of file TranslationRecovery.h.


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


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:24:49