17 from moveit_msgs.srv
import SaveRobotStateToWarehouse
as SaveState
18 from moveit_msgs.srv
import GetRobotStateFromWarehouse
as GetState
19 from moveit_msgs.srv
import GetRobotStateFromWarehouseResponse
as GetStateResp
24 _arm_joints = [
'shoulder_pan_joint',
'elbow_joint',
'shoulder_lift_joint',
25 'wrist_1_joint',
'wrist_2_joint',
'wrist_3_joint',
'WRJ2',
'WRJ1']
27 def __init__(self, arm_state_name, hand_state_name, new_state_name, robot_name="ur10srh"):
28 self.
_save = rospy.ServiceProxy(
29 'save_robot_state', SaveState)
31 self.
_read = rospy.ServiceProxy(
32 'get_robot_state', GetState)
41 Filters out the joints that we don't want and their positions 42 :param state: initial state 43 :param remove_arm: If True we remove the arm joints, if False we remove the non-arm joints (hand joints) 44 :return: the filtered state 48 for n, pos
in zip(state.state.joint_state.name, state.state.joint_state.position):
49 if (remove_arm
and all(s
not in n
for s
in self.
_arm_joints))\
50 or (
not remove_arm
and any(s
in n
for s
in self.
_arm_joints)):
53 state.state.joint_state.name = name
54 state.state.joint_state.position = position
59 arm_state = GetStateResp()
64 hand_state = GetStateResp()
71 combined_state = arm_state
72 combined_state.state.joint_state.name += hand_state.state.joint_state.name
73 combined_state.state.joint_state.position += hand_state.state.joint_state.position
def __init__(self, arm_state_name, hand_state_name, new_state_name, robot_name="ur10srh")
def _filter_joints(self, state, remove_arm=True)