Skip to content

std::max mixes translational (m) and rotational (rad) errors in kdl_kinematics_plugin.cpp #3747

Description

@Tarkiya

Description

During our academic research on automated dimensional analysis and physical unit consistency in C/C++ robotics projects, we identified a semantic dimensional mismatch in the KDL kinematics plugin (kdl_kinematics_plugin.cpp).
The code calculates a unified delta_twist_norm by taking the std::max() of a translational error and a rotational error. Mathematically and physically, comparing meters to radians via a max() function is a dimensional violation.

Location
moveit_kinematics/kdl_kinematics_plugin/src/kdl_kinematics_plugin.cpp (around line 444)
const double position_error = delta_twist.vel.Norm();
const double orientation_error = ik_solver.isPositionOnly() ? 0 : delta_twist.rot.Norm();
const double delta_twist_norm = std::max(position_error, orientation_error);

Expected behavior

if (position_error < epsilon && orientation_error < epsilon) {
// IK solved
}

Actual behavior

const double delta_twist_norm = std::max(position_error, orientation_error);
if (delta_twist_norm < epsilon) {
// IK solved
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions