4 NAME =
'test-samplerobot' 10 import roslib; roslib.load_manifest(PKG)
20 from hrpsys
import rtm
29 [
'seq',
"SequencePlayer"],
30 [
'sh',
"StateHolder"],
31 [
'fk',
"ForwardKinematics"],
32 [
'log',
"DataLogger"],
42 h.init(robotname=
"SampleRobot(Robot)0")
47 print >>sys.stderr,
"log=",h.log,
"log_svc=",h.log_svc
48 self.assertTrue(h.log)
49 self.assertTrue(h.log_svc)
54 from subprocess
import check_output
55 openhrp3_path = check_output([
'rospack',
'find',
'openhrp3']).rstrip()
57 if os.path.exists(os.path.join(openhrp3_path,
"bin")) :
58 PKG_CONFIG_PATH=
'PKG_CONFIG_PATH=%s/lib/pkgconfig:$PKG_CONFIG_PATH'%(openhrp3_path)
60 cmd =
"%s pkg-config openhrp3.1 --variable=idl_dir"%(PKG_CONFIG_PATH)
61 os.path.join(check_output(cmd, shell=
True).rstrip(),
"../sample/controller/SampleController/etc/Sample")
62 h.loadPattern(os.path.join(check_output(cmd, shell=
True).rstrip(),
"../sample/controller/SampleController/etc/Sample"), 1)
63 self.assertEqual(h.waitInterpolation(),
None)
68 self.assertTrue(h.setJointAngles(h.getJointAngles(),1))
69 self.assertEqual(h.waitInterpolation(),
None)
72 a = [(360*random.random()-180)
for i
in xrange(len(h.getJointAngles()))]
73 self.assertTrue(h.setJointAngles(a,2))
74 self.assertEqual(h.waitInterpolation(),
None)
76 a = [0
for i
in xrange(len(h.getJointAngles()))]
77 self.assertTrue(h.setJointAngles(a,2))
78 self.assertEqual(h.waitInterpolation(),
None)
81 if __name__ ==
'__main__':
82 rostest.run(PKG, NAME, TestJointAngle, sys.argv)
def test_load_pattern(self)
def test_set_if_find_log(self)
def test_set_joint_angles(self)