feat: 触控节点
This commit is contained in:
parent
0cd4fac52b
commit
9cf4a6f2f9
@ -1,16 +1,20 @@
|
||||
package com.cmvr.edge.client.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
@Data
|
||||
@ApiModel("边缘系统通用VO")
|
||||
public class EdgeCommonVO {
|
||||
/**
|
||||
* 终端ID
|
||||
*/
|
||||
|
||||
@ApiModelProperty("终端ID")
|
||||
@NotEmpty(message = "终端ID不能为空")
|
||||
private String terminalId;
|
||||
|
||||
/**
|
||||
* 设备ID
|
||||
*/
|
||||
@ApiModelProperty("设备ID")
|
||||
@NotEmpty(message = "设备ID不能为空")
|
||||
private String deviceId;
|
||||
}
|
||||
|
||||
@ -43,6 +43,9 @@ public enum ActionEnum {
|
||||
SPEAKER_PLAYAUDIO("EDGE", "SPEAKER_PLAYAUDIO", "播放音频"),
|
||||
CORPUS_PLAY("EDGE", "CORPUS_PLAY", "播放语料"),
|
||||
|
||||
// ---------------机械臂---------------
|
||||
TOUCH("EDGE", "TOUCH", "触控"),
|
||||
|
||||
// 大模型行为
|
||||
// ---------------获取触控坐标---------------
|
||||
TOUCH_COORDINATES("LLM", "TOUCH_COORDINATES", "获取触控坐标"),
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
package com.cmvr.test.flow.runtime.operator.edge;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.edge.client.model.humanoid.EdgeMoveJVO;
|
||||
import com.cmvr.edge.client.service.EdgeHumanoidRobotService;
|
||||
import com.cmvr.test.enums.ActionEnum;
|
||||
import com.cmvr.test.flow.runtime.message.TaskNodeExecuteMessage;
|
||||
import com.cmvr.test.flow.runtime.message.TaskNodeExecuteResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EdgeTouchOperateService implements EdgeOperateService {
|
||||
|
||||
private final EdgeHumanoidRobotService edgeHumanoidRobotService;
|
||||
|
||||
@Override
|
||||
public boolean supports(ActionEnum action) {
|
||||
return action.name().equals("TOUCH");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskNodeExecuteResult execute(TaskNodeExecuteMessage message) {
|
||||
ActionEnum action = message.getAction();
|
||||
JSONObject inputParams = message.getInputParams();
|
||||
String terminalId = message.getTerminalId();
|
||||
String deviceId = inputParams.getString("deviceId");
|
||||
String touchParams = inputParams.getString("touchParams");
|
||||
|
||||
switch (action) {
|
||||
case TOUCH: {
|
||||
EdgeMoveJVO edgeMoveJVO = JSON.parseObject(touchParams, EdgeMoveJVO.class);
|
||||
edgeMoveJVO.setTerminalId(terminalId);
|
||||
edgeMoveJVO.setDeviceId(deviceId);
|
||||
edgeHumanoidRobotService.moveJ(edgeMoveJVO);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new GlobalException("不支持的触控操作类型: " + action);
|
||||
}
|
||||
return TaskNodeExecuteResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
@ -40,24 +40,24 @@ public class ViPlayOperateService implements VIOperateService {
|
||||
String deviceId = inputParams.getString("deviceId");
|
||||
String audioPath = inputParams.getString("audioPath");
|
||||
String terminalId = message.getTerminalId();
|
||||
// log.info("播放语料成功,deviceId={},audioPath={},terminalId={}", deviceId, audioPath, terminalId);
|
||||
// edgeSpeakerService.playAudio(terminalId, deviceId, audioPath);
|
||||
// // 等待播放完成
|
||||
// while (true) {
|
||||
// try {
|
||||
// Thread.sleep(1000);
|
||||
// } catch (InterruptedException e) {
|
||||
// throw new RuntimeException(e);
|
||||
// }
|
||||
// SpeakerCommand.GetSpeakerStateCommand.Feedback status = edgeSpeakerService.getStatus(terminalId, deviceId);
|
||||
// boolean isRunning = status.getState().getIsRunning();
|
||||
// if (!isRunning) {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
log.info("播放语料成功,deviceId={},audioPath={},terminalId={}", deviceId, audioPath, terminalId);
|
||||
edgeSpeakerService.playAudio(terminalId, deviceId, audioPath);
|
||||
// 等待播放完成
|
||||
while (true) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
SpeakerCommand.GetSpeakerStateCommand.Feedback status = edgeSpeakerService.getStatus(terminalId, deviceId);
|
||||
boolean isRunning = status.getState().getIsRunning();
|
||||
if (!isRunning) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// todo 本机测试播放
|
||||
playAudio(audioPath);
|
||||
// playAudio(audioPath);
|
||||
return TaskNodeExecuteResult.success();
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user