|
@@ -4,6 +4,7 @@ import api.common.pojo.common.PageVO;
|
|
import api.common.pojo.common.ResponseBodyVO;
|
|
import api.common.pojo.common.ResponseBodyVO;
|
|
import api.common.pojo.constants.DictConstants;
|
|
import api.common.pojo.constants.DictConstants;
|
|
import api.common.pojo.param.KafkaParameter;
|
|
import api.common.pojo.param.KafkaParameter;
|
|
|
|
+import api.common.pojo.param.MinioParameter;
|
|
import api.common.pojo.param.project.ProjectTaskParam;
|
|
import api.common.pojo.param.project.ProjectTaskParam;
|
|
import api.common.pojo.param.project.SceneScoreParam;
|
|
import api.common.pojo.param.project.SceneScoreParam;
|
|
import api.common.pojo.param.project.SimulationManualProjectKafkaParam;
|
|
import api.common.pojo.param.project.SimulationManualProjectKafkaParam;
|
|
@@ -25,6 +26,7 @@ import api.common.util.TimeUtil;
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
import com.css.simulation.resource.common.utils.AuthUtil;
|
|
import com.css.simulation.resource.common.utils.PageUtil;
|
|
import com.css.simulation.resource.common.utils.PageUtil;
|
|
import com.css.simulation.resource.feign.AlgoPlatformService;
|
|
import com.css.simulation.resource.feign.AlgoPlatformService;
|
|
|
|
+import com.css.simulation.resource.feign.FileDownService;
|
|
import com.css.simulation.resource.project.constants.ProjectConstants;
|
|
import com.css.simulation.resource.project.constants.ProjectConstants;
|
|
import com.css.simulation.resource.project.enums.ProjectRunStateEnum;
|
|
import com.css.simulation.resource.project.enums.ProjectRunStateEnum;
|
|
import com.css.simulation.resource.project.enums.SceneTypeEnum;
|
|
import com.css.simulation.resource.project.enums.SceneTypeEnum;
|
|
@@ -42,6 +44,7 @@ import com.itextpdf.text.pdf.BaseFont;
|
|
import com.itextpdf.text.pdf.PdfPCell;
|
|
import com.itextpdf.text.pdf.PdfPCell;
|
|
import com.itextpdf.text.pdf.PdfPTable;
|
|
import com.itextpdf.text.pdf.PdfPTable;
|
|
import com.itextpdf.text.pdf.PdfWriter;
|
|
import com.itextpdf.text.pdf.PdfWriter;
|
|
|
|
+import feign.Response;
|
|
import lombok.SneakyThrows;
|
|
import lombok.SneakyThrows;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
@@ -88,6 +91,9 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
@Resource
|
|
@Resource
|
|
AlgoPlatformService algoPlatformService;
|
|
AlgoPlatformService algoPlatformService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ FileDownService fileDownService;
|
|
|
|
+
|
|
private String[] dateFmtArr= new String[]{"yyyyMMdd", "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd"};
|
|
private String[] dateFmtArr= new String[]{"yyyyMMdd", "yyyy-MM-dd HH:mm:ss","yyyy-MM-dd"};
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -701,25 +707,198 @@ public class SimulationProjectServiceImpl implements SimulationProjectService {
|
|
resultVo.setRunState(po.getRunState());
|
|
resultVo.setRunState(po.getRunState());
|
|
resultVo.setFinishState(po.getRunResult());
|
|
resultVo.setFinishState(po.getRunResult());
|
|
resultVo.setSceneDescribe("");
|
|
resultVo.setSceneDescribe("");
|
|
- ///TODO 任务详情信息
|
|
|
|
- resultVo.setMileage(po.getMileage());
|
|
|
|
- resultVo.setAverageVelocity(po.getAverageVelocity());
|
|
|
|
- resultVo.setMaximunSpeed(po.getMaximunSpeed());
|
|
|
|
- resultVo.setMinimunVelocity(po.getMinimunVelocity());
|
|
|
|
- resultVo.setMaximumDeceleration(po.getMaximumDeceleration());
|
|
|
|
- resultVo.setMaximumSwingSpeed(po.getMaximumSwingSpeed());
|
|
|
|
- resultVo.setSpeedVariance(saveTwoDecimalPlaces(po.getSpeedVariance()));
|
|
|
|
- resultVo.setSpeedComfortLevel(po.getSpeedComfortLevel());
|
|
|
|
- resultVo.setSwingSpeedMeanSquareRoot(saveTwoDecimalPlaces(po.getSwingSpeedMeanSquareRoot()));
|
|
|
|
- resultVo.setSwingComfortLevel(po.getSwingComfortLevel());
|
|
|
|
- resultVo.setAcceleration(po.getAcceleration());
|
|
|
|
- resultVo.setLaneOffset(po.getLaneOffset());
|
|
|
|
- resultVo.setBrake(po.getBrake());
|
|
|
|
- resultVo.setSteetingWheel(po.getSteetingWheel());
|
|
|
|
- resultVo.setThrottle(po.getThrottle());
|
|
|
|
- resultVo.setYawRate(po.getYawRate());
|
|
|
|
- resultVo.setVelocity(po.getVelocity());
|
|
|
|
- resultVo.setOtherCurve(po.getOtherCurve());
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ ///TODO 1.获取仿真结果文件
|
|
|
|
+ try {
|
|
|
|
+ //2.解析仿真文件
|
|
|
|
+ //time
|
|
|
|
+ List<Double> time_list = new ArrayList<>();
|
|
|
|
+ //velocity
|
|
|
|
+ List<Double> velocity_list = new ArrayList<>();
|
|
|
|
+ List<Double> lateral_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
|
|
|
|
+ List<Double> lane_offset_list = new ArrayList<>();
|
|
|
|
+ ///TODO brake
|
|
|
|
+ List<Double> brake_list = new ArrayList<>();
|
|
|
|
+ //steeting_wheel
|
|
|
|
+ List<Double> steeting_wheel_list = new ArrayList<>();
|
|
|
|
+ ///TODO throttle
|
|
|
|
+ List<Double> throttle_list = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ List<Double> yawrate_list = new ArrayList<>();//摆角速度
|
|
|
|
+
|
|
|
|
+ File file = new File("E:\\仿真云平台\\任务详情界面数据\\Ego(1).csv");
|
|
|
|
+ InputStream fileInputStream = new FileInputStream(file);
|
|
|
|
+ InputStreamReader inputStreamReader = new InputStreamReader(fileInputStream,"utf-8");
|
|
|
|
+
|
|
|
|
+/* MinioParameter minioParameter = new MinioParameter();
|
|
|
|
+// minioParameter.setObjectName(po.getRunResultFilePath()+"/ego.csv");
|
|
|
|
+ minioParameter.setObjectName("test/ego.csv");
|
|
|
|
+ Response download = fileDownService.download(minioParameter);
|
|
|
|
+ Response.Body body = download.body();
|
|
|
|
+ InputStream inputStream = body.asInputStream();
|
|
|
|
+ InputStreamReader inputStreamReader = new InputStreamReader(inputStream,"utf-8");*/
|
|
|
|
+
|
|
|
|
+ BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
|
|
|
|
+ String line;
|
|
|
|
+ int lineIndex = 0;
|
|
|
|
+ while((line = bufferedReader.readLine()) != null){
|
|
|
|
+ lineIndex++;
|
|
|
|
+ if(lineIndex == 1){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ String[] split = line.split(",");
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ time_list.add(Double.valueOf(split[1]));
|
|
|
|
+ }catch (NumberFormatException e){
|
|
|
|
+ time_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ lateral_velocity_list.add(Double.valueOf(split[6]));
|
|
|
|
+ }catch (NumberFormatException e){
|
|
|
|
+ lateral_velocity_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ longitudinal_velocity_list.add(Double.valueOf(split[7]));
|
|
|
|
+ }catch (NumberFormatException e){
|
|
|
|
+ longitudinal_velocity_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ lateral_acceleration.add(Double.valueOf(split[8]));
|
|
|
|
+ }catch (NumberFormatException e){
|
|
|
|
+ lateral_acceleration.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ longitudinal_acceleration_list.add(Double.valueOf(split[9]));
|
|
|
|
+ }catch (NumberFormatException e){
|
|
|
|
+ longitudinal_acceleration_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ steeting_wheel_list.add(Double.valueOf(split[12]));//steering_angle
|
|
|
|
+ }catch (NumberFormatException e){
|
|
|
|
+ steeting_wheel_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ yawrate_list.add(Double.valueOf(split[13]));
|
|
|
|
+ }catch (NumberFormatException e){
|
|
|
|
+ yawrate_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ lane_offset_list.add(Double.valueOf(split[27]));//lane_center_offset
|
|
|
|
+ }catch (NumberFormatException e){
|
|
|
|
+ lane_offset_list.add(0D);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// brake_list.add(Double.valueOf(split[7])); ///TODO 没有
|
|
|
|
+// throttle_list.add(Double.valueOf(split[7]));///TODO 没有
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ //里程
|
|
|
|
+ Double lc = 0D;
|
|
|
|
+ for(int i=0; i<time_list.size(); i++){
|
|
|
|
+ if(i == 0){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ lc += (time_list.get(i)-time_list.get(i-1))*longitudinal_velocity_list.get(i-1);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //平均速度
|
|
|
|
+ Double pjsd = lc/time_list.get(time_list.size()-1);
|
|
|
|
+
|
|
|
|
+ //最大速度
|
|
|
|
+ Double zdsd = Collections.max(longitudinal_velocity_list);
|
|
|
|
+
|
|
|
|
+ //最小速度
|
|
|
|
+ Double zxsd = Collections.min(longitudinal_velocity_list);
|
|
|
|
+
|
|
|
|
+ //最大加速度
|
|
|
|
+ Double zdjiasd = Collections.max(longitudinal_acceleration_list);
|
|
|
|
+
|
|
|
|
+ //最大减速度
|
|
|
|
+ Double zdjiansd = Collections.min(longitudinal_acceleration_list);
|
|
|
|
+
|
|
|
|
+ //最大摆角速度
|
|
|
|
+ Double zdbjsd = Collections.max(yawrate_list);
|
|
|
|
+
|
|
|
|
+ //自车速度方差
|
|
|
|
+ Double zcsdfc = 0D;
|
|
|
|
+ for(Double d :longitudinal_velocity_list){
|
|
|
|
+ zcsdfc +=Math.pow(d-pjsd,2);
|
|
|
|
+ }
|
|
|
|
+ zcsdfc = zcsdfc/longitudinal_velocity_list.size();
|
|
|
|
+
|
|
|
|
+ //自车横摆角速度均方根
|
|
|
|
+ Double zchbjsdjfg = 0D;
|
|
|
|
+ for(Double d :yawrate_list){
|
|
|
|
+ zchbjsdjfg += Math.pow(d-pjsd,2);
|
|
|
|
+ }
|
|
|
|
+ zchbjsdjfg = Math.sqrt(zchbjsdjfg/yawrate_list.size());
|
|
|
|
+
|
|
|
|
+ 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++){
|
|
|
|
+ Double aDouble = lateral_velocity_list.get(i);
|
|
|
|
+ Double aDouble1 = longitudinal_velocity_list.get(i);
|
|
|
|
+ Double d = Math.pow(aDouble,2)+Math.pow(aDouble1,2);
|
|
|
|
+ velocity_list.add(d);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //任务详情信息
|
|
|
|
+ resultVo.setMileage(lc.toString());
|
|
|
|
+ resultVo.setAverageVelocity(pjsd.toString());
|
|
|
|
+ resultVo.setMaximunSpeed(zdsd.toString());
|
|
|
|
+ resultVo.setMinimunVelocity(zxsd.toString());
|
|
|
|
+ resultVo.setMaximumAcceleration(zdjiasd.toString());
|
|
|
|
+ resultVo.setMaximumDeceleration(zdjiansd.toString());
|
|
|
|
+ resultVo.setMaximumSwingSpeed(zdbjsd.toString());
|
|
|
|
+ resultVo.setSpeedVariance(zcsdfc);
|
|
|
|
+// resultVo.setSpeedComfortLevel(po.getSpeedComfortLevel());
|
|
|
|
+
|
|
|
|
+ resultVo.setSwingSpeedMeanSquareRoot(zchbjsdjfg);
|
|
|
|
+// resultVo.setSwingComfortLevel(po.getSwingComfortLevel());
|
|
|
|
+
|
|
|
|
+ HashMap<String, List> CurveData = new HashMap<>();
|
|
|
|
+ CurveData.put("time",time_list);
|
|
|
|
+ CurveData.put("acceleration",acceleration_list);
|
|
|
|
+ CurveData.put("lane_offset",lane_offset_list);
|
|
|
|
+ CurveData.put("brake",brake_list);
|
|
|
|
+ CurveData.put("steeting",steeting_wheel_list);
|
|
|
|
+ CurveData.put("throttle",throttle_list);
|
|
|
|
+ CurveData.put("yaw_rate",yawrate_list);
|
|
|
|
+ CurveData.put("velocity",velocity_list);
|
|
|
|
+ resultVo.setCurveData(CurveData);
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ } catch (Exception e){
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+
|
|
|
|
+ }finally {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,resultVo);
|
|
return new ResponseBodyVO(ResponseBodyVO.Response.SUCCESS,resultVo);
|
|
}
|
|
}
|