2 import roslib; roslib.load_manifest(
"hrpsys")
3 import OpenRTM_aist.RTM_IDL
12 if __name__ ==
'__main__':
13 parser = argparse.ArgumentParser(description=
"hrpsys command line interpreters, try `./hrpsys_tools_config.py--host xxxx --port xxxx -i` or `ipython ./hrpsys_tools_config.py -- --host xxxx --port xxxx` for robot debugging, we recommend to use ipython")
14 parser.add_argument(
'--host', help=
'corba name server hostname')
15 parser.add_argument(
'--port', help=
'corba name server port number')
16 parser.add_argument(
'-i', help=
'interactive mode', action=
'store_true')
17 parser.add_argument(
'-c', help=
'execute command', nargs=
'*')
18 parser.add_argument(
'--use-unstable-rtc', help=
'use unstable rtc', action=
'store_true')
19 args, unknown = parser.parse_known_args()
25 [sys.argv.remove(a)
for a
in args.c]
27 rtm.nshost = args.host; sys.argv = [sys.argv[0]] + sys.argv[3:]
29 rtm.nsport = args.port; sys.argv = [sys.argv[0]] + sys.argv[3:]
32 hcf = HrpsysConfigurator()
33 if args.use_unstable_rtc:
34 hcf.getRTCList = hcf.getRTCListUnstable; sys.argv = [sys.argv[0]] + sys.argv[2:]
35 if args.i
or '__IPYTHON__' in vars(__builtins__):
36 hcf.waitForModelLoader()
37 if len(sys.argv) > 1
and not sys.argv[1].startswith(
'-'):
38 hcf.waitForRTCManagerAndRoboHardware(robotname=sys.argv[1])
39 sys.argv = [sys.argv[0]] + sys.argv[2:]
41 print >> sys.stderr,
"[hrpsys.py] #\n[hrpsys.py] # use `hcf` as robot interface, for example hcf.getJointAngles()\n[hrpsys.py] #" 43 print >> sys.stderr,
">>", args.c[0]
46 if not (args.i
and '__IPYTHON__' in vars(__builtins__)):
47 code.interact(local=locals())
48 elif len(sys.argv) > 2 :
49 hcf.init(sys.argv[1], sys.argv[2])
50 elif len(sys.argv) > 1 :