@@ -21,9 +21,9 @@ namespace kinematics_interface_kdl
21
21
rclcpp::Logger LOGGER = rclcpp::get_logger(" kinematics_interface_kdl" );
22
22
23
23
bool KinematicsInterfaceKDL::initialize (
24
+ const std::string & robot_description,
24
25
std::shared_ptr<rclcpp::node_interfaces::NodeParametersInterface> parameters_interface,
25
- const std::string & end_effector_name,
26
- const std::string & robot_description)
26
+ const std::string & param_namespace)
27
27
{
28
28
// track initialization plugin
29
29
initialized = true ;
@@ -34,7 +34,7 @@ bool KinematicsInterfaceKDL::initialize(
34
34
// If the robot_description input argument is empty, try to get the
35
35
// robot_description from the node's parameters.
36
36
auto robot_param = rclcpp::Parameter ();
37
- if (!parameters_interface->get_parameter (" robot_description" , robot_param))
37
+ if (!parameters_interface->get_parameter (param_namespace + " robot_description" , robot_param))
38
38
{
39
39
RCLCPP_ERROR (LOGGER, " parameter robot_description not set in kinematics_interface_kdl" );
40
40
return false ;
@@ -45,22 +45,32 @@ bool KinematicsInterfaceKDL::initialize(
45
45
{
46
46
robot_description_local = robot_description;
47
47
}
48
+
49
+ // get parameters
50
+ std::string ns = !param_namespace.empty () ? param_namespace + " ." : " " ;
48
51
// get alpha damping term
49
52
auto alpha_param = rclcpp::Parameter (" alpha" , 0.000005 );
50
- if (parameters_interface->has_parameter (" alpha" ))
53
+ if (parameters_interface->has_parameter (ns + " alpha" ))
51
54
{
52
- parameters_interface->get_parameter (" alpha" , alpha_param);
55
+ parameters_interface->get_parameter (ns + " alpha" , alpha_param);
53
56
}
54
57
alpha = alpha_param.as_double ();
58
+ // get end-effector name
59
+ auto end_effector_name = rclcpp::Parameter (" tip" , " MISSING_END_EFFECTOR_NAME" );
60
+ if (parameters_interface->has_parameter (ns + " tip" ))
61
+ {
62
+ parameters_interface->get_parameter (ns + " tip" , end_effector_name);
63
+ }
64
+
55
65
// create kinematic chain
56
66
KDL::Tree robot_tree;
57
67
kdl_parser::treeFromString (robot_description_local, robot_tree);
58
68
root_name_ = robot_tree.getRootSegment ()->first ;
59
- if (!robot_tree.getChain (root_name_, end_effector_name, chain_))
69
+ if (!robot_tree.getChain (root_name_, end_effector_name. as_string () , chain_))
60
70
{
61
71
RCLCPP_ERROR (
62
72
LOGGER, " failed to find chain from robot root %s to end effector %s" , root_name_.c_str (),
63
- end_effector_name.c_str ());
73
+ end_effector_name.as_string (). c_str ());
64
74
return false ;
65
75
}
66
76
// create map from link names to their index
0 commit comments