47     This class holds methods that can be used for verification of the robot    48     Kawada Industries' dual-arm robot Hiro (and the same model of other robots    52     - Intended to be run as nosetests, ie. roscore isn't available by itself.    53     - Almost all the testcases don't run without an access to a robot running.    55     Above said, combined with a rostest that launches roscore and robot (either    56     simulation or real) hopefully these testcases can be run, both in batch    57     manner by rostest and in nosetest manner.    59     Prefix for methods 'at' means 'acceptance test'.    61     All time arguments are second.    64     _POSITIONS_LARM_DEG_UP = [-4.697, -2.012, -117.108, -17.180, 29.146, -3.739]
    65     _POSITIONS_LARM_DEG_DOWN = [6.196, -5.311, -73.086, -15.287, -12.906, -2.957]
    66     _POSITIONS_RARM_DEG_DOWN = [-4.949, -3.372, -80.050, 15.067, -7.734, 3.086]
    67     _POSITIONS_LARM_DEG_UP_SYNC = [-4.695, -2.009, -117.103, -17.178, 29.138, -3.738]
    68     _POSITIONS_RARM_DEG_UP_SYNC = [4.695, -2.009, -117.103, 17.178, 29.138, 3.738]
    69     _ROTATION_ANGLES_HEAD_1 = [[0.1, 0.0], [50.0, 10.0]]
    70     _ROTATION_ANGLES_HEAD_2 = [[50, 10], [-50, -10], [0, 0]]
    71     _POSITIONS_TORSO_DEG = [[130.0], [-130.0]]
    72     _R_Z_SMALLINCREMENT = 0.0001
    74     _POS_L_X_NEAR_Y_FAR = [0.326, 0.474, 1.038]
    75     _RPY_L_X_NEAR_Y_FAR = (-3.075, -1.569, 3.074)
    76     _POS_R_X_NEAR_Y_FAR = [0.326, -0.472, 1.048]
    77     _RPY_R_X_NEAR_Y_FAR = (3.073, -1.569, -3.072)
    79     _POS_L_X_FAR_Y_FAR = [0.47548142379781055, 0.17430276793604782, 1.0376878025614884]
    80     _RPY_L_X_FAR_Y_FAR = (-3.075954857224205, -1.5690261926181046, 3.0757659493049574)
    81     _POS_R_X_FAR_Y_FAR = [0.4755337947019357, -0.17242322190721648, 1.0476395479774052]
    82     _RPY_R_X_FAR_Y_FAR = (3.0715850722714944, -1.5690204449882248, -3.071395243174742)
    84     _TASK_DURATION_DEFAULT = 5.0
    85     _DURATION_EACH_SMALLINCREMENT = 0.1
    86     _TASK_DURATION_TORSO = 4.0
    87     _TASK_DURATION_HEAD = 2.5
    89     _DURATON_TOTAL_SMALLINCREMENT = 30  
    91     def __init__(self, rtm_robotname='HiroNX(Robot)0
', url=''):    93         Initiate both ROS and RTM robot clients, keep them public so that they    94         are callable from script. e.g. On ipython,    96                 In [1]: acceptance.ros.go_init()    97                 In [2]: acceptance.rtm.goOffPose()   105         if rospy.has_param(
'/gazebo'):
   106             print(
"\033[32m[INFO] Assming Gazebo Siulator, so do not connect to CORBA systmes\033[0m")
   107             print(
"\033[32m[INFO] run 'acceptance.run_tests_ros()' for ROS interface test\033[0m")
   112             print(
"\033[32m[INFO] run 'acceptance.run_tests_rtm()' for RTM interface test\033[0m")
   117         @param msg: To be printed on prompt.   118         @param do_wait_input: If True python commandline waits for any input   122             msg = 
