Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040 from nextage_ros_bridge import nextage_client
00041
00042 from hrpsys import rtm
00043 import argparse
00044
00045 _ARMGROUP_TESTED = 'rarm'
00046 _LINK_TESTED = 'RARM_JOINT5'
00047
00048
00049 class TestNextageNoRostest(object):
00050 '''
00051 Test NextageClient without relying on rostest.
00052 This can be upgraded to rostest version that is more ideal/almost required
00053 for ROS package.
00054 '''
00055
00056 def __init__(self, nc):
00057 '''
00058 @type nc: NextageClient
00059 '''
00060 self._nxc = nc
00061
00062
00063 def test_set_relative(self, dx=0, dy=0, dz=0):
00064
00065 self._nxc.seq_svc.setMaxIKError(0.00001, 0.01)
00066 posi_prev = self._nxc.getCurrentPosition(_LINK_TESTED)
00067 for i in range(200):
00068 self._nxc.setTargetPoseRelative(_ARMGROUP_TESTED, _LINK_TESTED,
00069 dx, dy, dz, tm=0.2)
00070
00071 posi_post = self._nxc.getCurrentPosition(_LINK_TESTED)
00072
00073
00074 if __name__ == '__main__':
00075 parser = argparse.ArgumentParser(description='hiro command line interpreters')
00076 parser.add_argument('--host', help='corba name server hostname')
00077 parser.add_argument('--port', help='corba name server port number')
00078 parser.add_argument('--modelfile', help='robot model file nmae')
00079 parser.add_argument('--robot', help='robot modlule name (RobotHardware0 for real robot, Robot()')
00080 args, unknown = parser.parse_known_args()
00081
00082 if args.host:
00083 rtm.nshost = args.host
00084 if args.port:
00085 rtm.nsport = args.port
00086 if not args.robot:
00087 args.robot = "RobotHardware0" if args.host else "HiroNX(Robot)0"
00088 if not args.modelfile:
00089 args.modelfile = ""
00090
00091
00092 if len(unknown) >= 2:
00093 args.robot = unknown[0]
00094 args.modelfile = unknown[1]
00095 nxc = nextage_client.NextageClient()
00096 nxc.init(robotname=args.robot, url=args.modelfile)
00097 nxc.goInitial()
00098 tnn = TestNextageNoRostest(nxc)
00099
00100 tnn.test_set_relative(dx=0.0001)
00101 tnn.test_set_relative(dy=0.0001)
00102 tnn.test_set_relative(dz=0.0001)