Modified the getter method in the FixedLagSmoother base class to follow general GTSAM conventions
parent
6804ef77b1
commit
f216e97a15
|
@ -314,11 +314,11 @@ int main(int argc, char** argv) {
|
||||||
cout << setprecision(5) << " Key: " << key_value.key << endl;
|
cout << setprecision(5) << " Key: " << key_value.key << endl;
|
||||||
}
|
}
|
||||||
cout << " Fixed-Lag Smoother Keys: " << endl;
|
cout << " Fixed-Lag Smoother Keys: " << endl;
|
||||||
BOOST_FOREACH(const FixedLagSmoother::KeyTimestampMap::value_type& key_timestamp, fixedlagSmoother.getTimestamps()) {
|
BOOST_FOREACH(const FixedLagSmoother::KeyTimestampMap::value_type& key_timestamp, fixedlagSmoother.timestamps()) {
|
||||||
cout << setprecision(5) << " Key: " << key_timestamp.first << endl;
|
cout << setprecision(5) << " Key: " << key_timestamp.first << endl;
|
||||||
}
|
}
|
||||||
cout << " Batch Smoother Keys: " << endl;
|
cout << " Batch Smoother Keys: " << endl;
|
||||||
BOOST_FOREACH(const FixedLagSmoother::KeyTimestampMap::value_type& key_timestamp, batchSmoother.getTimestamps()) {
|
BOOST_FOREACH(const FixedLagSmoother::KeyTimestampMap::value_type& key_timestamp, batchSmoother.timestamps()) {
|
||||||
cout << setprecision(5) << " Key: " << key_timestamp.first << endl;
|
cout << setprecision(5) << " Key: " << key_timestamp.first << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,11 +127,11 @@ int main(int argc, char** argv) {
|
||||||
// And to demonstrate the fixed-lag aspect, print the keys contained in each smoother after 3.0 seconds
|
// And to demonstrate the fixed-lag aspect, print the keys contained in each smoother after 3.0 seconds
|
||||||
cout << "After 3.0 seconds, " << endl;
|
cout << "After 3.0 seconds, " << endl;
|
||||||
cout << " Batch Smoother Keys: " << endl;
|
cout << " Batch Smoother Keys: " << endl;
|
||||||
BOOST_FOREACH(const FixedLagSmoother::KeyTimestampMap::value_type& key_timestamp, smootherBatch.getTimestamps()) {
|
BOOST_FOREACH(const FixedLagSmoother::KeyTimestampMap::value_type& key_timestamp, smootherBatch.timestamps()) {
|
||||||
cout << setprecision(5) << " Key: " << key_timestamp.first << " Time: " << key_timestamp.second << endl;
|
cout << setprecision(5) << " Key: " << key_timestamp.first << " Time: " << key_timestamp.second << endl;
|
||||||
}
|
}
|
||||||
cout << " iSAM2 Smoother Keys: " << endl;
|
cout << " iSAM2 Smoother Keys: " << endl;
|
||||||
BOOST_FOREACH(const FixedLagSmoother::KeyTimestampMap::value_type& key_timestamp, smootherISAM2.getTimestamps()) {
|
BOOST_FOREACH(const FixedLagSmoother::KeyTimestampMap::value_type& key_timestamp, smootherISAM2.timestamps()) {
|
||||||
cout << setprecision(5) << " Key: " << key_timestamp.first << " Time: " << key_timestamp.second << endl;
|
cout << setprecision(5) << " Key: " << key_timestamp.first << " Time: " << key_timestamp.second << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,12 @@ public:
|
||||||
size_t linearVariables; ///< The number of variables that must keep a constant linearization point
|
size_t linearVariables; ///< The number of variables that must keep a constant linearization point
|
||||||
double error; ///< The final factor graph error
|
double error; ///< The final factor graph error
|
||||||
Result() : iterations(0), nonlinearVariables(0), linearVariables(0), error(0) {};
|
Result() : iterations(0), nonlinearVariables(0), linearVariables(0), error(0) {};
|
||||||
|
|
||||||
|
/// Getter methods
|
||||||
|
size_t getIterations() const { return iterations; }
|
||||||
|
size_t getNonlinearVariables() const { return nonlinearVariables; }
|
||||||
|
size_t getLinearVariables() const { return linearVariables; }
|
||||||
|
double getError() const { return error; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -64,21 +70,6 @@ public:
|
||||||
/** Check if two IncrementalFixedLagSmoother Objects are equal */
|
/** Check if two IncrementalFixedLagSmoother Objects are equal */
|
||||||
virtual bool equals(const FixedLagSmoother& rhs, double tol = 1e-9) const;
|
virtual bool equals(const FixedLagSmoother& rhs, double tol = 1e-9) const;
|
||||||
|
|
||||||
/** Add new factors, updating the solution and relinearizing as needed. */
|
|
||||||
virtual Result update(const NonlinearFactorGraph& newFactors = NonlinearFactorGraph(), const Values& newTheta = Values(),
|
|
||||||
const KeyTimestampMap& timestamps = KeyTimestampMap()) = 0;
|
|
||||||
|
|
||||||
/** Access the current set of timestamps associated with each variable */
|
|
||||||
const KeyTimestampMap& getTimestamps() const {
|
|
||||||
return keyTimestampMap_;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Compute an estimate from the incomplete linear delta computed during the last update.
|
|
||||||
* This delta is incomplete because it was not updated below wildfire_threshold. If only
|
|
||||||
* a single variable is needed, it is faster to call calculateEstimate(const KEY&).
|
|
||||||
*/
|
|
||||||
virtual Values calculateEstimate() const = 0;
|
|
||||||
|
|
||||||
/** read the current smoother lag */
|
/** read the current smoother lag */
|
||||||
double smootherLag() const {
|
double smootherLag() const {
|
||||||
return smootherLag_;
|
return smootherLag_;
|
||||||
|
@ -89,6 +80,21 @@ public:
|
||||||
return smootherLag_;
|
return smootherLag_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Access the current set of timestamps associated with each variable */
|
||||||
|
const KeyTimestampMap& timestamps() const {
|
||||||
|
return keyTimestampMap_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Add new factors, updating the solution and relinearizing as needed. */
|
||||||
|
virtual Result update(const NonlinearFactorGraph& newFactors = NonlinearFactorGraph(), const Values& newTheta = Values(),
|
||||||
|
const KeyTimestampMap& timestamps = KeyTimestampMap()) = 0;
|
||||||
|
|
||||||
|
/** Compute an estimate from the incomplete linear delta computed during the last update.
|
||||||
|
* This delta is incomplete because it was not updated below wildfire_threshold. If only
|
||||||
|
* a single variable is needed, it is faster to call calculateEstimate(const KEY&).
|
||||||
|
*/
|
||||||
|
virtual Values calculateEstimate() const = 0;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -116,4 +122,8 @@ protected:
|
||||||
|
|
||||||
}; // FixedLagSmoother
|
}; // FixedLagSmoother
|
||||||
|
|
||||||
|
/// Typedef for matlab wrapping
|
||||||
|
typedef FixedLagSmoother::KeyTimestampMap FixedLagSmootherKeyTimestampMap;
|
||||||
|
typedef FixedLagSmoother::Result FixedLagSmootherResult;
|
||||||
|
|
||||||
} /// namespace gtsam
|
} /// namespace gtsam
|
||||||
|
|
Loading…
Reference in New Issue