/* ---------------------------------------------------------------------------- * GTSAM Copyright 2010, Georgia Tech Research Corporation, * Atlanta, Georgia 30332-0415 * All Rights Reserved * Authors: Frank Dellaert, et al. (see THANKS for the full author list) * See LICENSE for the license information * -------------------------------------------------------------------------- */ /** * @file Simulated3D.h * @brief measurement functions and derivatives for simulated 3D robot * @author Alex Cunningham **/ // \callgraph #pragma once #include #include #include #include #include #include // \namespace namespace gtsam { namespace simulated3D { typedef gtsam::TypedSymbol PoseKey; typedef gtsam::TypedSymbol PointKey; typedef LieValues PoseValues; typedef LieValues PointValues; typedef TupleValues2 Values; /** * Prior on a single pose */ Point3 prior(const Point3& x, boost::optional H = boost::none); /** * odometry between two poses */ Point3 odo(const Point3& x1, const Point3& x2, boost::optional H1 = boost::none, boost::optional H2 = boost::none); /** * measurement between landmark and pose */ Point3 mea(const Point3& x, const Point3& l, boost::optional H1 = boost::none, boost::optional H2 = boost::none); struct PointPrior3D: public NonlinearFactor1 { Point3 z_; PointPrior3D(const Point3& z, const SharedGaussian& model, const PoseKey& j) : NonlinearFactor1 (model, j), z_(z) { } Vector evaluateError(const Point3& x, boost::optional H = boost::none) { return (prior(x, H) - z_).vector(); } }; struct Simulated3DMeasurement: public NonlinearFactor2 { Point3 z_; Simulated3DMeasurement(const Point3& z, const SharedGaussian& model, PoseKey& j1, PointKey j2) : NonlinearFactor2 ( model, j1, j2), z_(z) { } Vector evaluateError(const Point3& x1, const Point3& x2, boost::optional< Matrix&> H1 = boost::none, boost::optional H2 = boost::none) { return (mea(x1, x2, H1, H2) - z_).vector(); } }; }} // namespace simulated3D