Skip to content

Commit 2c709db

Browse files
committed
Add ability to leave the fixed-lag smoother stopped on construction
1 parent 89be2bc commit 2c709db

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

fuse_optimizers/include/fuse_optimizers/fixed_lag_smoother_params.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ namespace fuse_optimizers
5555
struct FixedLagSmootherParams
5656
{
5757
public:
58+
/**
59+
* @brief If true, the state estimator will not start until the start or reset service is called
60+
*/
61+
bool disabled_at_startup { false };
62+
5863
/**
5964
* @brief The duration of the smoothing window in seconds
6065
*/
@@ -105,6 +110,8 @@ struct FixedLagSmootherParams
105110
void loadFromROS(const ros::NodeHandle& nh)
106111
{
107112
// Read settings from the parameter server
113+
nh.getParam("disabled_at_startup", disabled_at_startup);
114+
108115
fuse_core::getPositiveParam(nh, "lag_duration", lag_duration);
109116

110117
if (nh.hasParam("optimization_frequency"))

fuse_optimizers/src/batch_optimizer.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ BatchOptimizer::BatchOptimizer(
8282
ros::names::resolve(params_.start_service),
8383
&BatchOptimizer::startServiceCallback,
8484
this);
85+
86+
startPlugins();
8587
}
8688

8789
BatchOptimizer::~BatchOptimizer()

fuse_optimizers/src/fixed_lag_smoother.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,6 @@ FixedLagSmoother::FixedLagSmoother(
9090
{
9191
params_.loadFromROS(private_node_handle);
9292

93-
// Test for auto-start
94-
autostart();
95-
9693
// Start the optimization thread
9794
optimization_thread_ = std::thread(&FixedLagSmoother::optimizationLoop, this);
9895

@@ -117,6 +114,11 @@ FixedLagSmoother::FixedLagSmoother(
117114
ros::names::resolve(params_.start_service),
118115
&FixedLagSmoother::startServiceCallback,
119116
this);
117+
118+
if (!params_.disabled_at_startup)
119+
{
120+
start();
121+
}
120122
}
121123

122124
FixedLagSmoother::~FixedLagSmoother()

fuse_optimizers/src/optimizer.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ Optimizer::Optimizer(
109109
loadMotionModels();
110110
loadSensorModels();
111111
loadPublishers();
112-
113-
// Start all the plugins
114-
startPlugins();
115112
}
116113

117114
Optimizer::~Optimizer()

0 commit comments

Comments
 (0)