Go to the documentation of this file.00001
00002 from hrl_generic_arms.ep_control import EPGenerator, EPC, EPStopConditions
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 def evaluate_trajectories(ep_gen_setup_creator, ep_gen_setup_params,
00013 ep_gen_eval_creator, ep_gen_eval_params, time_step, timeout):
00014 epc = EPC('eval_trajs')
00015 result_dict = {'test not run' : len(ep_gen_eval_params)}
00016 result_list = ['test not run'] * len(ep_gen_eval_params)
00017 i = 0
00018 for ep_gen_setup_param, ep_gen_eval_param in zip(ep_gen_setup_params, ep_gen_eval_params):
00019 ep_gen_setup = ep_gen_eval_creator(ep_gen_param)
00020 stop = epc.epc_motion(ep_gen_setup, time_step, timeout)
00021 if stop == EPStopConditions.ROSPY_SHUTDOWN
00022 break
00023 if stop == EPStopConditions.SUCCESSFUL:
00024 ep_gen_eval = ep_gen_eval_creator(ep_gen_eval_param)
00025 stop = epc.epc_motion(ep_gen_eval, time_step, timeout)
00026 if stop == EPStopConditions.ROSPY_SHUTDOWN
00027 break
00028 else:
00029 rospy.loginfo('[evaluate_trajectories] Unsuccessful setup, not doing trajectory.')
00030 stop = 'unsuccessful setup'
00031 if stop not in result_dict:
00032 result_dict[stop] = 1
00033 else:
00034 result_dict[stop] += 1
00035 result_dict['test not run'] -= 1
00036 result_list[i] = stop
00037 i += 1
00038 yield result_dict, result_list
00039