Skip to content

Commit

Permalink
Detect backwards time in an outer loop, remake the entire node instea…
Browse files Browse the repository at this point in the history
…d of using reset
  • Loading branch information
lucasw committed Nov 25, 2021
1 parent f368a28 commit 5d43eb2
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions fuse_optimizers/src/fixed_lag_smoother_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,23 @@ int main(int argc, char **argv)
ros::NodeHandle private_node_handle("~");
fuse_graphs::HashGraphParams hash_graph_params;
hash_graph_params.loadFromROS(private_node_handle);
fuse_optimizers::FixedLagSmoother optimizer(fuse_graphs::HashGraph::make_unique(hash_graph_params));
ros::spin();

while (ros::ok()) {
fuse_optimizers::FixedLagSmoother optimizer(fuse_graphs::HashGraph::make_unique(hash_graph_params));
ros::Time last_update_time = ros::Time::now();
while (ros::ok())
{
const ros::Time update_time = ros::Time::now();
if (update_time < last_update_time) {
ROS_WARN_STREAM("time went backwards, restarting fixed lag smoother");
break;
}
// TODO(lucasw) what should be the sleep duration here?
ros::Duration(0.025).sleep();
ros::spinOnce();
last_update_time = update_time;
}
}

return 0;
}

0 comments on commit 5d43eb2

Please sign in to comment.