2 GTSAM Copyright 2010-2018, Georgia Tech Research Corporation, 3 Atlanta, Georgia 30332-0415 5 Authors: Frank Dellaert, et al. (see THANKS for the full author list) 7 See LICENSE for the license information 9 Demonstration of the fixed-lag smoothers using a planar robot example 10 and multiple odometry-like sensors 11 Author: Frank Dellaert (C++), Jeremy Aguilon (Python) 21 Runs a batch fixed smoother on an agent with two odometry 22 sensors that is simply moving to the 28 smoother_batch = gtsam_unstable.BatchFixedLagSmoother(lag)
34 new_timestamps = gtsam_unstable.FixedLagSmootherKeyTimestampMap()
40 new_factors.push_back(gtsam.PriorFactorPose2(X1, prior_mean, prior_noise))
41 new_values.insert(X1, prior_mean)
42 new_timestamps.insert((X1, 0.0))
48 previous_key =
int(1000 * (time - delta_time))
49 current_key =
int(1000 * time)
52 new_timestamps.insert((current_key, time))
57 new_values.insert(current_key, current_pose)
61 odometry_measurement_1 =
gtsam.Pose2(0.61, -0.08, 0.02)
63 np.array([0.1, 0.1, 0.05]))
64 new_factors.push_back(gtsam.BetweenFactorPose2(
65 previous_key, current_key, odometry_measurement_1, odometry_noise_1
68 odometry_measurement_2 =
gtsam.Pose2(0.47, 0.03, 0.01)
70 np.array([0.05, 0.05, 0.05]))
71 new_factors.push_back(gtsam.BetweenFactorPose2(
72 previous_key, current_key, odometry_measurement_2, odometry_noise_2
79 smoother_batch.update(new_factors, new_values, new_timestamps)
80 print(
"Timestamp = " +
str(time) +
", Key = " +
str(current_key))
81 print(smoother_batch.calculateEstimatePose2(current_key))
83 new_timestamps.clear()
90 if __name__ ==
'__main__':
92 print(
"Example complete")
void print(const Matrix &A, const string &s, ostream &stream)
def BatchFixedLagSmootherExample()
static shared_ptr Sigmas(const Vector &sigmas, bool smart=true)