Example #1
0
    def test3g(self):

        # files = ['./testcases/3g3_m1.txt','./testcases/4g3_m2.txt']

        # colide
        # check collision more times in long distance one
        # files = ['./testcases/g2_m1.txt','./testcases/3g2_m2.txt']
        files = ['./testcases/4g3_m1.txt']
        # files = ['./testcases/4g3_m2.txt']

        # no result
        # files = ['./testcases/3g2_m2.txt','./testcases/3g3_m1.txt']

        # use global is enough, or the last with local
        # files = ['./testcases/3g2_m1.txt','./testcases/3g2_m2.txt', './testcases/3g3_m1.txt']
        files = [
            './testcases/3g1_m0.txt', './testcases/3g1_m1.txt',
            './testcases/3g1_m2.txt', './testcases/4g1_m1.txt',
            './testcases/4g1_m2.txt', './testcases/3g2_m1.txt',
            './testcases/3g2_m2.txt', './testcases/3g3_m1.txt'
        ]
        for i in range(len(files)):
            fileName = files[i].split('/')[-1]
            sol = './out/' + fileName[:-4] + '_output.txt'
            prm = PRM(files[i])
            flagPRM, ee1flag = prm.run_PRM(sol)
            # flagPRM=True
            if flagPRM:
                aa = test_robot(prm)
                qq = aa.load_output(sol)
                strlist = []
                for j in qq:
                    strlist.append(str(j))
                # ee1flag=[]
                gginterpolat = Interpolation(strlist, ee1flag)
                interpolation_path = sol[:-4] + '_ip.txt'
                print("Run interpolation")
                gg = gginterpolat.run_Interpolate()
                write_sampling_config(interpolation_path, prm.num_segments, gg)
                result = tester_main(files[i], interpolation_path)
                if (result == 0):
                    print(files[i] + ' success')
                else:
                    print(files[i] + ' fails')
            else:
                print(files[i] + ' fails')
                result = 1
            self.assertEqual(result, 0)
Example #2
0
def main(arglist):
    # def main():
    inputfilename = arglist[0]
    sol = inputfilename + '_output.txt'
    # interpolation_path = sol[:-4] +'_ip.txt'
    interpolation_path = arglist[1]
    prm = PRM(inputfilename)
    flagPRM, ee1flag = prm.run_PRM(sol)
    # flagPRM=True
    aa = test_robot(prm)
    qq = aa.load_output(sol)
    strlist = []
    for j in qq:
        strlist.append(str(j))
    # ee1flag=[]
    gginterpolat = Interpolation(strlist, ee1flag)
    print("Run interpolation")
    gg = gginterpolat.run_Interpolate()
    write_sampling_config(interpolation_path, prm.num_segments, gg)
Example #3
0
 def test3g(self):
     files = ['./testcases/4g1_m1.txt']
     for i in range(len(files)):
         fileName = files[i].split('/')[-1]
         sol = './out/' + fileName[:-4] + '_output.txt'
         prm = EST(files[i])
         prm.run_EST(sol)
         aa = test_robot(prm)
         qq = aa.load_output(sol)
         strlist = []
         for j in qq:
             strlist.append(str(j))
         gginterpolat = Interpolation(strlist)
         interpolation_path = sol[:-4] + '_ip.txt'
         gg = gginterpolat.run_Interpolate()
         write_sampling_config(interpolation_path, prm.num_segments, gg)
         result = tester_main(files[i], interpolation_path)
         if (result == 0):
             print(files[i] + ' success')
         else:
             print(files[i] + ' fails')
         self.assertEqual(result, 0)