test-hrpsysconf.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 PKG = 'hrpsys'
4 NAME = 'test-hrpsys-config'
5 
6 import imp ## for rosbuild
7 try:
8  imp.find_module(PKG)
9 except:
10  import roslib; roslib.load_manifest(PKG)
11 
12 from hrpsys.hrpsys_config import *
13 from hrpsys import rtm
14 import OpenHRP
15 
16 import argparse,unittest,rostest
17 
18 import unittest, sys
19 
20 class SampleHrpsysConfigurator(HrpsysConfigurator):
21  def init(self, robotname="SampleRobot(Robot)0", url=""):
22  HrpsysConfigurator.init(self, robotname=robotname, url=url)
23 
24 class TestHrpsysConfig(unittest.TestCase):
25  global h
26  rh = None
27  seq = None
28 
30  # https://github.com/start-jsk/rtmros_hironx/blob/groovy-devel/hironx_ros_bridge/src/hironx_ros_bridge/hironx_client.py
31  from waitInput import waitInputConfirm, waitInputSelect
32  self.assertTrue(True)
33 
34  def test_createcomp(self):
35  global h
36  self.seq = h.createComp("SequencePlayer",'seq')[0]
37 
38  def test_connectcomp(self):
39  global h
40  if self.seq == None or self.rh == None:
41  self.test_createcomp()
42  connectPorts(self.rh.port("q"), self.seq.port("qInit"))
43  # check number of connection
44  assert(len(self.seq.port("qInit").get_connector_profiles()) == 1)
45  # check do not connect again if already connected for https://github.com/fkanehiro/hrpsys-base/issues/979
46  connectPorts(self.rh.port("q"), self.seq.port("qInit"))
47  assert(len(self.seq.port("qInit").get_connector_profiles()) == 1)
48 
49  def test_findcomp(self):
50  global h
51  h.findComps()
52 
53  def setUp(self):
54  global h
55  parser = argparse.ArgumentParser(description='hrpsys command line interpreters')
56  parser.add_argument('--host', help='corba name server hostname')
57  parser.add_argument('--port', help='corba name server port number')
58  args, unknown = parser.parse_known_args()
59 
60  if args.host:
61  rtm.nshost = args.host
62  if args.port:
63  rtm.nsport = args.port
65 
66  h.waitForRTCManager()
67  # look for name
68  for c in h.ms.get_components():
69  if '(Robot)' in c.name() or 'RobotHardware' in c.name():
70  h.waitForRobotHardware(c.name()) # get robot hardware name
71  break;
72  self.rh = h.rh
73 
74 #unittest.main()
75 if __name__ == '__main__':
76  import rostest
77  rostest.run(PKG, NAME, TestHrpsysConfig, sys.argv)
def init(self, robotname="SampleRobot(Robot)0", url="")
def connectPorts(outP, inPs, subscription="flush", dataflow="Push", bufferlength=1, rate=1000)
connect ports
Definition: jython/rtm.py:433


hrpsys
Author(s): AIST, Fumio Kanehiro
autogenerated on Thu May 6 2021 02:41:51