19 from hand_finder
import HandJoints
26 Initializes arm configuration 34 The ArmFinder is a utility library for detecting arms running on 35 the system. The idea is to make it easier to write generic code, 36 using this library to handle prefixes, joint prefixes etc... 41 Parses the parameter server to extract the necessary information. 43 if not rospy.has_param(
"arm"):
44 rospy.logerr(
"No arm param defined.")
45 arm_parameters = {
'joint_prefix': {},
'mapping': {}}
47 arm_parameters = rospy.get_param(
"arm")
55 if rospy.has_param(
'robot_description'):
57 robot_description = rospy.get_param(
'robot_description')
58 robot_urdf = URDF.from_xml_string(robot_description)
60 hand_default_joints = HandJoints.get_default_joints()
61 possible_arm_joints = []
63 for joint
in robot_urdf.joints:
64 if joint.type !=
'fixed' and joint.name
not in hand_default_joints:
66 for hand_default_joint_name
in hand_default_joints:
67 if joint.name.endswith(
'_' + hand_default_joint_name):
72 possible_arm_joints.append(joint.name)
74 for arm_id, arm_mapping
in self.
arm_config.mapping.iteritems():
76 arm_joint_prefix = self.
arm_config.joint_prefix[arm_id]
77 for joint_name
in possible_arm_joints:
78 if joint_name.startswith(arm_joint_prefix):
79 self.
arm_joints[arm_mapping].append(joint_name)
81 rospy.logwarn(
"No robot_description found on parameter server. Assuming that there is no arm.")
def get_arm_parameters(self)
def __init__(self, mapping, joint_prefix)