@@ -183,6 +183,7 @@ AdmittanceController::on_configure(const rclcpp_lifecycle::State & /*previous_st
183183
184184controller_interface::CallbackReturn
185185AdmittanceController::on_activate (const rclcpp_lifecycle::State & /* previous_state*/ ) {
186+ initialized_ = false ;
186187 if (!assign_state_interfaces_ ()) {
187188 release_state_interfaces_ ();
188189 return controller_interface::CallbackReturn::ERROR;
@@ -256,12 +257,12 @@ void AdmittanceController::configure_joint_names_() {
256257 if (joint_names_.size () != lbr_fri_ros2::N_JNTS) {
257258 RCLCPP_ERROR (
258259 this ->get_node ()->get_logger (),
259- " Number of joint names ( %ld) does not match the number of joints in the robot (%d) ." ,
260+ " Number of joint names ' %ld' does not match the number of joints in the robot '%d' ." ,
260261 joint_names_.size (), lbr_fri_ros2::N_JNTS);
261262 throw std::runtime_error (" Failed to configure joint names." );
262263 }
263264 std::string robot_name = this ->get_node ()->get_parameter (" robot_name" ).as_string ();
264- for (int i = 0 ; i < lbr_fri_ros2::N_JNTS; ++i) {
265+ for (std:: size_t i = 0 ; i < lbr_fri_ros2::N_JNTS; ++i) {
265266 joint_names_[i] = robot_name + " _A" + std::to_string (i + 1 );
266267 }
267268}
@@ -270,8 +271,8 @@ void AdmittanceController::configure_admittance_impl_() {
270271 if (this ->get_node ()->get_parameter (" admittance.mass" ).as_double_array ().size () !=
271272 lbr_fri_ros2::CARTESIAN_DOF) {
272273 RCLCPP_ERROR (this ->get_node ()->get_logger (),
273- " Number of mass values ( %ld) does not match the number of cartesian degrees of "
274- " freedom (%d) ." ,
274+ " Number of mass values ' %ld' does not match the number of cartesian degrees of "
275+ " freedom '%d' ." ,
275276 this ->get_node ()->get_parameter (" admittance.mass" ).as_double_array ().size (),
276277 lbr_fri_ros2::CARTESIAN_DOF);
277278 throw std::runtime_error (" Failed to configure admittance parameters." );
@@ -280,32 +281,32 @@ void AdmittanceController::configure_admittance_impl_() {
280281 lbr_fri_ros2::CARTESIAN_DOF) {
281282 RCLCPP_ERROR (
282283 this ->get_node ()->get_logger (),
283- " Number of damping values ( %ld) does not match the number of cartesian degrees of freedom "
284- " (%d) ." ,
284+ " Number of damping values ' %ld' does not match the number of cartesian degrees of freedom "
285+ " '%d' ." ,
285286 this ->get_node ()->get_parameter (" admittance.damping" ).as_double_array ().size (),
286287 lbr_fri_ros2::CARTESIAN_DOF);
287288 throw std::runtime_error (" Failed to configure admittance parameters." );
288289 }
289290 if (this ->get_node ()->get_parameter (" admittance.stiffness" ).as_double_array ().size () !=
290291 lbr_fri_ros2::CARTESIAN_DOF) {
291292 RCLCPP_ERROR (this ->get_node ()->get_logger (),
292- " Number of stiffness values ( %ld) does not match the number of cartesian degrees "
293+ " Number of stiffness values ' %ld' does not match the number of cartesian degrees "
293294 " of freedom "
294- " (%d) ." ,
295+ " '%d' ." ,
295296 this ->get_node ()->get_parameter (" admittance.stiffness" ).as_double_array ().size (),
296297 lbr_fri_ros2::CARTESIAN_DOF);
297298 throw std::runtime_error (" Failed to configure admittance parameters." );
298299 }
299300 lbr_fri_ros2::cart_array_t mass_array;
300- for (unsigned int i = 0 ; i < lbr_fri_ros2::CARTESIAN_DOF; ++i) {
301+ for (std:: size_t i = 0 ; i < lbr_fri_ros2::CARTESIAN_DOF; ++i) {
301302 mass_array[i] = this ->get_node ()->get_parameter (" admittance.mass" ).as_double_array ()[i];
302303 }
303304 lbr_fri_ros2::cart_array_t damping_array;
304- for (unsigned int i = 0 ; i < lbr_fri_ros2::CARTESIAN_DOF; ++i) {
305+ for (std:: size_t i = 0 ; i < lbr_fri_ros2::CARTESIAN_DOF; ++i) {
305306 damping_array[i] = this ->get_node ()->get_parameter (" admittance.damping" ).as_double_array ()[i];
306307 }
307308 lbr_fri_ros2::cart_array_t stiffness_array;
308- for (unsigned int i = 0 ; i < lbr_fri_ros2::CARTESIAN_DOF; ++i) {
309+ for (std:: size_t i = 0 ; i < lbr_fri_ros2::CARTESIAN_DOF; ++i) {
309310 stiffness_array[i] =
310311 this ->get_node ()->get_parameter (" admittance.stiffness" ).as_double_array ()[i];
311312 }
@@ -318,7 +319,7 @@ void AdmittanceController::configure_inv_jac_ctrl_impl_() {
318319 lbr_fri_ros2::N_JNTS) {
319320 RCLCPP_ERROR (
320321 this ->get_node ()->get_logger (),
321- " Number of joint gains ( %ld) does not match the number of joints in the robot (%d) ." ,
322+ " Number of joint gains ' %ld' does not match the number of joints in the robot '%d' ." ,
322323 this ->get_node ()->get_parameter (" inv_jac_ctrl.joint_gains" ).as_double_array ().size (),
323324 lbr_fri_ros2::N_JNTS);
324325 throw std::runtime_error (" Failed to configure joint gains." );
@@ -327,19 +328,19 @@ void AdmittanceController::configure_inv_jac_ctrl_impl_() {
327328 lbr_fri_ros2::CARTESIAN_DOF) {
328329 RCLCPP_ERROR (
329330 this ->get_node ()->get_logger (),
330- " Number of cartesian gains ( %ld) does not match the number of cartesian degrees of freedom "
331- " (%d) ." ,
331+ " Number of cartesian gains ' %ld' does not match the number of cartesian degrees of freedom "
332+ " '%d' ." ,
332333 this ->get_node ()->get_parameter (" inv_jac_ctrl.cartesian_gains" ).as_double_array ().size (),
333334 lbr_fri_ros2::CARTESIAN_DOF);
334335 throw std::runtime_error (" Failed to configure cartesian gains." );
335336 }
336337 lbr_fri_ros2::jnt_array_t joint_gains_array;
337- for (unsigned int i = 0 ; i < lbr_fri_ros2::N_JNTS; ++i) {
338+ for (std:: size_t i = 0 ; i < lbr_fri_ros2::N_JNTS; ++i) {
338339 joint_gains_array[i] =
339340 this ->get_node ()->get_parameter (" inv_jac_ctrl.joint_gains" ).as_double_array ()[i];
340341 }
341342 lbr_fri_ros2::cart_array_t cartesian_gains_array;
342- for (unsigned int i = 0 ; i < lbr_fri_ros2::CARTESIAN_DOF; ++i) {
343+ for (std:: size_t i = 0 ; i < lbr_fri_ros2::CARTESIAN_DOF; ++i) {
343344 cartesian_gains_array[i] =
344345 this ->get_node ()->get_parameter (" inv_jac_ctrl.cartesian_gains" ).as_double_array ()[i];
345346 }
0 commit comments