5050
5151namespace fuse_optimizers
5252{
53- <<<<<<< HEAD
54-
55- FixedLagSmoother::FixedLagSmoother (
56- fuse_core::Graph::UniquePtr graph,
57- const ParameterType::SharedPtr ¶ms,
58- const ros::NodeHandle &node_handle,
59- const ros::NodeHandle &private_node_handle) : fuse_optimizers::WindowedOptimizer(std::move(graph), params, node_handle, private_node_handle),
60- params_ (params)
53+ FixedLagSmoother::FixedLagSmoother (fuse_core::Graph::UniquePtr graph, const ParameterType::SharedPtr ¶ms,
54+ const ros::NodeHandle &node_handle, const ros::NodeHandle &private_node_handle)
55+ : fuse_optimizers::WindowedOptimizer(std::move(graph), params, node_handle, private_node_handle), params_(params)
6156 {
6257 }
63- =======
64- FixedLagSmoother::FixedLagSmoother (fuse_core::Graph::UniquePtr graph, const ParameterType::SharedPtr& params,
65- const ros::NodeHandle& node_handle, const ros::NodeHandle& private_node_handle)
66- : fuse_optimizers::WindowedOptimizer(std::move(graph), params, node_handle, private_node_handle), params_(params)
67- {
68- }
6958
70- FixedLagSmoother::FixedLagSmoother (fuse_core::Graph::UniquePtr graph, const ros::NodeHandle& node_handle,
71- const ros::NodeHandle& private_node_handle)
72- : FixedLagSmoother::FixedLagSmoother(
73- std::move (graph), ParameterType::make_shared(fuse_core::loadFromROS<ParameterType>(private_node_handle)),
74- node_handle, private_node_handle)
75- {
76- }
77- >>>>>>> Address PR comments
59+ FixedLagSmoother::FixedLagSmoother (fuse_core::Graph::UniquePtr graph, const ros::NodeHandle &node_handle,
60+ const ros::NodeHandle &private_node_handle)
61+ : FixedLagSmoother::FixedLagSmoother(
62+ std::move (graph), ParameterType::make_shared(fuse_core::loadFromROS<ParameterType>(private_node_handle)),
63+ node_handle, private_node_handle)
64+ {
65+ }
7866
7967 FixedLagSmoother::FixedLagSmoother (
8068 fuse_core::Graph::UniquePtr graph,
@@ -92,66 +80,53 @@ FixedLagSmoother::FixedLagSmoother(fuse_core::Graph::UniquePtr graph, const ros:
9280 timestamp_tracking_.addNewTransaction (new_transaction);
9381 }
9482
95- <<<<<<< HEAD
96- std::vector<fuse_core::UUID> FixedLagSmoother::computeVariablesToMarginalize ()
97- {
98- // Find the most recent variable timestamp, then carefully subtract the lag duration.
99- // ROS Time objects do not handle negative values.
100- auto start_time = getStartTime ();
101- =======
10283 std::lock_guard<std::mutex> lock (mutex_);
10384 auto now = timestamp_tracking_[timestamp_tracking_.numStates() - 1 ];
10485 lag_expiration_ = (start_time + params_->lag_duration < now) ? now - params_->lag_duration : start_time;
10586 auto marginalize_variable_uuids = std::vector<fuse_core::UUID>();
10687 timestamp_tracking_.query(lag_expiration_, std::back_inserter(marginalize_variable_uuids));
10788 return marginalize_variable_uuids;
10889}
109- >>>>>>> Address PR comments
11090
111- std::lock_guard<std::mutex> lock (mutex_);
112- auto now = timestamp_tracking_.currentStamp();
113- lag_expiration_ = (start_time + params_->lag_duration < now) ? now - params_->lag_duration : start_time;
114- auto marginalize_variable_uuids = std::vector<fuse_core::UUID>();
115- timestamp_tracking_.query(lag_expiration_, std::back_inserter(marginalize_variable_uuids));
116- return marginalize_variable_uuids;
117- }
91+ std::lock_guard<std::mutex> lock (mutex_);
92+ auto now = timestamp_tracking_.currentStamp();
93+ lag_expiration_ = (start_time + params_->lag_duration < now) ? now - params_->lag_duration : start_time;
94+ auto marginalize_variable_uuids = std::vector<fuse_core::UUID>();
95+ timestamp_tracking_.query(lag_expiration_, std::back_inserter(marginalize_variable_uuids));
96+ return marginalize_variable_uuids;
97+ }
11898
119- void FixedLagSmoother::postprocessMarginalization (const fuse_core::Transaction &marginal_transaction)
120- {
121- <<<<<<< HEAD
122- std::lock_guard<std::mutex> lock (mutex_);
123- timestamp_tracking_.addMarginalTransaction (marginal_transaction);
124- =======
125- ROS_DEBUG_STREAM (" The current lag expiration time is "
126- << lag_expiration_ << " . The queued transaction with timestamp " << transaction.stamp ()
127- << " from sensor " << sensor_name << " has a minimum involved timestamp of " << min_stamp
128- << " , which is " << (lag_expiration_ - min_stamp)
129- << " seconds too old. Ignoring this transaction." );
130- return false ;
131- >>>>>>> Address PR comments
132- }
99+ void FixedLagSmoother::postprocessMarginalization (const fuse_core::Transaction &marginal_transaction)
100+ {
101+ ROS_DEBUG_STREAM (" The current lag expiration time is "
102+ << lag_expiration_ << " . The queued transaction with timestamp " << transaction.stamp ()
103+ << " from sensor " << sensor_name << " has a minimum involved timestamp of " << min_stamp
104+ << " , which is " << (lag_expiration_ - min_stamp)
105+ << " seconds too old. Ignoring this transaction." );
106+ return false ;
107+ }
133108
134- bool FixedLagSmoother::validateTransaction (const std::string &sensor_name, const fuse_core::Transaction &transaction)
109+ bool FixedLagSmoother::validateTransaction (const std::string &sensor_name, const fuse_core::Transaction &transaction)
110+ {
111+ auto min_stamp = transaction.minStamp ();
112+ std::lock_guard<std::mutex> lock (mutex_);
113+ if (min_stamp < lag_expiration_)
135114 {
136- auto min_stamp = transaction.minStamp ();
137- std::lock_guard<std::mutex> lock (mutex_);
138- if (min_stamp < lag_expiration_)
139- {
140- ROS_DEBUG_STREAM (
141- " The current lag expiration time is "
142- << lag_expiration_ << " . The queued transaction with timestamp " << transaction.stamp () << " from sensor "
143- << sensor_name << " has a minimum involved timestamp of " << min_stamp << " , which is "
144- << (lag_expiration_ - min_stamp) << " seconds too old. Ignoring this transaction." );
145- return false ;
146- }
147- return true ;
115+ ROS_DEBUG_STREAM (
116+ " The current lag expiration time is "
117+ << lag_expiration_ << " . The queued transaction with timestamp " << transaction.stamp () << " from sensor "
118+ << sensor_name << " has a minimum involved timestamp of " << min_stamp << " , which is "
119+ << (lag_expiration_ - min_stamp) << " seconds too old. Ignoring this transaction." );
120+ return false ;
148121 }
122+ return true ;
123+ }
149124
150- void FixedLagSmoother::onReset ()
151- {
152- std::lock_guard<std::mutex> lock (mutex_);
153- timestamp_tracking_.clear ();
154- lag_expiration_ = ros::Time (0 , 0 );
155- }
125+ void FixedLagSmoother::onReset ()
126+ {
127+ std::lock_guard<std::mutex> lock (mutex_);
128+ timestamp_tracking_.clear ();
129+ lag_expiration_ = ros::Time (0 , 0 );
130+ }
156131
157132} // namespace fuse_optimizers
0 commit comments