|
@@ -17,7 +17,6 @@ import traceback
|
|
import json
|
|
import json
|
|
import pandas as pd
|
|
import pandas as pd
|
|
from enum import Enum
|
|
from enum import Enum
|
|
-import elevation_0323 as el
|
|
|
|
from xml.sax.saxutils import escape
|
|
from xml.sax.saxutils import escape
|
|
|
|
|
|
import warnings
|
|
import warnings
|
|
@@ -340,50 +339,23 @@ class Scenario(ScenarioGenerator):
|
|
|
|
|
|
lasth = float(egodata.at[0, h])
|
|
lasth = float(egodata.at[0, h])
|
|
init_flag = True
|
|
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):
|
|
def scenario(self, **kwargs):
|
|
road = xosc.RoadNetwork(roadfile=xodr_list[self.map_id],
|
|
road = xosc.RoadNetwork(roadfile=xodr_list[self.map_id],
|