50
50
51
51
namespace fuse_optimizers
52
52
{
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)
61
56
{
62
57
}
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
- }
69
58
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
+ }
78
66
79
67
FixedLagSmoother::FixedLagSmoother (
80
68
fuse_core::Graph::UniquePtr graph,
@@ -92,66 +80,53 @@ FixedLagSmoother::FixedLagSmoother(fuse_core::Graph::UniquePtr graph, const ros:
92
80
timestamp_tracking_.addNewTransaction (new_transaction);
93
81
}
94
82
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
- =======
102
83
std::lock_guard<std::mutex> lock (mutex_);
103
84
auto now = timestamp_tracking_[timestamp_tracking_.numStates() - 1 ];
104
85
lag_expiration_ = (start_time + params_->lag_duration < now) ? now - params_->lag_duration : start_time;
105
86
auto marginalize_variable_uuids = std::vector<fuse_core::UUID>();
106
87
timestamp_tracking_.query(lag_expiration_, std::back_inserter(marginalize_variable_uuids));
107
88
return marginalize_variable_uuids;
108
89
}
109
- >>>>>>> Address PR comments
110
90
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
+ }
118
98
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
+ }
133
108
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_)
135
114
{
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 ;
148
121
}
122
+ return true ;
123
+ }
149
124
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
+ }
156
131
157
132
} // namespace fuse_optimizers
0 commit comments