created addPrior
parent
e60d903210
commit
d0ce5d36da
|
@ -52,7 +52,8 @@ namespace gtsam {
|
||||||
Point2 pt;
|
Point2 pt;
|
||||||
float scale = 100;
|
float scale = 100;
|
||||||
|
|
||||||
ofstream of(s.c_str());
|
string dotfile = s + ".dot";
|
||||||
|
ofstream of(dotfile.c_str());
|
||||||
of << "graph G{" << endl;
|
of << "graph G{" << endl;
|
||||||
of << "bgcolor=\"transparent\";" << endl;
|
of << "bgcolor=\"transparent\";" << endl;
|
||||||
|
|
||||||
|
@ -74,9 +75,7 @@ namespace gtsam {
|
||||||
of<<"}";
|
of<<"}";
|
||||||
of.close();
|
of.close();
|
||||||
|
|
||||||
char filename[100];
|
string cmd = boost::str(boost::format("neato -s -n -Tpdf %s -o %s.pdf") % dotfile % s);
|
||||||
sscanf(s.c_str(), "%s.dot", filename);
|
|
||||||
string cmd = boost::str(boost::format("neato -s -n -Tpdf %s -o %s.pdf") % s % filename);
|
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,12 @@ namespace gtsam {
|
||||||
|
|
||||||
namespace planarSLAM {
|
namespace planarSLAM {
|
||||||
|
|
||||||
|
void Graph::addPrior(const PoseKey& i, const Pose2& p,
|
||||||
|
const SharedGaussian& model) {
|
||||||
|
sharedFactor factor(new Prior(i, p, model));
|
||||||
|
push_back(factor);
|
||||||
|
}
|
||||||
|
|
||||||
void Graph::addPoseConstraint(const PoseKey& i, const Pose2& p) {
|
void Graph::addPoseConstraint(const PoseKey& i, const Pose2& p) {
|
||||||
sharedFactor factor(new Constraint(i, p));
|
sharedFactor factor(new Constraint(i, p));
|
||||||
push_back(factor);
|
push_back(factor);
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include "NonlinearFactor.h"
|
#include "NonlinearFactor.h"
|
||||||
#include "TupleConfig.h"
|
#include "TupleConfig.h"
|
||||||
#include "NonlinearEquality.h"
|
#include "NonlinearEquality.h"
|
||||||
|
#include "PriorFactor.h"
|
||||||
#include "BetweenFactor.h"
|
#include "BetweenFactor.h"
|
||||||
#include "NonlinearFactorGraph.h"
|
#include "NonlinearFactorGraph.h"
|
||||||
#include "NonlinearOptimizer.h"
|
#include "NonlinearOptimizer.h"
|
||||||
|
@ -86,12 +87,14 @@ namespace gtsam {
|
||||||
|
|
||||||
// Factors
|
// Factors
|
||||||
typedef NonlinearEquality<Config, PoseKey, Pose2> Constraint;
|
typedef NonlinearEquality<Config, PoseKey, Pose2> Constraint;
|
||||||
|
typedef PriorFactor<Config, PoseKey, Pose2> Prior;
|
||||||
typedef BetweenFactor<Config, PoseKey, Pose2> Odometry;
|
typedef BetweenFactor<Config, PoseKey, Pose2> Odometry;
|
||||||
typedef BearingFactor<Config, PoseKey, PointKey> Bearing;
|
typedef BearingFactor<Config, PoseKey, PointKey> Bearing;
|
||||||
typedef RangeFactor<Config, PoseKey, PointKey> Range;
|
typedef RangeFactor<Config, PoseKey, PointKey> Range;
|
||||||
|
|
||||||
// Graph
|
// Graph
|
||||||
struct Graph: public NonlinearFactorGraph<Config> {
|
struct Graph: public NonlinearFactorGraph<Config> {
|
||||||
|
void addPrior(const PoseKey& i, const Pose2& p, const SharedGaussian& model);
|
||||||
void addPoseConstraint(const PoseKey& i, const Pose2& p);
|
void addPoseConstraint(const PoseKey& i, const Pose2& p);
|
||||||
void addOdometry(const PoseKey& i, const PoseKey& j, const Pose2& z,
|
void addOdometry(const PoseKey& i, const PoseKey& j, const Pose2& z,
|
||||||
const SharedGaussian& model);
|
const SharedGaussian& model);
|
||||||
|
|
Loading…
Reference in New Issue