LingxinMeng 7 месяцев назад
Родитель
Сommit
b3a4bcabcd

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

@@ -75,10 +75,14 @@ def move_xosc_before_simulation(root_path):
                     # 打印根元素的标签名
                     if 'LogicFile' == node1.tag:
                         xodr_src = str(node1.get('filepath'))
-                        shutil.copy(xodr_src, root_path + xodr_src.rsplit('/', 1)[-1])
+                        xodr_target = root_path + xodr_src.rsplit('/', 1)[-1]
+                        shutil.copy(xodr_src, xodr_target)
+                        node1.set('filepath', xodr_target)
                     if 'SceneGraphFile' == node1.tag:
                         osgb_src = str(node1.get('filepath'))
-                        shutil.copy(osgb_src, root_path + osgb_src.rsplit('/', 1)[-1])
+                        osgb_target = root_path + osgb_src.rsplit('/', 1)[-1]
+                        shutil.copy(osgb_src, osgb_target)
+                        node1.set('filepath', osgb_target)
             if node0.tag == 'Entities':
                 for node1 in node0:
                     if node1.get("name") == 'Ego':

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

@@ -31,10 +31,14 @@ def move_xosc_before_simulation(root_path):
                     # 打印根元素的标签名
                     if 'LogicFile' == node1.tag:
                         xodr_src = str(node1.get('filepath'))
-                        shutil.copy(xodr_src, root_path + xodr_src.rsplit('/', 1)[-1])
+                        xodr_target = root_path + xodr_src.rsplit('/', 1)[-1]
+                        shutil.copy(xodr_src, xodr_target)
+                        node1.set('filepath', xodr_target)
                     if 'SceneGraphFile' == node1.tag:
                         osgb_src = str(node1.get('filepath'))
-                        shutil.copy(osgb_src, root_path + osgb_src.rsplit('/', 1)[-1])
+                        osgb_target = root_path + osgb_src.rsplit('/', 1)[-1]
+                        shutil.copy(osgb_src, osgb_target)
+                        node1.set('filepath', osgb_target)
             if node0.tag == 'Entities':
                 for node1 in node0:
                     if node1.get("name") == 'Ego':

+ 6 - 2
src/python2/pjibot_patrol/simulation-pjibot_patrol.py

@@ -33,10 +33,14 @@ def move_xosc_before_simulation(root_path):
                     # 打印根元素的标签名
                     if 'LogicFile' == node1.tag:
                         xodr_src = str(node1.get('filepath'))
-                        shutil.copy(xodr_src, root_path + xodr_src.rsplit('/', 1)[-1])
+                        xodr_target = root_path + xodr_src.rsplit('/', 1)[-1]
+                        shutil.copy(xodr_src, xodr_target)
+                        node1.set('filepath', xodr_target)
                     if 'SceneGraphFile' == node1.tag:
                         osgb_src = str(node1.get('filepath'))
-                        shutil.copy(osgb_src, root_path + osgb_src.rsplit('/', 1)[-1])
+                        osgb_target = root_path + osgb_src.rsplit('/', 1)[-1]
+                        shutil.copy(osgb_src, osgb_target)
+                        node1.set('filepath', osgb_target)
             if node0.tag == 'Entities':
                 for node1 in node0:
                     if node1.get("name") == 'Ego':