55 using namespace gtsam;
58 int main(
int argc,
char** argv) {
82 newFactors.
addPrior(priorKey, priorMean, priorNoise);
83 newValues.
insert(priorKey, priorMean);
84 newTimestamps[priorKey] = 0.0;
92 Key previousKey(1000 * (
time-deltaT));
96 newTimestamps[currentKey] =
time;
102 newValues.
insert(currentKey, currentPose);
105 Pose2 odometryMeasurement1 =
Pose2(0.61, -0.08, 0.02);
109 Pose2 odometryMeasurement2 =
Pose2(0.47, 0.03, 0.01);
117 smootherBatch.
update(newFactors, newValues, newTimestamps);
118 smootherISAM2.
update(newFactors, newValues, newTimestamps);
119 for(
size_t i = 1;
i < 2; ++
i) {
124 cout << setprecision(5) <<
"Timestamp = " <<
time << endl;
130 newTimestamps.clear();
137 cout <<
"After 3.0 seconds, " << endl;
138 cout <<
" Batch Smoother Keys: " << endl;
139 for(
const FixedLagSmoother::KeyTimestampMap::value_type& key_timestamp: smootherBatch.
timestamps()) {
140 cout << setprecision(5) <<
" Key: " << key_timestamp.first <<
" Time: " << key_timestamp.second << endl;
142 cout <<
" iSAM2 Smoother Keys: " << endl;
143 for(
const FixedLagSmoother::KeyTimestampMap::value_type& key_timestamp: smootherISAM2.
timestamps()) {
144 cout << setprecision(5) <<
" Key: " << key_timestamp.first <<
" Time: " << key_timestamp.second << endl;
152 auto &factorGraph = smootherISAM2.
getFactors();
155 std::shared_ptr<GaussianFactorGraph> linearGraph = factorGraph.
linearize(result);
158 Matrix jacobian = linearGraph->jacobian().first;
159 cout <<
" Jacobian: " << jacobian << endl;
Result update(const NonlinearFactorGraph &newFactors=NonlinearFactorGraph(), const Values &newTheta=Values(), const KeyTimestampMap ×tamps=KeyTimestampMap(), const FactorIndices &factorsToRemove=FactorIndices()) override
std::map< Key, double > KeyTimestampMap
Typedef for a Key-Timestamp map/database.
A non-templated config holding any types of Manifold-group elements.
Factor Graph consisting of non-linear factors.
IsDerived< DERIVEDFACTOR > push_back(std::shared_ptr< DERIVEDFACTOR > factor)
Add a factor directly using a shared_ptr.
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)
Values calculateEstimate() const override
std::shared_ptr< GaussianFactorGraph > linearize(const Values &linearizationPoint) const
Linearize a nonlinear factor graph.
void addPrior(Key key, const T &prior, const SharedNoiseModel &model=nullptr)
Result update(const NonlinearFactorGraph &newFactors=NonlinearFactorGraph(), const Values &newTheta=Values(), const KeyTimestampMap ×tamps=KeyTimestampMap(), const FactorIndices &factorsToRemove=FactorIndices()) override
int main(int argc, char **argv)
const NonlinearFactorGraph & getFactors() const
An iSAM2-based fixed-lag smoother.
static const double deltaT
Pose2 priorMean(0.0, 0.0, 0.0)
static ConjugateGradientParameters parameters
RelinearizationThreshold relinearizeThreshold
const KeyTimestampMap & timestamps() const
virtual void resize(size_t size)
Values calculateEstimate() const override
void insert(Key j, const Value &val)
std::shared_ptr< Diagonal > shared_ptr
std::uint64_t Key
Integer nonlinear key type.