Skip to content

Commit

Permalink
Modified the plugin start/stop order, moving the sensors last
Browse files Browse the repository at this point in the history
  • Loading branch information
svwilliams committed Aug 2, 2024
1 parent bbac22e commit d99d41f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
5 changes: 3 additions & 2 deletions fuse_optimizers/src/fixed_lag_smoother.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,7 @@ void FixedLagSmoother::processQueue(fuse_core::Transaction& transaction, const r

bool FixedLagSmoother::resetServiceCallback(std_srvs::Empty::Request&, std_srvs::Empty::Response&)
{
ROS_INFO_STREAM("Resetting optimizer.");
stop();
start();

Expand Down Expand Up @@ -469,7 +470,7 @@ void FixedLagSmoother::start()
startPlugins();
// Test for auto-start
autostart();
ROS_INFO_STREAM("Starting optimizer complete.");
ROS_INFO_STREAM("Started optimizer.");
}

void FixedLagSmoother::stop()
Expand Down Expand Up @@ -501,7 +502,7 @@ void FixedLagSmoother::stop()
timestamp_tracking_.clear();
lag_expiration_ = ros::Time(0, 0);
}
ROS_INFO_STREAM("Optimizer stopping complete.");
ROS_INFO_STREAM("Stopped Optimizer.");
}

void FixedLagSmoother::transactionCallback(
Expand Down
16 changes: 8 additions & 8 deletions fuse_optimizers/src/optimizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ void Optimizer::clearCallbacks()

void Optimizer::startPlugins()
{
for (const auto& name_plugin : publishers_)
{
name_plugin.second->start();
}
for (const auto& name_plugin : motion_models_)
{
name_plugin.second->start();
Expand All @@ -445,20 +449,12 @@ void Optimizer::startPlugins()
{
name_plugin.second.model->start();
}
for (const auto& name_plugin : publishers_)
{
name_plugin.second->start();
}

diagnostic_updater_.force_update();
}

void Optimizer::stopPlugins()
{
for (const auto& name_plugin : publishers_)
{
name_plugin.second->stop();
}
for (const auto& name_plugin : sensor_models_)
{
name_plugin.second.model->stop();
Expand All @@ -467,6 +463,10 @@ void Optimizer::stopPlugins()
{
name_plugin.second->stop();
}
for (const auto& name_plugin : publishers_)
{
name_plugin.second->stop();
}

diagnostic_updater_.force_update();
}
Expand Down

0 comments on commit d99d41f

Please sign in to comment.