38 using namespace gtsam;
42 int main(
int argc,
char* argv[]) {
45 throw runtime_error(
"Usage: timeShonanFactor [g2oFile]");
51 g2oFile = argv[argc - 1];
54 }
catch (
const exception&
e) {
55 cerr << e.what() <<
'\n';
60 const auto measurements = parseMeasurements<Rot3>(g2oFile);
66 auto priorModel = noiseModel::Isotropic::Sigma(6, 10000);
68 auto G = std::make_shared<Matrix>(SOn::VectorizedGenerators(4));
69 for (
const auto &
m : measurements) {
70 const auto &
keys =
m.keys();
71 const Rot3 &Rij =
m.measured();
72 const auto &
model =
m.noiseModel();
81 LevenbergMarquardtParams::SetCeresDefaults(¶ms);
92 for (
size_t i = 0;
i < 100;
i++) {
95 initial.
insert(0, SOn::Identity(4));
96 for (
size_t j = 1;
j < poses.size();
j++) {
97 initial.
insert(
j, SOn::Random(rng, 4));
101 cout <<
"cost = " << graph.error(result) << endl;
Main factor type in Shonan averaging, on SO(n) pairs.
void setLinearSolverType(const std::string &solver)
virtual const Values & optimize()
A non-templated config holding any types of Manifold-group elements.
Factor Graph consisting of non-linear factors.
JacobiRotation< float > G
noiseModel::Diagonal::shared_ptr model
GTSAM_EXPORT std::map< size_t, Pose3 > parseVariables< Pose3 >(const std::string &filename, size_t maxIndex)
NonlinearFactorGraph graph
Rot3 is a 3D rotation represented as a rotation matrix if the preprocessor symbol GTSAM_USE_QUATERNIO...
static const SmartProjectionParams params
int main(int argc, char *argv[])
A nonlinear optimizer that uses the Levenberg-Marquardt trust-region scheme.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
static SharedNoiseModel gNoiseModel
GTSAM_EXPORT std::string findExampleDataFile(const std::string &name)
int optimize(const SfmData &db, const NonlinearFactorGraph &graph, const Values &initial, bool separateCalibration=false)
void insert(Key j, const Value &val)
void tictoc_finishedIteration_()
utility functions for loading datasets
noiseModel::Base::shared_ptr SharedNoiseModel