rev:处理舵轮角度小数点保留3位
This commit is contained in:
@@ -31,6 +31,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
@@ -208,29 +209,24 @@ public class VehicleInfoServiceImpl implements VehicleInfoService{
|
||||
}
|
||||
row.put("working_status", working_status);
|
||||
row.put("vehicle_status", vehicle_status);
|
||||
BigDecimal x = new BigDecimal(debugInfoJson.getString("Car_Global_rx"));
|
||||
//保留两位小数且四舍五入
|
||||
x = x.setScale(3, BigDecimal.ROUND_HALF_UP);
|
||||
//保留三位小数且四舍五入
|
||||
BigDecimal x = new BigDecimal(debugInfoJson.getString("Car_Global_rx")).setScale(3, RoundingMode.HALF_UP);
|
||||
row.put("x", x);
|
||||
BigDecimal y = new BigDecimal(debugInfoJson.getString("Car_Global_ry"));
|
||||
//保留两位小数且四舍五入
|
||||
y = y.setScale(3, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal y = new BigDecimal(debugInfoJson.getString("Car_Global_ry")).setScale(3, RoundingMode.HALF_UP);
|
||||
row.put("y", y);
|
||||
row.put("z", debugInfoJson.getString("Car_Global_Theta"));
|
||||
//航向角度
|
||||
BigDecimal z = new BigDecimal(debugInfoJson.getString("Car_Global_Theta")).setScale(3, RoundingMode.HALF_UP);
|
||||
row.put("z",z );
|
||||
row.put("send_speed", debugInfoJson.getString("VehicleCtrlExpThrottle"));
|
||||
row.put("real_speed", debugInfoJson.getString("Speedm_Tmp"));
|
||||
//保留3位小数
|
||||
//舵轮角度
|
||||
row.put("carrier", debugInfoJson.getString("SVreal_angle"));
|
||||
//保留3位小数
|
||||
//横向偏差
|
||||
BigDecimal Lateral_Deviation_m = new BigDecimal(debugInfoJson.getString("Lateral_Deviation_m"));
|
||||
Lateral_Deviation_m = Lateral_Deviation_m.setScale(3, BigDecimal.ROUND_HALF_UP);
|
||||
BigDecimal Lateral_Deviation_m = new BigDecimal(debugInfoJson.getString("Lateral_Deviation_m")).setScale(3, RoundingMode.HALF_UP);
|
||||
row.put("landscape_deviation", Lateral_Deviation_m);
|
||||
//航向偏差
|
||||
BigDecimal Vertical_Deviation_deg = new BigDecimal(debugInfoJson.getString("Vertical_Deviation_deg"));
|
||||
Lateral_Deviation_m = Lateral_Deviation_m.setScale(3, BigDecimal.ROUND_HALF_UP);
|
||||
row.put("course_deviation", debugInfoJson.getString("Vertical_Deviation_deg"));
|
||||
BigDecimal Vertical_Deviation_deg = new BigDecimal(debugInfoJson.getString("Vertical_Deviation_deg")).setScale(3, RoundingMode.HALF_UP);
|
||||
row.put("course_deviation", Vertical_Deviation_deg);
|
||||
returnjo.put("code", "1");
|
||||
returnjo.put("desc", "查询成功!");
|
||||
returnjo.put("result", row);
|
||||
|
||||
Reference in New Issue
Block a user