'\n' + msg + 
'= '   125                 input(
'Waiting for any key. **Do NOT** hit enter multiple ' +
   136         @param do_wait_input: If True, the user will be asked to hit any key   137                               before each task to proceed.   143         Run by ROS exactly the same actions that run_tests_rtm performs.   145         @param do_wait_input: If True, the user will be asked to hit any key   146                               before each task to proceed.   152         @type test_client: hironx_ros_robotics.abst_acceptancetest.AbstAcceptanceTest   155         _task_msgs = [
'TASK-1-1. Move each arm separately to the given pose by passing joint space.',
   156                       'TASK-1-2. Move each arm separately to the given pose by specifying a pose.',
   157                       'TASK-2. Move both arms at the same time using relative distance and angle from the current pose.',
   158                       'TASK-3. Move arm with very small increment (0.1mm/sec).\n\tRight hand 3 cm upward over 30 seconds.',
   159                       'In the beginning you\'ll see the displacement of the previous task.' +
   160                        '\nTASK-4. Move head using Joint angles in degree.',
   161                       'TASK-5. Rotate torso to the left and right 130 degree.',
   162                       'TASK-6. Overwrite ongoing action.' +
   163                       '\n\t6-1. While rotating torso toward left, it gets canceled and rotate toward right.' +
   164                       '\n\t6-2. While lifting left hand, right hand also tries to reach the same height that gets cancelled so that it stays lower than the left hand.',
   165                       'TASK-7. Show the capable workspace on front side of the robot.']
   167         _msg_type_client = 
None   168         if isinstance(test_client, AcceptanceTestROS):
   169             _msg_type_client = 
'(ROS) '   170         elif isinstance(test_client, AcceptanceTestRTM):
   171             _msg_type_client = 
'(RTM) '   173         test_client.go_initpos()
   175         msg_task = _task_msgs[0]
   176         msg = _msg_type_client + msg_task
   180         msg_task = _task_msgs[1]
   181         msg = _msg_type_client + msg_task
   185         msg_task = _task_msgs[2]
   186         msg = _msg_type_client + msg_task
   190         msg_task = _task_msgs[3]
   191         msg = _msg_type_client + msg_task
   195         msg_task = _task_msgs[4]
   196         msg = _msg_type_client + msg_task
   200         msg_task = _task_msgs[5]
   201         msg = _msg_type_client + msg_task
   205         msg_task = _task_msgs[6]
   206         msg = _msg_type_client + msg_task
   211         msg_task = _task_msgs[7]
   212         msg = _msg_type_client + msg_task
   218         @type test_client: hironx_ros_robotics.abst_acceptancetest.AbstAcceptanceTest     220         test_client.go_initpos()
   221         arm = Constant.GRNAME_LEFT_ARM
   223                                      'Task1 {}'.format(arm))
   225         arm = Constant.GRNAME_RIGHT_ARM
   227                                      'Task1 {}'.format(arm))
   231         print(
'** _move_armbyarm_pose isn\'t yet implemented')
   236         @type test_client: hironx_ros_robotics.abst_acceptancetest.AbstAcceptanceTest     238         test_client.go_initpos()
   239         arm = Constant.GRNAME_LEFT_ARM
   240         test_client.set_joint_angles(
   245         arm = Constant.GRNAME_RIGHT_ARM
   246         test_client.set_joint_angles(
   252         test_client.go_initpos()
   257         total_increment = int(t_total_sec / t)
   258         msg_1 = (
'Right arm is moving upward with' +
   259                  '{}mm increment per {}s'.format(delta, t))
   260         msg_2 = 
' (Total {}cm over {}s).'.format(delta * total_increment, t_total_sec)
   262         for i 
in range(total_increment):
   263             msg_eachloop = 
'{}th loop;'.format(i)
   264             test_client.set_pose_relative(
   265                      Constant.GRNAME_RIGHT_ARM, dz=delta,
   266                      msg_tasktitle=msg_eachloop, task_duration=t, do_wait=
True)
   269         test_client.go_initpos()
   272             test_client.set_joint_angles(
   273                                Constant.GRNAME_HEAD,
   277             test_client.set_joint_angles(
   278                                      Constant.GRNAME_HEAD, positions,
   282         test_client.go_initpos()
   284             test_client.set_joint_angles(Constant.GRNAME_TORSO,
   288         test_client.go_initpos()
   289         test_client.set_joint_angles(
   293         test_client.set_joint_angles(
   299         test_client.go_initpos()
   300         test_client.set_joint_angles(
   303         test_client.set_joint_angles(
   305                    '(2) begins. Overwrite previous arm command.' +
   306                    '\n\tIn the beginning both arm starts to move to the' +
   307                    '\n\tsame height, but to the left arm interrupting' +
   308                    '\ncommand is sent and it goes downward.',
   311         test_client.set_joint_angles(
   316         test_client.go_initpos()
   319         larm = Constant.GRNAME_LEFT_ARM
   320         rarm = Constant.GRNAME_RIGHT_ARM
   322         test_client.set_pose(
   325         test_client.set_pose(
   330         test_client.set_pose(
   333         test_client.set_pose(
   339 from hrpsys 
import rtm
   341 if __name__ == 
'__main__':
   342     parser = argparse.ArgumentParser(description=
'hiro command line interpreters')
   343     parser.add_argument(
'--host', help=
'corba name server hostname')
   344     parser.add_argument(
'--port', help=
'corba name server port number')
   345     parser.add_argument(
'--modelfile', help=
'robot model file nmae')
   346     parser.add_argument(
'--robot', help=
'robot modlule name (RobotHardware0 for real robot, Robot()')
   347     args, unknown = parser.parse_known_args()
   350         rtm.nshost = args.host
   352         rtm.nsport = args.port
   354         args.robot = 
'RobotHardware0' if args.host 
else 'HiroNX(Robot)0'   355     if not args.modelfile:
   359     if len(unknown) >= 2:
   360         args.robot = unknown[0]
   361         args.modelfile = unknown[1]
 def _run_tests(self, test_client, do_wait_input=False)
def _show_workspace(self, test_client)
def __init__(self, rtm_robotname='HiroNX(Robot) 0', url='')
def _overwrite_torso(self, test_client)
list _POSITIONS_LARM_DEG_UP_SYNC
def _move_head(self, test_client)
float _DURATION_EACH_SMALLINCREMENT
def run_tests_rtm(self, do_wait_input=False)
def _wait_input(self, msg, do_wait_input=False)
def _move_armbyarm_jointangles(self, test_client)
list _ROTATION_ANGLES_HEAD_1
float _TASK_DURATION_TORSO
list _ROTATION_ANGLES_HEAD_2
list _POSITIONS_LARM_DEG_DOWN
list _POSITIONS_LARM_DEG_UP
list _POSITIONS_RARM_DEG_UP_SYNC
def _move_torso(self, test_client)
def _movearms_together(self, test_client)
list _POSITIONS_TORSO_DEG
float _R_Z_SMALLINCREMENT
int _DURATON_TOTAL_SMALLINCREMENT
tuple _RPY_R_X_NEAR_Y_FAR
def _move_armbyarm_pose(self, test_client)
def _set_pose_relative(self, test_client)
def run_tests_ros(self, do_wait_input=False)
def _overwrite_arm(self, test_client)
tuple _RPY_L_X_NEAR_Y_FAR
float _TASK_DURATION_DEFAULT
list _POSITIONS_RARM_DEG_DOWN
float _TASK_DURATION_HEAD