49 This is only an approximation of the original function. It can be 50 considerably slower for small movements that contain rotation. 52 if group_name ==
'larm':
53 joint_name =
'LARM_JOINT5' 54 elif group_name ==
'rarm':
55 joint_name =
'RARM_JOINT5' 57 scaling_factor_translation = 50
58 scaling_factor_rotation = 5
59 x_now, y_now, z_now, r_now, p_now, w_now = self.getCurrentConfiguration(joint_name)
60 translation_distances = map(abs, [x-x_now * scaling_factor_translation,
61 y-y_now * scaling_factor_translation,
62 z-z_now * scaling_factor_translation])
63 rotation_distances = map(abs, [r-r_now * scaling_factor_rotation,
64 p-p_now * scaling_factor_rotation,
65 w-w_now * scaling_factor_rotation])
66 max_dist = max(translation_distances + rotation_distances)
67 mvmt_time = max_dist / rate
71 ret = self.setTargetPose(group_name, pos, rpw, mvmt_time)
73 self.waitInterpolationOfGroup(group_name)
77 def move(self, group_name, x, y, z, r, p, w, rate, wait = True):
78 return self.setTargetAngular(group_name, x, y, z, r, p, w, rate, wait)
80 def moveR(self, x, y, z, r, p, w, rate = 10, wait = True):
81 return self.move(
'rarm', x, y, z, r, p, w, rate, wait)
83 def moveL(self, x, y, z, r, p, w, rate = 10, wait = True):
84 return self.move(
'larm', x, y, z, r, p, w, rate, wait)
86 def moveRelative(self, group_name, joint_name, dx=0, dy=0, dz=0, dr=0, dp=0, dw=0, rate = 8, wait=True):
87 pos = self.getCurrentPosition(joint_name)
88 rpw = self.getCurrentRPY(joint_name)
89 return self.move(group_name, pos[0] + dx, pos[1] + dy , pos[2] + dz , rpw[0] + dr, rpw[1] + dp, rpw[2] + dw, rate, wait)
91 def moveRelativeR(self, dx=0, dy=0, dz=0, dr=0, dp=0, dw=0, rate = 8, wait = True):
92 return self.moveRelative(
'rarm',
'RARM_JOINT5', dx, dy, dz, dr, dp, dw, rate, wait)
94 def moveRelativeL(self,dx=0, dy=0, dz=0, dr=0, dp=0, dw=0, rate = 8, wait = True):
95 return self.moveRelative(
'larm',
'LARM_JOINT5', dx, dy, dz, dr, dp, dw, rate, wait)
98 xyz = self.getCurrentPosition(joint_name)
99 rpw = self.getCurrentRPY(joint_name)
100 return xyz[0], xyz[1], xyz[2], rpw[0], rpw[1], rpw[2]
102 from hironx_ros_bridge
import hironx_client
105 hironx_client.HIRONX.setTargetAngular = setTargetAngular
106 hironx_client.HIRONX.move = move
107 hironx_client.HIRONX.moveR = moveR
108 hironx_client.HIRONX.moveL = moveL
109 hironx_client.HIRONX.moveRelative = moveRelative
110 hironx_client.HIRONX.moveRelativeR = moveRelativeR
111 hironx_client.HIRONX.moveRelativeL = moveRelativeL
112 hironx_client.HIRONX.getCurrentConfiguration = getCurrentConfiguration