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