Compare commits

..

5 Commits
main ... dev

5 changed files with 202 additions and 24 deletions

View File

@ -20,28 +20,28 @@ public class TuohengMqttClientService {
private final TuohengMqttMessageHandler messageHandler;
private MqttClient mqttClient;
// public static final String AIRPORT_NEST_REALTIME_TOPIC = "/topic/v1/airportNest/+/realTime/data";
// public static final String AIRPORT_NEST_BASIC_TOPIC = "/topic/v1/airportNest/+/realTime/basic";
// public static final String AIRPORT_NEST_CONFIRM_TOPIC = "/topic/v1/airportNest/+/control/confirm";
// public static final String AIRPORT_DRONE_REALTIME_TOPIC = "/topic/v1/airportDrone/+/realTime/data";
// public static final String AIRPORT_FLY_CONTROL_TOPIC = "/topic/v1/airportFly/+/control";
// public static final String AIRPORT_FLY_DATA_TOPIC = "/topic/v1/airportFly/+/control/data";
// public static final String AIRPORT_FLY_CONFIRM_TOPIC = "/topic/v1/airportFly/+/control/confirm";
// public static final String HEARTBEAT_MESSAGE_TOPIC = "/topic/v1/heartbeat/+/message";
// public static final String PRODUCT_OSD_TOPIC = "thing/product/+/osd";
// public static final String PRODUCT_EVENTS_TOPIC = "thing/product/+/events";
public static final String AIRPORT_NEST_REALTIME_TOPIC = "/topic/v1/airportNest/+/realTime/data";
public static final String AIRPORT_NEST_BASIC_TOPIC = "/topic/v1/airportNest/+/realTime/basic";
public static final String AIRPORT_NEST_CONFIRM_TOPIC = "/topic/v1/airportNest/+/control/confirm";
public static final String AIRPORT_DRONE_REALTIME_TOPIC = "/topic/v1/airportDrone/+/realTime/data";
public static final String AIRPORT_FLY_CONTROL_TOPIC = "/topic/v1/airportFly/+/control";
public static final String AIRPORT_FLY_DATA_TOPIC = "/topic/v1/airportFly/+/control/data";
public static final String AIRPORT_FLY_CONFIRM_TOPIC = "/topic/v1/airportFly/+/control/confirm";
public static final String HEARTBEAT_MESSAGE_TOPIC = "/topic/v1/heartbeat/+/message";
public static final String PRODUCT_OSD_TOPIC = "thing/product/+/osd";
public static final String PRODUCT_EVENTS_TOPIC = "thing/product/+/events";
public static final String AIRPORT_NEST_REALTIME_TOPIC = "/topic/v1/airportNest/THJSQ03A2302KSPYGJ2G/realTime/data";
public static final String AIRPORT_NEST_BASIC_TOPIC = "/topic/v1/airportNest/THJSQ03A2302KSPYGJ2G/realTime/basic";
public static final String AIRPORT_NEST_CONFIRM_TOPIC = "/topic/v1/airportNest/THJSQ03A2302KSPYGJ2G/control/confirm";
public static final String AIRPORT_DRONE_REALTIME_TOPIC = "/topic/v1/airportDrone/THJSQ03A2302KSPYGJ2G/realTime/data";
public static final String AIRPORT_FLY_CONTROL_TOPIC = "/topic/v1/airportFly/THJSQ03A2302KSPYGJ2G/control";
public static final String AIRPORT_FLY_DATA_TOPIC = "/topic/v1/airportFly/THJSQ03A2302KSPYGJ2G/control/data";
public static final String AIRPORT_FLY_CONFIRM_TOPIC = "/topic/v1/airportFly/THJSQ03A2302KSPYGJ2G/control/confirm";
public static final String HEARTBEAT_MESSAGE_TOPIC = "/topic/v1/heartbeat/THJSQ03A2302KSPYGJ2G/message";
public static final String PRODUCT_OSD_TOPIC = "thing/product/THJSQ03A2302KSPYGJ2G/osd";
public static final String PRODUCT_EVENTS_TOPIC = "thing/product/THJSQ03A2302KSPYGJ2G/events";
// public static final String AIRPORT_NEST_REALTIME_TOPIC = "/topic/v1/airportNest/THJSQ03A2302KSPYGJ2G/realTime/data";
// public static final String AIRPORT_NEST_BASIC_TOPIC = "/topic/v1/airportNest/THJSQ03A2302KSPYGJ2G/realTime/basic";
// public static final String AIRPORT_NEST_CONFIRM_TOPIC = "/topic/v1/airportNest/THJSQ03A2302KSPYGJ2G/control/confirm";
// public static final String AIRPORT_DRONE_REALTIME_TOPIC = "/topic/v1/airportDrone/THJSQ03A2302KSPYGJ2G/realTime/data";
// public static final String AIRPORT_FLY_CONTROL_TOPIC = "/topic/v1/airportFly/THJSQ03A2302KSPYGJ2G/control";
// public static final String AIRPORT_FLY_DATA_TOPIC = "/topic/v1/airportFly/THJSQ03A2302KSPYGJ2G/control/data";
// public static final String AIRPORT_FLY_CONFIRM_TOPIC = "/topic/v1/airportFly/THJSQ03A2302KSPYGJ2G/control/confirm";
// public static final String HEARTBEAT_MESSAGE_TOPIC = "/topic/v1/heartbeat/THJSQ03A2302KSPYGJ2G/message";
// public static final String PRODUCT_OSD_TOPIC = "thing/product/THJSQ03A2302KSPYGJ2G/osd";
// public static final String PRODUCT_EVENTS_TOPIC = "thing/product/THJSQ03A2302KSPYGJ2G/events";
public TuohengMqttClientService(TuohengMqttClientConfig config, TuohengMqttMessageHandler messageHandler) {
this.config = config;

View File

@ -272,6 +272,103 @@ public class TuohengDeviceTelemetry {
}
);
// public static final TelemetryKey<Double> vertical_speed = TelemetryKey.of(
// "vertical_speed",
// Double.class,
// value -> {
// if (value == null) return null;
// if (value instanceof Number) {
// return ((Number) value).doubleValue();
// }
// return Double.parseDouble(value.toString());
// }
// );
//
// public static final TelemetryKey<Double> horizontal_speed = TelemetryKey.of(
// "horizontal_speed",
// Double.class,
// value -> {
// if (value == null) return null;
// if (value instanceof Number) {
// return ((Number) value).doubleValue();
// }
// return Double.parseDouble(value.toString());
// }
// );
public static final TelemetryKey<Double> distance_to_home = TelemetryKey.of(
"distance_to_home",
Double.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return Double.parseDouble(value.toString());
}
);
public static final TelemetryKey<Double> altitude = TelemetryKey.of(
"altitude",
Double.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return Double.parseDouble(value.toString());
}
);
// public static final TelemetryKey<Double> pitch = TelemetryKey.of(
// "pitch",
// Double.class,
// value -> {
// if (value == null) return null;
// if (value instanceof Number) {
// return ((Number) value).doubleValue();
// }
// return Double.parseDouble(value.toString());
// }
// );
//
// public static final TelemetryKey<Double> yaw = TelemetryKey.of(
// "yaw",
// Double.class,
// value -> {
// if (value == null) return null;
// if (value instanceof Number) {
// return ((Number) value).doubleValue();
// }
// return Double.parseDouble(value.toString());
// }
// );
public static final TelemetryKey<Double> camerapitch = TelemetryKey.of(
"camerapitch",
Double.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return Double.parseDouble(value.toString());
}
);
public static final TelemetryKey<Double> camerayaw = TelemetryKey.of(
"camerayaw",
Double.class,
value -> {
if (value == null) return null;
if (value instanceof Number) {
return ((Number) value).doubleValue();
}
return Double.parseDouble(value.toString());
}
);
/**
* 充电器数据 (来自 /topic/v1/airportNest/+/realTime/data)
*/
@ -740,7 +837,15 @@ public class TuohengDeviceTelemetry {
HOLDER_Y_STATUS,
CONTROLLER_STATUS,
HATCH_STATUS,
DRONE_STATUS
DRONE_STATUS,
// vertical_speed,
// horizontal_speed,
distance_to_home,
// altitude,
// pitch,
// yaw,
camerapitch,
camerayaw
);
}

