数据不匹配时,其他数据返回
This commit is contained in:
parent
d81f38be67
commit
67c3e8756f
|
|
@ -298,16 +298,21 @@ public class SerialConnectUtils {
|
|||
}
|
||||
//2.3判断是否返回对应结果集(即数据集合点数量等于导线分裂数量)
|
||||
// if (calStandardDeviation.size() == towerDataBean.getSplitType()) {
|
||||
//雷达数据不匹配时,返回其他数据
|
||||
boolean radarStatus = false;
|
||||
//2.4根据公式去转换成测点坐标
|
||||
List<Coordinate> coordinates = new ArrayList<>();
|
||||
if (calStandardDeviation.size() >= towerDataBean.getSplitType()) {
|
||||
radarStatus = true;
|
||||
calStandardDeviation = calStandardDeviation.subList(0, towerDataBean.getSplitType());
|
||||
//2.4根据公式去转换成测点坐标
|
||||
List<Coordinate> coordinates = new ArrayList<>();
|
||||
|
||||
for (RadarPointBean radarPointBean : calStandardDeviation) {
|
||||
System.out.printf("RTK:lat:%.8f; lon:%.8f; 高度:%.2f\n", sensorDataBean.getLat(), sensorDataBean.getLon(), sensorDataBean.getH());
|
||||
Coordinate coordinate = RadarMathUtil.transferPoint2(radarPointBean, sensorDataBean);
|
||||
coordinate.setRadarPoint(radarPointBean);
|
||||
coordinates.add(coordinate);
|
||||
System.out.printf("测点:lat:%.8f; lon:%.8f; 高度:%.2f\n", coordinate.getLat(), coordinate.getLon(), coordinate.getH());
|
||||
|
||||
}
|
||||
//2.5导线编号
|
||||
//先以0-90度为标准的导线if
|
||||
|
|
@ -316,8 +321,8 @@ public class SerialConnectUtils {
|
|||
} else {
|
||||
classifyAndSortCoordinates(coordinates, true);
|
||||
}
|
||||
//2.5-1.0后续添加逻辑,增加求点到雷达夹角,确认最佳测量角度
|
||||
double[] goodAngle = dealWithCoordinatesAngel(coordinates, sensorDataBean);
|
||||
|
||||
}
|
||||
|
||||
//2.6 已编号结束的雷达数据 coordinates,传感器测量数据 sensorDataBean,根据编成指令返回遥控器端
|
||||
//生成返回指令
|
||||
|
|
@ -325,6 +330,7 @@ public class SerialConnectUtils {
|
|||
sb.append("F0F0F0");
|
||||
sb.append("03");
|
||||
//雷达数据
|
||||
if(radarStatus){
|
||||
for (int m = 0; m < (Math.min(coordinates.size(), 4)); m++) {
|
||||
Coordinate coordinate = coordinates.get(m);
|
||||
int distance = (int) (ArithUtil.round(coordinate.getRadarPoint().getDistance(), 3) * 1000);
|
||||
|
|
@ -337,6 +343,11 @@ public class SerialConnectUtils {
|
|||
for (int i = 0; i < remaining; i++) {
|
||||
sb.append("00000000");
|
||||
}
|
||||
}else{
|
||||
for (int i = 0; i < 4; i++) {
|
||||
sb.append("00000000");
|
||||
}
|
||||
}
|
||||
//传感器数据
|
||||
//俯仰角
|
||||
int pitchAngle = (int) (ArithUtil.round(Math.abs(sensorDataBean.getPitchAngle()), 2) * 100);
|
||||
|
|
@ -359,11 +370,18 @@ public class SerialConnectUtils {
|
|||
//将即分裂返回,方便处理数据
|
||||
sb.append("0" + towerDataBean.getSplitType());
|
||||
|
||||
if(radarStatus) {
|
||||
//2.5-1.0后续添加逻辑,增加求点到雷达夹角,确认最佳测量角度
|
||||
double[] goodAngle = dealWithCoordinatesAngel(coordinates, sensorDataBean);
|
||||
//添加最佳测量角
|
||||
int goodPitchAngle = (int) (ArithUtil.round(Math.abs(goodAngle[0]), 2) * 100);
|
||||
sb.append(ByteUtil.decIntToHexStr(goodPitchAngle, 2));
|
||||
int goodRollAngle = (int) (ArithUtil.round(Math.abs(goodAngle[1]), 2) * 100);
|
||||
sb.append(ByteUtil.decIntToHexStr(goodRollAngle, 2));
|
||||
}else {
|
||||
sb.append("0000");
|
||||
sb.append("0000");
|
||||
}
|
||||
|
||||
String checkByte = ByteUtil.getSum16(sb.toString());
|
||||
sb.append(checkByte);
|
||||
|
|
@ -372,12 +390,14 @@ public class SerialConnectUtils {
|
|||
assert serialHelper != null;
|
||||
Log.e(TAG, "2.测量数据返回:" + sb.toString());
|
||||
serialHelper.sendHex(sb.toString());
|
||||
} else {
|
||||
SerialHelper serialHelper = serialHelperMap.get("数传");
|
||||
assert serialHelper != null;
|
||||
serialHelper.sendHex("F0000002");
|
||||
Log.e(TAG, "激光雷达解析数据与分裂类型不匹配:" + calStandardDeviation);
|
||||
}
|
||||
|
||||
|
||||
// else {
|
||||
// SerialHelper serialHelper = serialHelperMap.get("数传");
|
||||
// assert serialHelper != null;
|
||||
// serialHelper.sendHex("F0000002");
|
||||
// Log.e(TAG, "激光雷达解析数据与分裂类型不匹配:" + calStandardDeviation);
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue