修改无人机状态
This commit is contained in:
parent
0b6724d31d
commit
384dac68a3
|
|
@ -350,14 +350,6 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
|
|||
.orElse("");
|
||||
log.info("无人机 MODE 值: {}", mode);
|
||||
|
||||
// 判断逻辑
|
||||
if ("auto".equalsIgnoreCase(mode)) {
|
||||
// mode == "auto" 表示正在执行任务
|
||||
dto.setAircraftStatus("IN_MISSION");
|
||||
log.info("无人机处于 auto 模式,设置状态: IN_MISSION");
|
||||
} else {
|
||||
// mode != "auto",根据 tsingal 和 nest_door_status 判断
|
||||
|
||||
// 获取 tsingal(图传信号强度,用于判断开关机)
|
||||
Integer tsingal = aircraftTelemetry.get(TuohengDeviceTelemetry.TSINGAL)
|
||||
.map(TelemetryValue::getValue)
|
||||
|
|
@ -376,8 +368,14 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
|
|||
log.info("机场舱门状态: {}", doorStatus);
|
||||
}
|
||||
|
||||
// 根据舱门状态和开关机状态判断
|
||||
// 判断逻辑:IN_MISSION 需要同时满足 mode=="auto" 且舱门打开
|
||||
String aircraftStatus;
|
||||
if ("auto".equalsIgnoreCase(mode) && doorStatus != null && doorStatus == 0) {
|
||||
// mode == "auto" 且舱门打开,表示正在执行任务
|
||||
aircraftStatus = "IN_MISSION";
|
||||
log.info("无人机处于 auto 模式且舱门打开,设置状态: IN_MISSION");
|
||||
} else {
|
||||
// 其他情况,根据 tsingal 和 nest_door_status 判断
|
||||
if (doorStatus != null && doorStatus == 1) {
|
||||
// 舱门关闭(舱内)
|
||||
if (isPowerOn) {
|
||||
|
|
@ -388,10 +386,10 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
|
|||
log.info("舱门关闭 + 关机 → POWER_OFF_IN_CABIN");
|
||||
}
|
||||
} else if (doorStatus != null && doorStatus == 0) {
|
||||
// 舱门打开(舱外)
|
||||
// 舱门打开(舱外),但不是 auto 模式
|
||||
if (isPowerOn) {
|
||||
aircraftStatus = "POWER_ON_OUT_CABIN";
|
||||
log.info("舱门打开 + 开机 → POWER_ON_OUT_CABIN");
|
||||
log.info("舱门打开 + 开机(非auto模式) → POWER_ON_OUT_CABIN");
|
||||
} else {
|
||||
aircraftStatus = "POWER_OFF_OUT_CABIN";
|
||||
log.info("舱门打开 + 关机 → POWER_OFF_OUT_CABIN");
|
||||
|
|
@ -406,9 +404,9 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
|
|||
log.warn("无法获取舱门状态,默认设置: POWER_OFF_IN_CABIN");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dto.setAircraftStatus(aircraftStatus);
|
||||
}
|
||||
|
||||
// 设置作业架次 - 暂时设置为0,拓恒设备可能没有这个数据
|
||||
dto.setMissionCount(0);
|
||||
|
|
|
|||
Loading…
Reference in New Issue