20 #include <boost/filesystem.hpp> 28 using namespace gtsam;
29 namespace fs = boost::filesystem;
31 static string topdir = TOPSRCDIR;
33 static string topdir =
"TOPSRCDIR_NOT_CONFIGURED";
49 graph.
addPrior(234,
Pose2(1.0, 2.0, 0.3), noiseModel::Diagonal::Sigmas(Vector::Ones(3)));
56 TEST( testSerialization, text_graph_serialization ) {
64 TEST( testSerialization, xml_graph_serialization ) {
72 TEST( testSerialization, text_values_serialization ) {
80 TEST( testSerialization, xml_values_serialization ) {
88 TEST( testSerialization, serialization_file ) {
90 fs::remove_all(
"actual");
91 fs::create_directory(
"actual");
92 string path =
"actual/";
std::string serializeGraph(const NonlinearFactorGraph &graph)
NonlinearFactorGraph::shared_ptr deserializeGraph(const std::string &serialized_graph)
static int runAllTests(TestResult &result)
bool assert_equal(const Matrix &expected, const Matrix &actual, double tol)
Values::shared_ptr deserializeValuesFromFile(const std::string &fname)
NonlinearFactorGraph::shared_ptr deserializeGraphFromXMLFile(const std::string &fname, const std::string &name="graph")
NonlinearFactorGraph graph
IsDerived< DERIVEDFACTOR > add(std::shared_ptr< DERIVEDFACTOR > factor)
add is a synonym for push_back.
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
std::string serializeValuesXML(const Values &values, const std::string &name="values")
static Rot3 Rx(double t)
Rotation around X axis as in http://en.wikipedia.org/wiki/Rotation_matrix, counterclockwise when look...
#define EXPECT(condition)
Values::shared_ptr deserializeValuesXML(const std::string &serialized_values, const std::string &name="values")
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Values::shared_ptr deserializeValues(const std::string &serialized_values)
NonlinearFactorGraph::shared_ptr deserializeGraphFromFile(const std::string &fname)
bool serializeGraphToXMLFile(const NonlinearFactorGraph &graph, const std::string &fname, const std::string &name="graph")
std::string serializeGraphXML(const NonlinearFactorGraph &graph, const std::string &name="graph")
bool serializeGraphToFile(const NonlinearFactorGraph &graph, const std::string &fname)
TEST(testSerialization, text_graph_serialization)
Values::shared_ptr deserializeValuesFromXMLFile(const std::string &fname, const std::string &name="values")
std::string serializeValues(const Values &values)
static Rot2 fromAngle(double theta)
Named constructor from angle in radians.
void insert(Key j, const Value &val)
bool serializeValuesToFile(const Values &values, const std::string &fname)
NonlinearFactorGraph::shared_ptr deserializeGraphXML(const std::string &serialized_graph, const std::string &name="graph")
NonlinearFactorGraph exampleGraph()
bool serializeValuesToXMLFile(const Values &values, const std::string &fname, const std::string &name="values")