22 from sr_robot_commander.sr_hand_commander
import SrHandCommander
23 from sr_utilities.hand_finder
import HandFinder
25 rospy.init_node(
"basic_hand_examples", anonymous=
True)
27 hand_finder = HandFinder()
29 hand_parameters = hand_finder.get_hand_parameters()
30 hand_serial = hand_parameters.mapping.keys()[0]
32 hand_commander = SrHandCommander(hand_parameters=hand_parameters,
33 hand_serial=hand_serial)
35 hand_mapping = hand_parameters.mapping[hand_serial]
38 joints = hand_finder.get_hand_joints()[hand_mapping]
40 position_values = [0.35, 0.18, 0.38]
43 rospy.loginfo(
"Hand moving to script specified target")
44 position_1 = dict(zip(joints, position_values))
45 hand_commander.move_to_joint_value_target(position_1)
47 named_target_1 =
"pack" 48 rospy.loginfo(
"Hand moving to named target: " + named_target_1)
49 hand_commander.move_to_named_target(named_target_1)
51 named_target_2 =
"open" 52 rospy.loginfo(
"Hand moving to named target: " + named_target_2)
53 hand_commander.move_to_named_target(named_target_2)
56 hand_joints_state = hand_commander.get_joints_position()
57 hand_joints_velocity = hand_commander.get_joints_velocity()
58 hand_joints_effort = hand_commander.get_joints_effort()
60 rospy.loginfo(
"Hand joints position \n " + str(hand_joints_state) +
"\n")
61 rospy.loginfo(
"Hand joints velocity \n " + str(hand_joints_velocity) +
"\n")
62 rospy.loginfo(
"Hand joints effort \n " + str(hand_joints_effort) +
"\n")
65 tactile_type = hand_commander.get_tactile_type()
66 tactile_state = hand_commander.get_tactile_state()
67 rospy.loginfo(
"Tactile type \n " + str(tactile_type) +
"\n")
68 rospy.loginfo(
"Tactile state \n " + str(tactile_state) +
"\n")