From c3c5619c7b9ac368276b94d3c70430eb1729f7e8 Mon Sep 17 00:00:00 2001 From: shourikb Date: Mon, 9 Mar 2026 00:15:52 +0000 Subject: [PATCH] automated style fixes --- src/rj_control/src/motion_control.cpp | 58 ++++++++++++++++----------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/src/rj_control/src/motion_control.cpp b/src/rj_control/src/motion_control.cpp index ce2713af1b..3f73f10da5 100644 --- a/src/rj_control/src/motion_control.cpp +++ b/src/rj_control/src/motion_control.cpp @@ -35,8 +35,7 @@ MotionControl::MotionControl(int shell_id, rclcpp::Node* node) drawer_( node->create_publisher(viz::topics::kDebugDrawTopic, 10), fmt::format("motion_control/{}", std::to_string(shell_id))) { - - std::string param_prefix = fmt::format("robot_{}", std::to_string(shell_id_)); + std::string param_prefix = fmt::format("robot_{}", std::to_string(shell_id_)); // populate params // robot specific @@ -46,7 +45,7 @@ MotionControl::MotionControl(int shell_id, rclcpp::Node* node) node->get_parameter(param_prefix + ".rotation_kp", rotation_kp_); node->get_parameter(param_prefix + ".rotation_ki", rotation_ki_); node->get_parameter(param_prefix + ".rotation_kd", rotation_kd_); - + // shared between robots node->get_parameter("translation_windup", translation_windup_); node->get_parameter("rotation_windup", rotation_windup_); @@ -56,28 +55,39 @@ MotionControl::MotionControl(int shell_id, rclcpp::Node* node) param_callback_handle_ = node->add_on_set_parameters_callback( [this, param_prefix](const std::vector& params) { - rcl_interfaces::msg::SetParametersResult result; - result.successful = true; - - for (const auto& param : params) { - const auto& name = param.get_name(); - - if (name == param_prefix + ".translation_kp") translation_kp_ = param.as_double(); - else if (name == param_prefix + ".translation_ki") translation_ki_ = param.as_double(); - else if (name == param_prefix + ".translation_kd") translation_kd_ = param.as_double(); - else if (name == param_prefix + ".rotation_kp") rotation_kp_ = param.as_double(); - else if (name == param_prefix + ".rotation_ki") rotation_ki_ = param.as_double(); - else if (name == param_prefix + ".rotation_kd") rotation_kd_ = param.as_double(); - else if (name == "translation_windup") translation_windup_ = param.as_int(); - else if (name == "rotation_windup") rotation_windup_ = param.as_int(); - else if (name == "max_velocity") max_velocity_ = param.as_double(); - else if (name == "max_acceleration") max_acceleration_ = param.as_double(); - else if (name == "max_angular_velocity") max_angular_velocity_ = param.as_double(); - } + rcl_interfaces::msg::SetParametersResult result; + result.successful = true; + + for (const auto& param : params) { + const auto& name = param.get_name(); + + if (name == param_prefix + ".translation_kp") + translation_kp_ = param.as_double(); + else if (name == param_prefix + ".translation_ki") + translation_ki_ = param.as_double(); + else if (name == param_prefix + ".translation_kd") + translation_kd_ = param.as_double(); + else if (name == param_prefix + ".rotation_kp") + rotation_kp_ = param.as_double(); + else if (name == param_prefix + ".rotation_ki") + rotation_ki_ = param.as_double(); + else if (name == param_prefix + ".rotation_kd") + rotation_kd_ = param.as_double(); + else if (name == "translation_windup") + translation_windup_ = param.as_int(); + else if (name == "rotation_windup") + rotation_windup_ = param.as_int(); + else if (name == "max_velocity") + max_velocity_ = param.as_double(); + else if (name == "max_acceleration") + max_acceleration_ = param.as_double(); + else if (name == "max_angular_velocity") + max_angular_velocity_ = param.as_double(); + } + + return result; + }); - return result; - }); - motion_setpoint_pub_ = node->create_publisher( topics::motion_setpoint_topic(shell_id_), rclcpp::QoS(1)); target_state_pub_ = node->create_publisher(