diff --git a/moveit_kinematics/kdl_kinematics_plugin/src/kdl_kinematics_parameters.yaml b/moveit_kinematics/kdl_kinematics_plugin/src/kdl_kinematics_parameters.yaml index d0c253db62..3d252f88f4 100644 --- a/moveit_kinematics/kdl_kinematics_plugin/src/kdl_kinematics_parameters.yaml +++ b/moveit_kinematics/kdl_kinematics_plugin/src/kdl_kinematics_parameters.yaml @@ -5,15 +5,16 @@ kdl_kinematics: description: "Joints names to assign weights", } - __map_joints: - weight: { - type: double, - default_value: 1.0, - description: "Joint weight", - validation: { - gt<>: [ 0.0 ] + weights: + __map_joints: + value: { + type: double, + default_value: 1.0, + description: "Joint weight", + validation: { + gt<>: [ 0.0 ] + } } - } max_solver_iterations: { type: int, diff --git a/moveit_kinematics/kdl_kinematics_plugin/src/kdl_kinematics_plugin.cpp b/moveit_kinematics/kdl_kinematics_plugin/src/kdl_kinematics_plugin.cpp index 54d3f0aa4f..616abd449f 100644 --- a/moveit_kinematics/kdl_kinematics_plugin/src/kdl_kinematics_plugin.cpp +++ b/moveit_kinematics/kdl_kinematics_plugin/src/kdl_kinematics_plugin.cpp @@ -95,11 +95,10 @@ void KDLKinematicsPlugin::getJointWeights() joint_weights_ = std::vector(joint_names.size(), 1.0); // Check if joint weight is assigned in kinematics YAML - // Loop through map (key: joint name and value: Struct with a weight member variable) - for (const auto& joint_weight : params_.joints_map) + // Loop through map (key: joint name and weight: struct with a value member variable) + for (const auto& [joint_name, weight] : params_.weights.joints_map) { // Check if joint is an active joint in the group - const auto joint_name = joint_weight.first; auto it = std::find(joint_names.begin(), joint_names.end(), joint_name); if (it == joint_names.cend()) { @@ -109,7 +108,7 @@ void KDLKinematicsPlugin::getJointWeights() } // Find index of the joint name and assign weight to the coressponding index - joint_weights_.at(it - joint_names.begin()) = joint_weight.second.weight; + joint_weights_.at(it - joint_names.begin()) = weight.value; } RCLCPP_INFO_STREAM(