Go to the documentation of this file.00001
00002 import subprocess as sub
00003 import threading
00004
00005 class RunCmd(threading.Thread):
00006 def __init__(self, cmd, timeout):
00007 threading.Thread.__init__(self)
00008 self.cmd = cmd
00009 self.timeout = timeout
00010
00011 def run(self):
00012 self.p = sub.Popen(self.cmd)
00013 self.p.wait()
00014
00015 def Run(self):
00016 self.start()
00017 self.join(self.timeout)
00018
00019 if self.is_alive():
00020 self.p.terminate()
00021 self.join()
00022
00023 if __name__ == "__main__":
00024 step = 0.1;
00025 inner_start = 0.1;
00026 outer_start = 0.1;
00027 inner_final = 1.0;
00028 outer_final = 1.0;
00029
00030 print "T:",int(outer_final/step);
00031 print "Range:",range(2)
00032
00033
00034 for i in range(int(outer_final/step)+1):
00035 for j in range(i,int(inner_final/step)+1):
00036 outer = outer_start + step*i;
00037 inner = inner_start + step*j;
00038 sub.call(["./do_batch.sh",str(inner),str(outer)]);
00039 sub.call(["rospack","find","caddy_uwsim"]);
00040 RunCmd(["roslaunch", "simulation_batch.launch"], 240).Run();
00041
00042