View File

@ -170,5 +170,29 @@ public class DockDetailDTO implements Serializable
/** 直播视频地址 */
private String liveVideoUrl;
//爬升速度
private Double vertical_speed;
//平飞速度
private Double horizontal_speed;
//距离机场
private Double distance_to_home;
//海拔高度
private Double altitude;
//无人机俯仰角
private Double pitch;
//无人机偏航角
private Double yaw;
//云台俯仰角
private Double camerapitch;
//云台偏航角
private Double camerayaw;
}

View File

@ -885,9 +885,9 @@ public class SynService {
log.info("开始同步拓恒设备: deviceName(SN)={}", deviceName);
if(!Objects.equals(deviceName, "THJSQ03A2302KSPYGJ2G")){
return;
}
// if(!Objects.equals(deviceName, "THJSQ03A2302KSPYGJ2G")){
// return;
// }
try {
// 获取拓恒设备属性

View File

@ -388,6 +388,55 @@ public class TuohengBufferDeviceImpl implements IBufferDeviceService {
dto.setCabinHumidity(value.getValue());
});
telemetry.get(TuohengDeviceTelemetry.VERTICAL_SPEED)
.ifPresent(value -> {
log.info("vertical_speed: {}", value.getValue());
dto.setVertical_speed(value.getValue());
});
telemetry.get(TuohengDeviceTelemetry.HORIZONTAL_SPEED)
.ifPresent(value -> {
log.info("horizontal_speed: {}", value.getValue());
dto.setHorizontal_speed(value.getValue());
});
telemetry.get(TuohengDeviceTelemetry.PITCH)
.ifPresent(value -> {
log.info("pitch: {}", value.getValue());
dto.setPitch(value.getValue());
});
telemetry.get(TuohengDeviceTelemetry.YAW)
.ifPresent(value -> {
log.info("yaw: {}", value.getValue());
dto.setYaw(value.getValue());
});
telemetry.get(TuohengDeviceTelemetry.camerapitch)
.ifPresent(value -> {
log.info("camerapitch: {}", value.getValue());
dto.setCamerapitch(value.getValue());
});
telemetry.get(TuohengDeviceTelemetry.camerayaw)
.ifPresent(value -> {
log.info("camerayaw: {}", value.getValue());
dto.setCamerayaw(value.getValue());
});
telemetry.get(TuohengDeviceTelemetry.distance_to_home)
.ifPresent(value -> {
log.info("distance_to_home: {}", value.getValue());
dto.setDistance_to_home(value.getValue());
});
telemetry.get(TuohengDeviceTelemetry.ALTITUDE)
.ifPresent(value -> {
log.info("camerayaw: {}", value.getValue());
dto.setAltitude(value.getValue());
});
/**
* 通过 MachineStateManager 获取舱门状态
*/