Go to the documentation of this file.
   55 using namespace gtsam;
 
   58 int main(
int argc, 
char* argv[]) {
 
   60   auto K = std::make_shared<Cal3_S2>(50.0, 50.0, 0.0, 50.0, 50.0);
 
   63   auto measurementNoise =
 
   64       noiseModel::Isotropic::Sigma(2, 1.0);  
 
   76   auto poseNoise = noiseModel::Diagonal::Sigmas(
 
   77       (
Vector(6) << Vector3::Constant(0.1), Vector3::Constant(0.3))
 
   83   for (
size_t i = 0; 
i < poses.size(); ++
i) {
 
   85     for (
size_t j = 0; 
j < points.size(); ++
j) {
 
   97   auto pointNoise = noiseModel::Isotropic::Sigma(3, 0.1);
 
  105   for (
size_t i = 0; 
i < poses.size(); ++
i) {
 
  106     auto corrupted_pose = poses[
i].compose(
 
  107         Pose3(Rot3::Rodrigues(-0.1, 0.2, 0.25), 
Point3(0.05, -0.10, 0.20)));
 
  109         Symbol(
'x', 
i), corrupted_pose);
 
  111   for (
size_t j = 0; 
j < points.size(); ++
j) {
 
  112     Point3 corrupted_point = points[
j] + 
Point3(-0.25, 0.20, 0.15);
 
  115   initialEstimate.
print(
"Initial Estimates:\n");
 
  120   cout << 
"initial error = " << 
graph.
error(initialEstimate) << endl;
 
  
virtual const Values & optimize()
Reprojection of a LANDMARK to a 2D point.
std::vector< Point3 > createPoints()
Create a set of ground-truth landmarks.
double error(const Values &values) const
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
std::vector< Pose3 > createPoses(const Pose3 &init=Pose3(Rot3::Ypr(M_PI_2, 0, -M_PI_2), {30, 0, 0}), const Pose3 &delta=Pose3(Rot3::Ypr(0, -M_PI_4, 0), {sin(M_PI_4) *30, 0, 30 *(1 - sin(M_PI_4))}), int steps=8)
void print(const std::string &str="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
int main(int argc, char *argv[])
Factor Graph consisting of non-linear factors.
void insert(Key j, const Value &val)
static const CalibratedCamera camera(kDefaultPose)
NonlinearFactorGraph graph
Simple example for the structure-from-motion problems.
Eigen::Matrix< double, Eigen::Dynamic, 1 > Vector
static Point2 measurement(323.0, 240.0)
A non-templated config holding any types of Manifold-group elements.
Point2 project(const Point3 &point, OptionalJacobian< 2, 6 > Dcamera={}, OptionalJacobian< 2, 3 > Dpoint={}) const
IsDerived< DERIVEDFACTOR > emplace_shared(Args &&... args)
Emplace a shared pointer to factor of given type.
void print(const std::string &str="NonlinearFactorGraph: ", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const override
gtsam
Author(s): 
autogenerated on Wed May 28 2025 03:03:10