Skip to content

Commit 64fe3a5

Browse files
bijoua29AndyZenbbrooks
authored andcommitted
Fix severe warning from class loader in servo (#3577)
* Add class loader member variable instead of creating on stack * Fix formatting to satisfy clang --------- Co-authored-by: AndyZe <[email protected]> Co-authored-by: Nathan Brooks <[email protected]> (cherry picked from commit 92654dd)
1 parent e489b04 commit 64fe3a5

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

moveit_ros/moveit_servo/include/moveit_servo/servo.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,9 @@ class Servo
229229
std::atomic<double> collision_velocity_scale_ = 1.0;
230230
std::unique_ptr<CollisionMonitor> collision_monitor_;
231231

232+
// Plugin loader
233+
std::unique_ptr<pluginlib::ClassLoader<online_signal_smoothing::SmoothingBaseClass>> smoother_loader_;
234+
232235
// Pointer to the (optional) smoothing plugin.
233236
pluginlib::UniquePtr<online_signal_smoothing::SmoothingBaseClass> smoother_ = nullptr;
234237

moveit_ros/moveit_servo/src/servo.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,9 @@ void Servo::setSmoothingPlugin()
139139
// Load the smoothing plugin
140140
try
141141
{
142-
pluginlib::ClassLoader<online_signal_smoothing::SmoothingBaseClass> smoothing_loader(
142+
smoother_loader_ = std::make_unique<pluginlib::ClassLoader<online_signal_smoothing::SmoothingBaseClass>>(
143143
"moveit_core", "online_signal_smoothing::SmoothingBaseClass");
144-
smoother_ = smoothing_loader.createUniqueInstance(servo_params_.smoothing_filter_plugin_name);
144+
smoother_ = smoother_loader_->createUniqueInstance(servo_params_.smoothing_filter_plugin_name);
145145
}
146146
catch (pluginlib::PluginlibException& ex)
147147
{

0 commit comments

Comments
 (0)