20 from hand_finder
import HandJoints
27 Initializes arm configuration 35 The ArmFinder is a utility library for detecting arms running on 36 the system. The idea is to make it easier to write generic code, 37 using this library to handle prefixes, joint prefixes etc... 42 Parses the parameter server to extract the necessary information. 44 if not rospy.has_param(
"arm"):
45 rospy.logerr(
"No arm param defined.")
46 arm_parameters = {
'joint_prefix': {},
'mapping': {}}
48 arm_parameters = rospy.get_param(
"arm")
56 if rospy.has_param(
'robot_description'):
58 robot_description = rospy.get_param(
'robot_description')
59 robot_urdf = URDF.from_xml_string(robot_description)
61 hand_default_joints = HandJoints.get_default_joints()
62 possible_arm_joints = []
64 for joint
in robot_urdf.joints:
65 if joint.type !=
'fixed' and joint.name
not in hand_default_joints:
67 for hand_default_joint_name
in hand_default_joints:
68 if joint.name.endswith(
'_' + hand_default_joint_name):
73 possible_arm_joints.append(joint.name)
75 for arm_id, arm_mapping
in self.arm_config.mapping.iteritems():
77 arm_joint_prefix = self.arm_config.joint_prefix[arm_id]
78 for joint_name
in possible_arm_joints:
79 if joint_name.startswith(arm_joint_prefix):
80 self.
arm_joints[arm_mapping].append(joint_name)
82 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)