LingxinMeng 7 maanden geleden
bovenliggende
commit
a9b7394508
1 gewijzigde bestanden met toevoegingen van 6 en 23 verwijderingen
  1. 6 23
      src/python2/pjibot_delivery/simulation-pjibot_delivery.py

+ 6 - 23
src/python2/pjibot_delivery/simulation-pjibot_delivery.py

@@ -27,6 +27,8 @@ sleep_time = 60  # 每多少秒扫描一次
 def move_xosc_before_simulation(root_path):
     try:
         xosc_path = root_path + 'scenario_orig.xosc'
+        xodr_path = root_path + xodr
+        osgb_path = root_path + osgb
         logging.info('仿真还原需要的 xosc 路径为:%s' % xosc_path)
         tree1 = ET.parse(xosc_path)
 
@@ -38,30 +40,11 @@ def move_xosc_before_simulation(root_path):
                     src_file_prefix = path3
                     if 'LogicFile' == node1.tag:
                         if xodr in node1.get('filepath'):
-                            dst_file = root_path + xodr
-                            shutil.copy(src_file_prefix + xodr, dst_file)
-                            node1.set('filepath', dst_file)
-                        if xodr in node1.get('filepath'):
-                            dst_file = root_path + xodr
-                            shutil.copy(src_file_prefix + xodr, dst_file)
-                            node1.set('filepath', dst_file)
-                        if xodr in node1.get('filepath'):
-                            dst_file = root_path + xodr
-                            shutil.copy(src_file_prefix + xodr, dst_file)
-                            node1.set('filepath', dst_file)
+                            shutil.copy(src_file_prefix + xodr, xodr_path)
+                            node1.set('filepath', xodr_path)
                     if 'SceneGraphFile' == node1.tag:
-                        if osgb in node1.get('filepath'):
-                            dst_file = root_path + osgb
-                            shutil.copy(src_file_prefix + osgb, dst_file)
-                            node1.set('filepath', dst_file)
-                        if osgb in node1.get('filepath'):
-                            dst_file = root_path + osgb
-                            shutil.copy(src_file_prefix + osgb, dst_file)
-                            node1.set('filepath', dst_file)
-                        if osgb in node1.get('filepath'):
-                            dst_file = root_path + osgb
-                            shutil.copy(src_file_prefix + osgb, dst_file)
-                            node1.set('filepath', dst_file)
+                        shutil.copy(src_file_prefix + osgb, osgb_path)
+                        node1.set('filepath', osgb_path)
             if node0.tag == 'Entities':
                 for node1 in node0:
                     if node1.get("name") == 'Ego':