Added ExpressionFactorGraph (should go away with move of ExpressionFactor to gtsam)
parent
fa7071bdd8
commit
541217175c
|
@ -0,0 +1,51 @@
|
|||
/* ----------------------------------------------------------------------------
|
||||
|
||||
* GTSAM Copyright 2010, Georgia Tech Research Corporation,
|
||||
* Atlanta, Georgia 30332-0415
|
||||
* All Rights Reserved
|
||||
* Authors: Frank Dellaert, et al. (see THANKS for the full author list)
|
||||
|
||||
* See LICENSE for the license information
|
||||
|
||||
* -------------------------------------------------------------------------- */
|
||||
|
||||
/**
|
||||
* @file ExpressionFactorGraph.h
|
||||
* @brief Factor graph that supports adding ExpressionFactors directly
|
||||
* @author Frank Dellaert
|
||||
* @date December 2014
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <gtsam_unstable/nonlinear/ExpressionFactor.h>
|
||||
#include <gtsam/nonlinear/NonlinearFactorGraph.h>
|
||||
|
||||
namespace gtsam {
|
||||
|
||||
/**
|
||||
* Factor graph that supports adding ExpressionFactors directly
|
||||
*/
|
||||
class ExpressionFactorGraph: public NonlinearFactorGraph {
|
||||
|
||||
public:
|
||||
|
||||
/// @name Adding Factors
|
||||
/// @{
|
||||
|
||||
/**
|
||||
* Directly add ExpressionFactor that implements |h(x)-z|^2_R
|
||||
* @param h expression that implements measurement function
|
||||
* @param z measurement
|
||||
* @param R model
|
||||
*/
|
||||
template<typename T>
|
||||
void addExpressionFactor(const Expression<T>& h, const T& z,
|
||||
const SharedNoiseModel& R) {
|
||||
push_back(boost::make_shared<ExpressionFactor<T> >(R, z, h));
|
||||
}
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
||||
}
|
|
@ -17,10 +17,9 @@
|
|||
* @date December 2014
|
||||
*/
|
||||
|
||||
#include <gtsam_unstable/nonlinear/ExpressionFactorGraph.h>
|
||||
#include <gtsam_unstable/geometry/Event.h>
|
||||
#include <gtsam_unstable/nonlinear/ExpressionFactor.h>
|
||||
#include <gtsam/nonlinear/LevenbergMarquardtOptimizer.h>
|
||||
#include <gtsam/nonlinear/NonlinearFactorGraph.h>
|
||||
#include <gtsam/base/numericalDerivative.h>
|
||||
|
||||
#include <CppUnitLite/TestHarness.h>
|
||||
|
@ -50,31 +49,6 @@ static const double timeOfEvent = 25;
|
|||
static const Event exampleEvent(timeOfEvent, 1, 0, 0);
|
||||
static const Point3 microphoneAt0;
|
||||
|
||||
/**
|
||||
* Factor graph that supports adding Expression Factors directly
|
||||
*/
|
||||
class ExpressionFactorGraph: public NonlinearFactorGraph {
|
||||
|
||||
public:
|
||||
|
||||
/// @name Adding Factors
|
||||
/// @{
|
||||
|
||||
/**
|
||||
* Directly add ExpressionFactor that implements |h(x)-z|^2_R
|
||||
* @param h expression that implements measurement function
|
||||
* @param z measurement
|
||||
* @param R model
|
||||
*/
|
||||
template<typename T>
|
||||
void addExpressionFactor(const Expression<T>& h, const T& z,
|
||||
const SharedNoiseModel& R) {
|
||||
push_back(boost::make_shared<ExpressionFactor<T> >(R, z, h));
|
||||
}
|
||||
|
||||
/// @}
|
||||
};
|
||||
|
||||
//*****************************************************************************
|
||||
TEST( TOAFactor, NewWay ) {
|
||||
Key key = 12;
|
||||
|
|
Loading…
Reference in New Issue