28 using namespace gtsam;
30 int main(
const int argc,
const char *argv[]) {
40 std::tie(graph, initial) =
readG2o(g2oFile);
43 auto priorModel = noiseModel::Diagonal::Variances(
Vector3(1
e-6, 1
e-6, 1
e-8));
44 graph->addPrior(0,
Pose2(), priorModel);
47 std::cout <<
"Computing LAGO estimate" << std::endl;
49 std::cout <<
"done!" << std::endl;
52 estimateLago.
print(
"estimateLago");
55 std::cout <<
"Writing results to file: " << outputFile << std::endl;
58 std::tie(graphNoKernel, initial2) =
readG2o(g2oFile);
59 writeG2o(*graphNoKernel, estimateLago, outputFile);
60 std::cout <<
"done! " << std::endl;
void writeG2o(const NonlinearFactorGraph &graph, const Values &estimate, const std::string &filename)
This function writes a g2o file from NonlinearFactorGraph and a Values structure. ...
NonlinearFactorGraph graph
Initialize Pose2 in a factor graph using LAGO (Linear Approximation for Graph Optimization). see papers:
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GraphAndValues readG2o(const std::string &g2oFile, const bool is3D, KernelFunctionType kernelFunctionType)
This function parses a g2o file and stores the measurements into a NonlinearFactorGraph and the initi...
GTSAM_EXPORT std::string findExampleDataFile(const std::string &name)
std::shared_ptr< This > shared_ptr
int main(const int argc, const char *argv[])
Values initialize(const NonlinearFactorGraph &graph, bool useOdometricPath)
utility functions for loading datasets