hironx.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 # -*- coding: utf-8 -*-
00003 
00004 try: # catkin does not requires load_manifest
00005     import roslib
00006     import hironx_ros_bridge
00007 except:
00008     import roslib; roslib.load_manifest('hironx_ros_bridge')
00009 
00010 from hironx_ros_bridge import hironx_client
00011 
00012 from hrpsys import rtm  # See https://github.com/tork-a/rtmros_nextage/commit/d4268d81ec14a514bb4b3b52614c81e708dd1ecc#diff-20257dd6ad60c0892cfb122c37a8f2ba 
00013 import argparse
00014 
00015 if __name__ == '__main__':
00016     parser = argparse.ArgumentParser(description='hiro command line interpreters')
00017     parser.add_argument('--host', help='corba name server hostname')
00018     parser.add_argument('--port', help='corba name server port number')
00019     parser.add_argument('--modelfile', help='robot model file nmae')
00020     parser.add_argument('--robot', help='robot modlule name (RobotHardware0 for real robot, Robot()')
00021     args, unknown = parser.parse_known_args()
00022 
00023     if args.host:
00024         rtm.nshost = args.host
00025     if args.port:
00026         rtm.nsport = args.port
00027     if not args.robot:
00028         args.robot = "RobotHardware0" if args.host else "HiroNX(Robot)0"
00029     if not args.modelfile:
00030         args.modelfile = ""
00031 
00032     # support old style format
00033     if len(unknown) >= 2:
00034         args.robot = unknown[0]
00035         args.modelfile = unknown[1]
00036     robot = hiro = hironx_client.HIRONX()
00037     robot.init(robotname=args.robot, url=args.modelfile)
00038 
00039 # for simulated robot
00040 # $ ./hironx.py
00041 #
00042 # for real robot
00043 # ../script/hironx.py -- --host hiro014
00044 # ./ipython -i hironx.py -- --host hiro014
00045 # for real robot with custom model file
00046 # ../script/hironx.py -- --host hiro014 --modelfile /opt/jsk/etc/HIRONX/model/main.wrl
00047 #
00048 # See http://unix.stackexchange.com/questions/11376/what-does-double-dash-mean
00049 # for the use of double-dash on unix/linux.


hironx_ros_bridge
Author(s): Kei Okada
autogenerated on Mon Oct 6 2014 07:19:42