@@ -120,29 +120,30 @@ static bool getWheelRadius(
120120
121121namespace diff_drive_controller
122122{
123+ const DiffDriveControllerConfig DiffDriveController::config_default_ = DiffDriveControllerConfig::__getDefault__();
123124
124125 DiffDriveController::DiffDriveController ()
125126 : open_loop_(false )
126- , pose_from_joint_position_(true )
127- , twist_from_joint_position_(false )
127+ , pose_from_joint_position_(config_default_.pose_from_joint_position )
128+ , twist_from_joint_position_(config_default_.twist_from_joint_position )
128129 , command_struct_()
129130 , dynamic_params_struct_()
130131 , wheel_separation_(0.0 )
131132 , wheel_radius_(0.0 )
132- , wheel_separation_multiplier_(1.0 )
133- , left_wheel_radius_multiplier_(1.0 )
134- , right_wheel_radius_multiplier_(1.0 )
135- , k_l_(0.01 )
136- , k_r_(0.01 )
137- , wheel_resolution_(0.0 )
133+ , wheel_separation_multiplier_(config_default_.wheel_separation_multiplier )
134+ , left_wheel_radius_multiplier_(config_default_.left_wheel_radius_multiplier )
135+ , right_wheel_radius_multiplier_(config_default_.right_wheel_radius_multiplier )
136+ , k_l_(config_default_.k_l )
137+ , k_r_(config_default_.k_r )
138+ , wheel_resolution_(config_default_.wheel_resolution )
138139 , cmd_vel_timeout_(0.5 )
139140 , base_frame_id_(" base_link" )
140141 , enable_odom_tf_(true )
141142 , wheel_joints_size_(0 )
142- , publish_cmd_vel_limited_(false )
143- , publish_state_(false )
144- , control_frequency_desired_(0.0 )
145- , control_period_desired_(0.0 )
143+ , publish_cmd_vel_limited_(config_default_.publish_cmd_vel_limited )
144+ , publish_state_(config_default_.publish_state )
145+ , control_frequency_desired_(config_default_.control_frequency_desired )
146+ , control_period_desired_(1.0 / control_frequency_desired_ )
146147 {
147148 }
148149
@@ -370,8 +371,29 @@ namespace diff_drive_controller
370371
371372 setOdomPubFields (root_nh, controller_nh);
372373
373- // Set dynamic reconfigure server callback:
374+ // Set dynamic reconfigure params defaults to the static params provided:
375+ DiffDriveControllerConfig config;
376+ config.pose_from_joint_position = pose_from_joint_position_;
377+ config.twist_from_joint_position = twist_from_joint_position_;
378+
379+ config.wheel_separation_multiplier = wheel_separation_multiplier_;
380+
381+ config.left_wheel_radius_multiplier = left_wheel_radius_multiplier_;
382+ config.right_wheel_radius_multiplier = right_wheel_radius_multiplier_;
383+
384+ config.k_l = k_l_;
385+ config.k_r = k_r_;
386+
387+ config.wheel_resolution = wheel_resolution_;
388+
389+ config.publish_state = publish_state_;
390+ config.publish_cmd_vel_limited = publish_cmd_vel_limited_;
391+
392+ dynamic_params_struct_.control_frequency_desired = config.control_frequency_desired ;
393+
394+ // Set dynamic reconfigure server config and callback:
374395 cfg_server_.reset (new ReconfigureServer (controller_nh));
396+ cfg_server_->updateConfig (config);
375397 cfg_server_->setCallback (
376398 boost::bind (&DiffDriveController::reconfigureCallback, this , _1, _2));
377399
0 commit comments