Skip to content

Commit

Permalink
Read base parameter in initialize function (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
bmagyar authored May 20, 2024
1 parent 24174a4 commit 2f02ebd
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion kinematics_interface_kdl/src/kinematics_interface_kdl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,19 @@ bool KinematicsInterfaceKDL::initialize(
// create kinematic chain
KDL::Tree robot_tree;
kdl_parser::treeFromString(robot_description, robot_tree);
root_name_ = robot_tree.getRootSegment()->first;

// get root name
auto base_param = rclcpp::Parameter();
if (parameters_interface->has_parameter("base"))
{
parameters_interface->get_parameter("base", base_param);
root_name_ = base_param.as_string();
}
else
{
root_name_ = robot_tree.getRootSegment()->first;
}

if (!robot_tree.getChain(root_name_, end_effector_name, chain_))
{
RCLCPP_ERROR(
Expand Down

0 comments on commit 2f02ebd

Please sign in to comment.