LingxinMeng 7 maanden geleden
bovenliggende
commit
895ea3b329
2 gewijzigde bestanden met toevoegingen van 21 en 49 verwijderingen
  1. 4 4
      src/python2/pjibot_delivery/2xosc-pjibot_delivery.py
  2. 17 45
      src/python3/pjibot_outdoor/openx_outdoor.py

+ 4 - 4
src/python2/pjibot_delivery/2xosc-pjibot_delivery.py

@@ -62,15 +62,15 @@ if __name__ == '__main__':
                             if '/pos_pji.csv' in str(obj3.key):
                                 csv2_done = True
                         if xosc_done:
-                            logging.info("存在 simulation.xosc(scenario.xosc): %s" % str(parse_prefix_full))
+                            # logging.info("存在 simulation.xosc(scenario.xosc): %s" % str(parse_prefix_full))
                             continue
                         if not csv1_done:
-                            logging.info("不存在 /objects_pji.csv: %s" % str(parse_prefix_full))
+                            # logging.info("不存在 /objects_pji.csv: %s" % str(parse_prefix_full))
                             continue
                         if not csv2_done:
-                            logging.info("不存在 /pos_pji.csv: %s" % str(parse_prefix_full))
+                            # logging.info("不存在 /pos_pji.csv: %s" % str(parse_prefix_full))
                             continue
-                        logging.info("需要生成 simulation.xosc: %s" % str(parse_prefix_full))
+                        logging.info("需要生成 simulation.xosc(scenario.xosc): %s" % str(parse_prefix_full))
                         local_dir_full = path1 + parse_prefix_full
                         if not os.path.exists(local_dir_full):
                             os.makedirs(local_dir_full)

+ 17 - 45
src/python3/pjibot_outdoor/openx_outdoor.py

@@ -17,7 +17,6 @@ import traceback
 import json
 import pandas as pd
 from enum import Enum
-import elevation_0323 as el
 from xml.sax.saxutils import escape
 
 import warnings
@@ -340,50 +339,23 @@ class Scenario(ScenarioGenerator):
         
         lasth = float(egodata.at[0, h])
         init_flag = True
-    
-        # two method to set z value
-        zflag = 0 # 1
-        if zflag:
-            # 根据地图的xy值计算z值
-            zfile = '/home/hancheng/weihao/gongyuanbei_elevation.csv'
-            # zfile = '/home/hancheng/simulation_dynamic/elevation_df_taiheqiao.csv'
-            zdata = pd.read_csv(zfile)
-
-            for row in egodata.iterrows():
-                hhh = math.radians(row[1][h])
-                xodr_z = el.cal_elevation(zdata, float(row[1][e]), float(row[1][n]))
-                if init_flag:
-                    position.append(xosc.WorldPosition(x=float(row[1][e]), y=float(row[1][n]), z=xodr_z, h=hhh, p=0, r=0))
-                    init_flag = False
-                else:
-                    if float(row[1][h]) - lasth > 300:
-                        hhh = math.radians(float(row[1][h]) - 360)
-                    elif float(row[1][h]) - lasth < -300:
-                        hhh = math.radians(float(row[1][h]) + 360)
-                    position.append(xosc.WorldPosition(x=float(row[1][e]), y=float(row[1][n]), z=xodr_z, h=hhh, p=0, r=0))
-                    lasth = float(row[1][h])
-                time.append(float(row[1][t]))
-                # time.append(cur_time)
-                # cur_time += 0.1
-            return position, time, ego_type
-        else:
-            # z = 0
-            for row in egodata.iterrows():
-                hhh = math.radians(row[1][h])
-                if init_flag:
-                    position.append(xosc.WorldPosition(x=float(row[1][e]), y=float(row[1][n]), z=float(row[1][z]), h=hhh, p=0, r=0))
-                    init_flag = False
-                else:
-                    if float(row[1][h]) - lasth > 300:
-                        hhh = math.radians(float(row[1][h]) - 360)
-                    elif float(row[1][h]) - lasth < -300:
-                        hhh = math.radians(float(row[1][h]) + 360)
-                    position.append(xosc.WorldPosition(x=float(row[1][e]), y=float(row[1][n]), z=float(row[1][z]), h=hhh, p=0, r=0))
-                    lasth = float(row[1][h])
-                time.append(float(row[1][t]))
-                # time.append(cur_time)
-                # cur_time += 0.1
-            return position, time, ego_type
+
+        for row in egodata.iterrows():
+            hhh = math.radians(row[1][h])
+            if init_flag:
+                position.append(xosc.WorldPosition(x=float(row[1][e]), y=float(row[1][n]), z=float(row[1][z]), h=hhh, p=0, r=0))
+                init_flag = False
+            else:
+                if float(row[1][h]) - lasth > 300:
+                    hhh = math.radians(float(row[1][h]) - 360)
+                elif float(row[1][h]) - lasth < -300:
+                    hhh = math.radians(float(row[1][h]) + 360)
+                position.append(xosc.WorldPosition(x=float(row[1][e]), y=float(row[1][n]), z=float(row[1][z]), h=hhh, p=0, r=0))
+                lasth = float(row[1][h])
+            time.append(float(row[1][t]))
+            # time.append(cur_time)
+            # cur_time += 0.1
+        return position, time, ego_type
 
     def scenario(self, **kwargs):
         road = xosc.RoadNetwork(roadfile=xodr_list[self.map_id],