48 double dt,
double mu = 1000)
76 virtual gtsam::NonlinearFactor::shared_ptr
clone()
const {
77 return boost::static_pointer_cast<gtsam::NonlinearFactor>(
84 boost::optional<gtsam::Matrix&> H1=boost::none,
85 boost::optional<gtsam::Matrix&> H2=boost::none)
const {
86 if (H1) *H1 = gtsam::numericalDerivative21<gtsam::Vector,PoseRTV,PoseRTV>(
87 boost::bind(VelocityConstraint::evaluateError_, _1, _2, dt_,
integration_mode_), x1, x2, 1e-5);
88 if (H2) *H2 = gtsam::numericalDerivative22<gtsam::Vector,PoseRTV,PoseRTV>(
89 boost::bind(VelocityConstraint::evaluateError_, _1, _2, dt_,
integration_mode_), x1, x2, 1e-5);
94 std::string a =
"VelocityConstraint: " + s;
97 case dynamics::TRAPEZOIDAL: std::cout <<
"Integration: Trapezoidal\n";
break;
98 case dynamics::EULER_START: std::cout <<
"Integration: Euler (start)\n";
break;
99 case dynamics::EULER_END: std::cout <<
"Integration: Euler (end)\n";
break;
100 default: std::cout <<
"Integration: Unknown\n" << std::endl;
break;
102 std::cout <<
"dt: " << dt_ << std::endl;
106 static gtsam::Vector evaluateError_(
const PoseRTV& x1,
const PoseRTV& x2,
109 const Velocity3& v1 = x1.v(), v2 = x2.v();
110 const Point3& p1 = x1.t(), p2 = x2.t();
113 case dynamics::TRAPEZOIDAL: hx = p1 +
Point3((v1 + v2) * dt *0.5);
break;
114 case dynamics::EULER_START: hx = p1 +
Point3(v1 * dt);
break;
115 case dynamics::EULER_END : hx = p1 +
Point3(v2 * dt);
break;
116 default: assert(
false);
break;
virtual gtsam::NonlinearFactor::shared_ptr clone() const
Definition: VelocityConstraint.h:76
This is the base class for all factor types.
Definition: Factor.h:54
A convenient base class for creating your own NoiseModelFactor with 2 variables.
Definition: NonlinearFactor.h:345
VelocityConstraint(Key key1, Key key2, const dynamics::IntegrationMode &mode, double dt, const gtsam::SharedNoiseModel &model)
Creates a constraint relating the given variables with arbitrary noise model.
Definition: VelocityConstraint.h:62
virtual void print(const std::string &s="", const KeyFormatter &keyFormatter=DefaultKeyFormatter) const
Print.
Definition: NonlinearFactor.cpp:63
Robot state for use with IMU measurements.
Definition: PoseRTV.h:23
std::uint64_t Key
Integer nonlinear key type.
Definition: types.h:57
VelocityConstraint(Key key1, Key key2, double dt, double mu=1000)
Creates a constraint relating the given variables with fully constrained noise model Uses the default...
Definition: VelocityConstraint.h:55
Vector3 Velocity3
Velocity is currently typedef'd to Vector3.
Definition: NavState.h:28
Constraint to enforce dynamics between the velocities and poses, using a prediction based on a numeri...
Definition: VelocityConstraint.h:33
IntegrationMode
controls which model to use for numerical integration to use for constraints
Definition: VelocityConstraint.h:18
dynamics::IntegrationMode integration_mode_
time difference between frames in seconds
Definition: VelocityConstraint.h:40
Pose3 with translational velocity.
boost::function< std::string(Key)> KeyFormatter
Typedef for a function to format a key, i.e. to convert it to a string.
Definition: Key.h:33
virtual void print(const std::string &s="", const gtsam::KeyFormatter &formatter=gtsam::DefaultKeyFormatter) const
Print.
Definition: VelocityConstraint.h:93
const SharedNoiseModel & noiseModel() const
access to the noise model
Definition: NonlinearFactor.h:210
Key key1() const
methods to retrieve both keys
Definition: NonlinearFactor.h:377
VelocityConstraint(Key key1, Key key2, double dt, const gtsam::SharedNoiseModel &model)
Creates a constraint relating the given variables with arbitrary noise model Uses the default Trapezo...
Definition: VelocityConstraint.h:70
Non-linear factor base classes.
VelocityConstraint(Key key1, Key key2, const dynamics::IntegrationMode &mode, double dt, double mu=1000)
Creates a constraint relating the given variables with fully constrained noise model.
Definition: VelocityConstraint.h:47
Global functions in a separate testing namespace.
Definition: chartTesting.h:28
noiseModel::Base::shared_ptr SharedNoiseModel
Note, deliberately not in noiseModel namespace.
Definition: NoiseModel.h:1072
Some functions to compute numerical derivatives.
virtual gtsam::Vector evaluateError(const PoseRTV &x1, const PoseRTV &x2, boost::optional< gtsam::Matrix & > H1=boost::none, boost::optional< gtsam::Matrix & > H2=boost::none) const
Calculates the error for trapezoidal model given.
Definition: VelocityConstraint.h:83