Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change KDL IK plugin joint weight parameters specification #2750

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,10 @@ void KDLKinematicsPlugin::getJointWeights()
joint_weights_ = std::vector<double>(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())
{
Expand All @@ -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(
Expand Down
Loading