function to save graph as graphviz file via wrapper
parent
0527a83674
commit
e8897ba1d8
|
@ -2041,6 +2041,7 @@ class NonlinearFactorGraph {
|
||||||
|
|
||||||
// enabling serialization functionality
|
// enabling serialization functionality
|
||||||
void serialize() const;
|
void serialize() const;
|
||||||
|
void saveGraph(const string& s) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
#include <gtsam/nonlinear/NonlinearFactor.h>
|
#include <gtsam/nonlinear/NonlinearFactor.h>
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <fstream>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
@ -256,6 +257,16 @@ void NonlinearFactorGraph::saveGraph(std::ostream &stm, const Values& values,
|
||||||
stm << "}\n";
|
stm << "}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ************************************************************************* */
|
||||||
|
void NonlinearFactorGraph::saveGraph(
|
||||||
|
const std::string& file, const Values& values,
|
||||||
|
const GraphvizFormatting& graphvizFormatting,
|
||||||
|
const KeyFormatter& keyFormatter) const {
|
||||||
|
std::ofstream of(file);
|
||||||
|
saveGraph(of, values, graphvizFormatting, keyFormatter);
|
||||||
|
of.close();
|
||||||
|
}
|
||||||
|
|
||||||
/* ************************************************************************* */
|
/* ************************************************************************* */
|
||||||
double NonlinearFactorGraph::error(const Values& values) const {
|
double NonlinearFactorGraph::error(const Values& values) const {
|
||||||
gttic(NonlinearFactorGraph_error);
|
gttic(NonlinearFactorGraph_error);
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @file NonlinearFactorGraph.h
|
* @file NonlinearFactorGraph.h
|
||||||
* @brief Factor Graph Constsiting of non-linear factors
|
* @brief Factor Graph consisting of non-linear factors
|
||||||
* @author Frank Dellaert
|
* @author Frank Dellaert
|
||||||
* @author Carlos Nieto
|
* @author Carlos Nieto
|
||||||
* @author Christian Potthast
|
* @author Christian Potthast
|
||||||
|
@ -116,6 +116,11 @@ namespace gtsam {
|
||||||
const GraphvizFormatting& graphvizFormatting = GraphvizFormatting(),
|
const GraphvizFormatting& graphvizFormatting = GraphvizFormatting(),
|
||||||
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
|
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
|
||||||
|
|
||||||
|
/** Write the graph in GraphViz format to file for visualization */
|
||||||
|
void saveGraph(const std::string& file, const Values& values = Values(),
|
||||||
|
const GraphvizFormatting& graphvizFormatting = GraphvizFormatting(),
|
||||||
|
const KeyFormatter& keyFormatter = DefaultKeyFormatter) const;
|
||||||
|
|
||||||
/** unnormalized error, \f$ 0.5 \sum_i (h_i(X_i)-z)^2/\sigma^2 \f$ in the most common case */
|
/** unnormalized error, \f$ 0.5 \sum_i (h_i(X_i)-z)^2/\sigma^2 \f$ in the most common case */
|
||||||
double error(const Values& values) const;
|
double error(const Values& values) const;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue