fix: 调试

This commit is contained in:
stream 2025-12-18 17:17:51 +08:00
parent 77821f8d82
commit 4b16fc7dc1

View File

@ -207,8 +207,7 @@ public class FlowiseActionService {
return "already running";
}
String terminalId = "8c7c5d5d8c8b09df9d1e5fc9b76c46ab";
// String terminalId = "25d13e8ee0cbc2b1046e190f840b8ab0";
String terminalId = "4ed1246c465b97975f96c9ef8371a3bd";
String bioId = "hc01";
String spkId = "spk1";
@ -218,61 +217,61 @@ public class FlowiseActionService {
speakVO.setDeviceId(spkId);
try {
// 张嘴
// edgeBioHeadService.speakStart(speakVO);
edgeBioHeadService.speakStart(speakVO);
log.info("张嘴动作触发完成");
// 摆头循环
boolean toRight = true;
while (actionRunning.get()) {
double rad = toRight ? 0.1d : -0.1d;
EdgeMoveJVO moveJVO = buildHeadMoveJVO(
terminalId,
bioId,
rad
);
long t0 = System.currentTimeMillis();
log.info(">>> moveJ start, rad={},time={}", rad, t0);
String res = edgeHumanoidRobotService.moveJ(moveJVO);
long t1 = System.currentTimeMillis();
log.info(">>> moveJ end, rad={}, cost={}", rad, t1 - t0);
// 判断返回
try {
JSONObject resJson = JSON.parseObject(res);
if (!resJson.getBooleanValue("success")) {
log.warn("moveJ 返回失败res={}", res);
}
} catch (Exception ignore) {
}
toRight = !toRight;
}
// // 摆头循环
// boolean toRight = true;
//
// while (actionRunning.get()) {
//
// double rad = toRight ? 0.1d : -0.1d;
//
// EdgeMoveJVO moveJVO = buildHeadMoveJVO(
// terminalId,
// bioId,
// rad
// );
//
// long t0 = System.currentTimeMillis();
// log.info(">>> moveJ start, rad={},time={}", rad, t0);
// String res = edgeHumanoidRobotService.moveJ(moveJVO);
//
// long t1 = System.currentTimeMillis();
// log.info(">>> moveJ end, rad={}, cost={}", rad, t1 - t0);
//
// // 判断返回
// try {
// JSONObject resJson = JSON.parseObject(res);
// if (!resJson.getBooleanValue("success")) {
// log.warn("moveJ 返回失败res={}", res);
// }
// } catch (Exception ignore) {
// }
//
// toRight = !toRight;
// }
} catch (Exception e) {
log.error("action 执行异常", e);
} finally {
// 回正
try {
EdgeMoveJVO resetVO = buildHeadMoveJVO(
terminalId,
bioId,
0d
);
log.info("结束动作,头部回正 rad=0");
edgeHumanoidRobotService.moveJ(resetVO);
} catch (Exception e) {
log.error("头部回正异常", e);
}
// try {
// EdgeMoveJVO resetVO = buildHeadMoveJVO(
// terminalId,
// bioId,
// 0d
// );
// log.info("结束动作,头部回正 rad=0");
// edgeHumanoidRobotService.moveJ(resetVO);
// } catch (Exception e) {
// log.error("头部回正异常", e);
// }
// 停止张嘴
try {
// edgeBioHeadService.speakStop(speakVO);
edgeBioHeadService.speakStop(speakVO);
log.info("speakStop 已调用");
} catch (Exception e) {
log.error("speakStop 调用失败", e);
@ -309,7 +308,6 @@ public class FlowiseActionService {
EdgeMoveJVO.JointCmd headCmd = new EdgeMoveJVO.JointCmd();
headCmd.setJointName("HEAD_R");
headCmd.setRad(rad);
headCmd.setVel(0d);
vo.setCmds(Collections.singletonList(headCmd));
return vo;