fix: 删除调试日志,修复f9p生产1005的错误
This commit is contained in:
parent
bc89ccca79
commit
c8678bc0a0
@ -518,28 +518,33 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (insertIndex != -1) {
|
if (insertIndex != -1) {
|
||||||
ByteBuf newBuf = Unpooled.buffer();
|
// 检查基站是否有有效的ECEF坐标
|
||||||
newBuf.writeBytes(originalData, 0, insertIndex / 2);
|
|
||||||
|
|
||||||
// 使用f9p坐标生成1005消息
|
|
||||||
double[] ecef = new double[3];
|
|
||||||
// 修复:确保坐标值不为null,并正确处理Double类型
|
|
||||||
Double ecefX = deviceBs.getEcefx();
|
Double ecefX = deviceBs.getEcefx();
|
||||||
Double ecefY = deviceBs.getEcefy();
|
Double ecefY = deviceBs.getEcefy();
|
||||||
Double ecefZ = deviceBs.getEcefz();
|
Double ecefZ = deviceBs.getEcefz();
|
||||||
|
|
||||||
ecef[0] = ecefX != null ? ecefX.doubleValue() : 0.0;
|
// 验证坐标有效性
|
||||||
ecef[1] = ecefY != null ? ecefY.doubleValue() : 0.0;
|
if (isValidEcefCoordinates(ecefX, ecefY, ecefZ)) {
|
||||||
ecef[2] = ecefZ != null ? ecefZ.doubleValue() : 0.0;
|
ByteBuf newBuf = Unpooled.buffer();
|
||||||
|
newBuf.writeBytes(originalData, 0, insertIndex / 2);
|
||||||
|
|
||||||
|
double[] ecef = new double[3];
|
||||||
|
ecef[0] = ecefX.doubleValue();
|
||||||
|
ecef[1] = ecefY.doubleValue();
|
||||||
|
ecef[2] = ecefZ.doubleValue();
|
||||||
|
|
||||||
String rtcm1005 = Rtcm1005.generateRtcm1005Hex(ecef, 0);
|
String rtcm1005 = Rtcm1005.generateRtcm1005Hex(ecef, 0);
|
||||||
if (rtcm1005 != null) {
|
if (rtcm1005 != null && !rtcm1005.isEmpty()) {
|
||||||
byte[] rtcm1005Bytes = ByteUtil.hexStringTobyte(rtcm1005);
|
byte[] rtcm1005Bytes = ByteUtil.hexStringTobyte(rtcm1005);
|
||||||
newBuf.writeBytes(rtcm1005Bytes);
|
newBuf.writeBytes(rtcm1005Bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
newBuf.writeBytes(originalData, insertIndex / 2, originalData.length - insertIndex / 2);
|
newBuf.writeBytes(originalData, insertIndex / 2, originalData.length - insertIndex / 2);
|
||||||
buf = newBuf;
|
buf = newBuf;
|
||||||
|
} else {
|
||||||
|
logger.warn("Base station {} has invalid ECEF coordinates, skipping RTCM 1005 generation for device {}",
|
||||||
|
deviceBs.getDeviceId(), deviceId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lastD300ForwardTimeMap.put(deviceId, currentTime);
|
lastD300ForwardTimeMap.put(deviceId, currentTime);
|
||||||
@ -787,29 +792,21 @@ public class D331RtcmMessageExecutor implements Executor<D331RtcmMessage, Void>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 打印当前基站和设备状态(用于调试)
|
* 验证ECEF坐标是否有效
|
||||||
*/
|
*/
|
||||||
@Scheduled(fixedRate = 300000) // 5分钟执行一次
|
private boolean isValidEcefCoordinates(Double x, Double y, Double z) {
|
||||||
public void printStatusSummary() {
|
if (x == null || y == null || z == null) {
|
||||||
if (logger.isInfoEnabled() && !baseStationStatusMap.isEmpty()) {
|
return false;
|
||||||
StringBuilder summary = new StringBuilder();
|
|
||||||
summary.append("\n=== Base Station Status Summary ===\n");
|
|
||||||
|
|
||||||
for (BaseStationStatus status : baseStationStatusMap.values()) {
|
|
||||||
summary.append(String.format("Base Station: %s, Status: %s, Last Active: %s, Serving Devices: %d\n",
|
|
||||||
status.getBaseStationId(),
|
|
||||||
status.getStatus(),
|
|
||||||
status.getLastActiveTime(),
|
|
||||||
status.getServingDevices().size()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
summary.append("=== Device Base Mapping ===\n");
|
// 检查是否为零坐标
|
||||||
for (Map.Entry<String, String> entry : deviceCurrentBaseMap.entrySet()) {
|
if (x == 0.0 && y == 0.0 && z == 0.0) {
|
||||||
summary.append(String.format("Device: %s -> Base Station: %s\n",
|
return false;
|
||||||
entry.getKey(), entry.getValue()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(summary.toString());
|
// 检查坐标是否在地球表面合理范围内(大致6.3M到6.4M米)
|
||||||
}
|
double distance = Math.sqrt(x * x + y * y + z * z);
|
||||||
|
return distance >= 6300000 && distance <= 6400000;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user