38 from rospy
import ROSInitException
41 import hironx_ros_bridge
44 roslib.load_manifest(
'hironx_ros_bridge')
46 from hironx_ros_bridge
import hironx_client
52 from hrpsys
import rtm
55 errormsg_noros =
'No ROS Master found. Without it, you cannot use ROS from' \
56 ' this script, but can use RTM. To use ROS, do not forget' \
57 ' to run rosbridge. How to do so? --> http://wiki.ros.org/rtmros_nextage/Tutorials/Operating%20Hiro%2C%20NEXTAGE%20OPEN' 59 if __name__ ==
'__main__':
60 parser = argparse.ArgumentParser(description=
'hiro command line interpreters')
61 parser.add_argument(
'--host', help=
'corba name server hostname')
62 parser.add_argument(
'--port', help=
'corba name server port number')
63 parser.add_argument(
'--modelfile', help=
'robot model file nmae')
64 parser.add_argument(
'--robot', help=
'robot modlule name (RobotHardware0 for real robot, Robot()')
65 args, unknown = parser.parse_known_args()
66 unknown = [u
for u
in unknown
if u[:2] !=
'__']
69 rtm.nshost = args.host
71 rtm.nsport = args.port
73 args.robot =
"RobotHardware0" if args.host
else "HiroNX(Robot)0" 74 if not args.modelfile:
75 args.modelfile =
"/opt/jsk/etc/HIRONX/model/main.wrl" if args.host
else "" 79 args.robot = unknown[0]
80 args.modelfile = unknown[1]
81 robot = hiro = hironx_client.HIRONX()
87 except ROSInitException
as e:
88 print(
'[nextage.py] {}'.format(e))
89 except socket.error
as e:
90 print(
"\033[31m%s\n%s\033[0m" % (e.strerror, errormsg_noros))