|
@@ -927,21 +927,22 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
// File file = null;
|
|
// File file = null;
|
|
try {
|
|
try {
|
|
//2.解析仿真文件
|
|
//2.解析仿真文件
|
|
- //time
|
|
|
|
|
|
+ // time
|
|
List<Double> time_list = new ArrayList<>();
|
|
List<Double> time_list = new ArrayList<>();
|
|
- //velocity
|
|
|
|
|
|
+ // velocity
|
|
List<Double> velocity_list = new ArrayList<>();
|
|
List<Double> velocity_list = new ArrayList<>();
|
|
List<Double> lateral_velocity_list = new ArrayList<>();//横 时间
|
|
List<Double> lateral_velocity_list = new ArrayList<>();//横 时间
|
|
List<Double> longitudinal_velocity_list = new ArrayList<>();//纵 速度
|
|
List<Double> longitudinal_velocity_list = new ArrayList<>();//纵 速度
|
|
- //acceleration
|
|
|
|
- List<Double> acceleration_list = new ArrayList<>();
|
|
|
|
- List<Double> lateral_acceleration = new ArrayList<>();//纵向加速度
|
|
|
|
- List<Double> longitudinal_acceleration_list = new ArrayList<>();//纵向加速度
|
|
|
|
- //lane_offset
|
|
|
|
|
|
+ // acceleration
|
|
|
|
+// List<Double> acceleration_list = new ArrayList<>();
|
|
|
|
+// List<Double> acceleration_list_longitudinal = new ArrayList<>();
|
|
|
|
+ List<Double> lateral_acceleration_list = new ArrayList<>(); // 横向加速度
|
|
|
|
+ List<Double> longitudinal_acceleration_list = new ArrayList<>(); // 纵向加速度
|
|
|
|
+ // lane_offset
|
|
List<Double> lane_offset_list = new ArrayList<>();
|
|
List<Double> lane_offset_list = new ArrayList<>();
|
|
///TODO brake
|
|
///TODO brake
|
|
List<Double> brake_list = new ArrayList<>();
|
|
List<Double> brake_list = new ArrayList<>();
|
|
- //steeting_wheel
|
|
|
|
|
|
+ // steeting_wheel
|
|
List<Double> steeting_wheel_list = new ArrayList<>();
|
|
List<Double> steeting_wheel_list = new ArrayList<>();
|
|
///TODO throttle
|
|
///TODO throttle
|
|
List<Double> throttle_list = new ArrayList<>();
|
|
List<Double> throttle_list = new ArrayList<>();
|
|
@@ -978,6 +979,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
String[] split = line.split(",");
|
|
String[] split = line.split(",");
|
|
|
|
|
|
////添加异常捕获,非正常数据默认为0
|
|
////添加异常捕获,非正常数据默认为0
|
|
|
|
+ // 时间
|
|
try {
|
|
try {
|
|
double aDouble = Double.parseDouble(split[1]);
|
|
double aDouble = Double.parseDouble(split[1]);
|
|
if (Double.isNaN(aDouble)) {
|
|
if (Double.isNaN(aDouble)) {
|
|
@@ -989,7 +991,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
time_list.add(0D);
|
|
time_list.add(0D);
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
|
|
+ // 横向速度
|
|
try {
|
|
try {
|
|
double aDouble = Double.parseDouble(split[6]);
|
|
double aDouble = Double.parseDouble(split[6]);
|
|
if (Double.isNaN(aDouble)) {
|
|
if (Double.isNaN(aDouble)) {
|
|
@@ -997,11 +999,11 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
} else {
|
|
} else {
|
|
lateral_velocity_list.add(Double.valueOf(split[6]));
|
|
lateral_velocity_list.add(Double.valueOf(split[6]));
|
|
}
|
|
}
|
|
-
|
|
|
|
} catch (NumberFormatException e) {
|
|
} catch (NumberFormatException e) {
|
|
lateral_velocity_list.add(0D);
|
|
lateral_velocity_list.add(0D);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 纵向速度
|
|
try {
|
|
try {
|
|
double aDouble = Double.parseDouble(split[7]);
|
|
double aDouble = Double.parseDouble(split[7]);
|
|
if (Double.isNaN(aDouble)) {
|
|
if (Double.isNaN(aDouble)) {
|
|
@@ -1014,17 +1016,19 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+ // 横向加速度
|
|
try {
|
|
try {
|
|
double aDouble = Double.parseDouble(split[8]);
|
|
double aDouble = Double.parseDouble(split[8]);
|
|
if (Double.isNaN(aDouble)) {
|
|
if (Double.isNaN(aDouble)) {
|
|
- lateral_acceleration.add(0D);
|
|
|
|
|
|
+ lateral_acceleration_list.add(0D);
|
|
} else {
|
|
} else {
|
|
- lateral_acceleration.add(Double.valueOf(split[8]));
|
|
|
|
|
|
+ lateral_acceleration_list.add(Double.valueOf(split[8]));
|
|
}
|
|
}
|
|
} catch (NumberFormatException e) {
|
|
} catch (NumberFormatException e) {
|
|
- lateral_acceleration.add(0D);
|
|
|
|
|
|
+ lateral_acceleration_list.add(0D);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ // 纵向加速度
|
|
try {
|
|
try {
|
|
double aDouble = Double.parseDouble(split[9]);
|
|
double aDouble = Double.parseDouble(split[9]);
|
|
if (Double.isNaN(aDouble)) {
|
|
if (Double.isNaN(aDouble)) {
|
|
@@ -1036,6 +1040,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
longitudinal_acceleration_list.add(0D);
|
|
longitudinal_acceleration_list.add(0D);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ //
|
|
try {
|
|
try {
|
|
double aDouble = Double.parseDouble(split[12]);
|
|
double aDouble = Double.parseDouble(split[12]);
|
|
if (Double.isNaN(aDouble)) {
|
|
if (Double.isNaN(aDouble)) {
|
|
@@ -1059,8 +1064,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
- Double aDouble = Double.valueOf(split[27]);
|
|
|
|
- if (aDouble.isNaN()) {
|
|
|
|
|
|
+ double aDouble = Double.parseDouble(split[27]);
|
|
|
|
+ if (Double.isNaN(aDouble)) {
|
|
lane_offset_list.add(0D);
|
|
lane_offset_list.add(0D);
|
|
} else {
|
|
} else {
|
|
lane_offset_list.add(Double.valueOf(split[27]));//lane_center_offset
|
|
lane_offset_list.add(Double.valueOf(split[27]));//lane_center_offset
|
|
@@ -1073,7 +1078,7 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
// throttle_list.add(Double.valueOf(split[]));///TODO 没有
|
|
// throttle_list.add(Double.valueOf(split[]));///TODO 没有
|
|
|
|
|
|
}
|
|
}
|
|
- //里程
|
|
|
|
|
|
+ // 里程
|
|
double lc = 0.0;
|
|
double lc = 0.0;
|
|
for (int i = 0; i < time_list.size(); i++) {
|
|
for (int i = 0; i < time_list.size(); i++) {
|
|
if (i == 0) {
|
|
if (i == 0) {
|
|
@@ -1083,26 +1088,19 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- //平均速度
|
|
|
|
|
|
+ // 平均速度
|
|
Double pjsd = lc / time_list.get(time_list.size() - 1);
|
|
Double pjsd = lc / time_list.get(time_list.size() - 1);
|
|
pjsd = saveTwoDecimalPlaces(pjsd, 4);
|
|
pjsd = saveTwoDecimalPlaces(pjsd, 4);
|
|
|
|
|
|
- //最大速度
|
|
|
|
- Double zdsd = Collections.max(longitudinal_velocity_list);
|
|
|
|
-
|
|
|
|
- //最小速度
|
|
|
|
- Double zxsd = Collections.min(longitudinal_velocity_list);
|
|
|
|
-
|
|
|
|
- //最大加速度
|
|
|
|
- Double zdjiasd = Collections.max(longitudinal_acceleration_list);
|
|
|
|
|
|
+ Double zdsd = Collections.max(longitudinal_velocity_list); // 最大速度
|
|
|
|
+ Double zxsd = Collections.min(longitudinal_velocity_list); // 最小速度
|
|
|
|
+ Double maxLateralAcceleration = Collections.max(lateral_acceleration_list); // 最大横向加速度
|
|
|
|
+ Double minLateralAcceleration = Collections.min(lateral_acceleration_list); // 最小横向加速度(最大横向减速度)
|
|
|
|
+ Double maxLongitudinalAcceleration = Collections.max(longitudinal_acceleration_list); // 最大纵向加速度
|
|
|
|
+ Double minLongitudinalAcceleration = Collections.min(longitudinal_acceleration_list); // 最小纵向加速度
|
|
|
|
+ Double zdbjsd = Collections.max(yawrate_list); // 最大摆角速度
|
|
|
|
|
|
- //最大减速度
|
|
|
|
- Double zdjiansd = Collections.min(longitudinal_acceleration_list);
|
|
|
|
-
|
|
|
|
- //最大摆角速度
|
|
|
|
- Double zdbjsd = Collections.max(yawrate_list);
|
|
|
|
-
|
|
|
|
- //自车速度方差
|
|
|
|
|
|
+ // 自车速度方差
|
|
Double zcsdfc = 0D;
|
|
Double zcsdfc = 0D;
|
|
for (Double d : longitudinal_velocity_list) {
|
|
for (Double d : longitudinal_velocity_list) {
|
|
zcsdfc += Math.pow(d - pjsd, 2);
|
|
zcsdfc += Math.pow(d - pjsd, 2);
|
|
@@ -1119,12 +1117,12 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
zchbjsdjfg = Math.sqrt(zchbjsdjfg / yawrate_list.size());
|
|
zchbjsdjfg = Math.sqrt(zchbjsdjfg / yawrate_list.size());
|
|
zchbjsdjfg = saveTwoDecimalPlaces(zchbjsdjfg, 4);
|
|
zchbjsdjfg = saveTwoDecimalPlaces(zchbjsdjfg, 4);
|
|
|
|
|
|
- for (int i = 0; i < lateral_acceleration.size(); i++) {
|
|
|
|
- Double aDouble = lateral_acceleration.get(i);
|
|
|
|
- Double aDouble1 = longitudinal_acceleration_list.get(i);
|
|
|
|
- double d = Math.pow(aDouble, 2) + Math.pow(aDouble1, 2);
|
|
|
|
- acceleration_list.add(Math.sqrt(d));
|
|
|
|
- }
|
|
|
|
|
|
+// for (int i = 0; i < lateral_acceleration.size(); i++) {
|
|
|
|
+// Double aDouble = lateral_acceleration.get(i);
|
|
|
|
+// Double aDouble1 = longitudinal_acceleration_list.get(i);
|
|
|
|
+// double d = Math.pow(aDouble, 2) + Math.pow(aDouble1, 2);
|
|
|
|
+// acceleration_list.add(Math.sqrt(d));
|
|
|
|
+// }
|
|
|
|
|
|
for (int i = 0; i < lateral_velocity_list.size(); i++) {
|
|
for (int i = 0; i < lateral_velocity_list.size(); i++) {
|
|
Double aDouble = lateral_velocity_list.get(i);
|
|
Double aDouble = lateral_velocity_list.get(i);
|
|
@@ -1154,10 +1152,12 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
//任务详情信息
|
|
//任务详情信息
|
|
resultVo.setMileage(Double.toString(lc));
|
|
resultVo.setMileage(Double.toString(lc));
|
|
resultVo.setAverageVelocity(saveTwoDecimalPlaces(pjsd * 3.6, 4).toString());
|
|
resultVo.setAverageVelocity(saveTwoDecimalPlaces(pjsd * 3.6, 4).toString());
|
|
- resultVo.setMaximunSpeed(zdsd.toString());
|
|
|
|
- resultVo.setMinimunVelocity(zxsd.toString());
|
|
|
|
- resultVo.setMaximumAcceleration(zdjiasd.toString());
|
|
|
|
- resultVo.setMaximumDeceleration(zdjiansd.toString());
|
|
|
|
|
|
+ resultVo.setMaximunSpeed(zdsd.toString()); // 最大速度
|
|
|
|
+ resultVo.setMinimunVelocity(zxsd.toString()); // 最小速度
|
|
|
|
+ resultVo.setMaximumAcceleration(maxLateralAcceleration.toString()); // 最大横向加速度
|
|
|
|
+ resultVo.setMaximumDeceleration(minLateralAcceleration.toString()); // 最大横向减速度
|
|
|
|
+ resultVo.setMaxLongitudinalAcceleration(maxLongitudinalAcceleration.toString()); // 最大纵向加速度
|
|
|
|
+ resultVo.setMinLongitudinalAcceleration(minLongitudinalAcceleration.toString()); // 最小纵向加速度
|
|
resultVo.setMaximumSwingSpeed(zdbjsd.toString());
|
|
resultVo.setMaximumSwingSpeed(zdbjsd.toString());
|
|
resultVo.setSpeedVariance(zcsdfc);
|
|
resultVo.setSpeedVariance(zcsdfc);
|
|
// resultVo.setSpeedComfortLevel(po.getSpeedComfortLevel());
|
|
// resultVo.setSpeedComfortLevel(po.getSpeedComfortLevel());
|
|
@@ -1168,7 +1168,8 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
|
|
|
|
HashMap<String, List> CurveData = new HashMap<>();
|
|
HashMap<String, List> CurveData = new HashMap<>();
|
|
CurveData.put("time", time_list);
|
|
CurveData.put("time", time_list);
|
|
- CurveData.put("acceleration", acceleration_list);
|
|
|
|
|
|
+ CurveData.put("acceleration", lateral_acceleration_list);
|
|
|
|
+ CurveData.put("acceleration_longitudinal", longitudinal_acceleration_list);
|
|
CurveData.put("lane_offset", lane_offset_list);
|
|
CurveData.put("lane_offset", lane_offset_list);
|
|
CurveData.put("brake", brake_list);
|
|
CurveData.put("brake", brake_list);
|
|
CurveData.put("steeting", steeting_wheel_list);
|
|
CurveData.put("steeting", steeting_wheel_list);
|