Skip to content

Commit 92654dd

Browse files
bijoua29AndyZenbbrooks
authored
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]>
1 parent 65aa94c commit 92654dd

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
@@ -237,6 +237,9 @@ class Servo
237237
std::atomic<double> collision_velocity_scale_ = 1.0;
238238
std::unique_ptr<CollisionMonitor> collision_monitor_;
239239

240+
// Plugin loader
241+
std::unique_ptr<pluginlib::ClassLoader<online_signal_smoothing::SmoothingBaseClass>> smoother_loader_;
242+
240243
// Pointer to the (optional) smoothing plugin.
241244
pluginlib::UniquePtr<online_signal_smoothing::SmoothingBaseClass> smoother_ = nullptr;
242245

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)