4 PKG =
'hironx_ros_bridge' 8 import hironx_ros_bridge
10 import roslib; roslib.load_manifest(PKG)
11 import hironx_ros_bridge
13 from hironx_ros_bridge
import hironx_client
as hironx
14 from hrpsys
import rtm
25 from rtm
import connectPorts, disconnectPorts
27 from distutils.version
import StrictVersion
42 for i0
in range(-80,80,80):
43 for i1
in range(-130,50,90):
44 for i2
in range(-150,10,80):
45 for i3
in range(-160,100,130):
46 for i4
in range(-80,80,80):
47 for i5
in range(-160,160,160):
48 yield [i0, i1, i2, i3, i4, i5]
74 for x
in range(xmin,xmax,step):
75 for y
in range(ymin,ymax,step):
76 for z
in range (zmin,zmax,step):
77 yield [x/1000.0, y/1000.0, z/1000.0]
80 self.
pos_ik_test(
"LARM", 220,400, -5,320, 5,300, 100)
83 self.
pos_ik_test(
"RARM", 220,400, -320,5, 5,300, 100)
85 def pos_ik_test(self, arm, xmin,xmax,ymin,ymax,zmin,zmax,step):
86 arm_target = arm+
"_JOINT5" 87 rot1 = [[0,0,-1],[0,1,0],[1,0,0]]
89 self.robot.goInitial(tm=2)
90 print self.robot.getReferenceRPY(arm_target)
91 self.assertTrue(self.robot.setTargetPose(arm, pos1, euler_from_matrix(rot1), 1))
92 self.robot.waitInterpolationOfGroup(arm)
93 pos2 = self.robot.getReferencePosition(arm_target)
94 rot2 = self.robot.getReferenceRotation(arm_target)
95 print "pos", pos1, pos2, numpy.linalg.norm(numpy.array(pos1)-numpy.array(pos2))
96 print "rpy", rot1, rot2, numpy.linalg.norm(numpy.array(rot1)-numpy.array(rot2))
97 self.assertTrue(numpy.linalg.norm(numpy.array(pos1)-numpy.array(pos2))<1.0e-4)
98 self.assertTrue(numpy.linalg.norm(numpy.array(rot1)-numpy.array(rot2))<1.0e-3)
101 self.robot.setJointAnglesOfGroup(
"TORSO",[45],3)
102 self.robot.waitInterpolationOfGroup(
"TORSO")
103 ret = self.robot.setTargetPose(
"larm", [0.3255627368715471, 0.1823638733778268, 0.07462449717662004+0.2], [-3.0732189053889805, -1.5690225912054285, 3.0730289207320203], 5,
"CHEST_JOINT0")
107 if StrictVersion(self.robot.hrpsys_version) < StrictVersion(
'315.5.0'):
109 self.robot.goInitial(tm=3)
111 self.robot.connectLoggerPort(self.robot.el,
'beepCommand')
112 ret = self.robot.setTargetPose(
"larm", [0.3255627368715471, 0.1823638733778268, 0.07462449717662004+0.2], [-3.0732189053889805, -1.5690225912054285, 3.0730289207320203], 5,
"CHEST_JOINT0")
113 self.robot.waitInterpolationOfGroup(
"larm")
116 ret = self.robot.setTargetPose(
"larm", [0.3255627368715471, 0.1823638733778268, 0.07462449717662004-0.1], [-3.0732189053889805, -1.5690225912054285, 3.0730289207320203], 5,
"CHEST_JOINT0")
119 self.robot.clearOfGroup(
'larm')
122 self.robot.clearLog()
123 self.robot.setMaxLogLength(2000)
124 ret = self.robot.setTargetPose(
"larm", [0.3255627368715471, 0.1823638733778268, 0.07462449717662004+0.2], [-3.0732189053889805, -1.5690225912054285, 3.0730289207320203], 5,
"CHEST_JOINT0")
125 self.robot.waitInterpolationOfGroup(
"larm")
126 self.robot.saveLog(fname=
'/tmp/test_hironx_ik')
127 print(
"check /tmp/test_hironx_ik.el_beepCommand")
128 fp = open(
'/tmp/test_hironx_ik.el_beepCommand',
"r") 135 self.robot.goInitial(tm=3)
136 ret = self.robot.setTargetPoseRelative(
'larm',
'LARM_JOINT5', dz=0.01, tm=0.5)
138 ret = self.robot.setTargetPoseRelative(
'larm',
'LARM_JOINT5', dz=0, tm=0.5)
144 if __name__ ==
'__main__':
146 rostest.rosrun(PKG,
'test_hronx_ik', TestHiroIK)
def angle_vector_generator(self)
def test_set_target_pose(self)
def test_set_target_pose_relative_319(self)
def target_point_generator(self, xmin, xmax, ymin, ymax, zmin, zmax, step)
def test_set_target_pose_clear(self)
def pos_ik_test(self, arm, xmin, xmax, ymin, ymax, zmin, zmax, step)