fix: 实车调试
This commit is contained in:
parent
9cf4a6f2f9
commit
cdc5d8d222
@ -39,4 +39,17 @@ public class EdgeHumanoidRobotController {
|
||||
public AjaxResult status(EdgeCommonVO vo) {
|
||||
return AjaxResult.ok(edgeHumanoidRobotService.getJointState(vo));
|
||||
}
|
||||
|
||||
@ApiOperation("使能开")
|
||||
@GetMapping("/torqueOn")
|
||||
public AjaxResult torqueOn(EdgeCommonVO vo) {
|
||||
return AjaxResult.ok(edgeHumanoidRobotService.torqueOn(vo));
|
||||
}
|
||||
|
||||
@ApiOperation("使能关")
|
||||
@GetMapping("/torqueOff")
|
||||
public AjaxResult torqueOff(EdgeCommonVO vo) {
|
||||
return AjaxResult.ok(edgeHumanoidRobotService.torqueOff(vo));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,4 +24,19 @@ public interface EdgeBioHeadService {
|
||||
*/
|
||||
public String emergencyStop(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
/**
|
||||
* 开始说话
|
||||
*/
|
||||
public String speakStart(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
/**
|
||||
* 停止说话
|
||||
*/
|
||||
public String speakStop(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
/**
|
||||
* 表情
|
||||
*/
|
||||
public String specialExpression(String terminalId,String deviceId,Integer expressKey);
|
||||
|
||||
}
|
||||
|
||||
@ -22,4 +22,14 @@ public interface EdgeHumanoidRobotService {
|
||||
* 旋转关节
|
||||
*/
|
||||
public String speedJ(EdgeSpeedJVO vo);
|
||||
|
||||
/**
|
||||
* 使能开
|
||||
*/
|
||||
public String torqueOn(EdgeCommonVO vo);
|
||||
|
||||
/**
|
||||
* 使能关
|
||||
*/
|
||||
public String torqueOff(EdgeCommonVO vo);
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import cmvr.api.BioHeadServiceGrpc;
|
||||
import cmvr.api.BioheadCommand;
|
||||
import cmvr.api.Common;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.edge.client.manage.GrpcServiceManager;
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import com.cmvr.edge.client.model.biohead.EdgeFacialExpressionVO;
|
||||
@ -138,4 +139,54 @@ public class EdgeBioHeadServiceImpl implements EdgeBioHeadService {
|
||||
BioheadCommand.EmergencyStop.Feedback feedback = stub.emergencyStop(request);
|
||||
return JSON.toJSONString(feedback.getHeader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String speakStart(EdgeCommonVO edgeCommonVO) {
|
||||
String terminalId = edgeCommonVO.getTerminalId();
|
||||
String deviceId = edgeCommonVO.getDeviceId();
|
||||
BioHeadServiceGrpc.BioHeadServiceBlockingStub stub = grpcServiceManager.getGrpcClient(terminalId, BioHeadServiceGrpc.BioHeadServiceBlockingStub.class);
|
||||
|
||||
// 请求头
|
||||
Common.CommandHeader.Request header = EdgeCommonUtil.buildRequest(deviceId);
|
||||
BioheadCommand.SpeakStart.Request request = BioheadCommand.SpeakStart.Request.newBuilder().setHeader(header).build();
|
||||
BioheadCommand.SpeakStart.Feedback feedback = stub.speakStart(request);
|
||||
return JSON.toJSONString(feedback.getHeader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String speakStop(EdgeCommonVO edgeCommonVO) {
|
||||
String terminalId = edgeCommonVO.getTerminalId();
|
||||
String deviceId = edgeCommonVO.getDeviceId();
|
||||
BioHeadServiceGrpc.BioHeadServiceBlockingStub stub = grpcServiceManager.getGrpcClient(terminalId, BioHeadServiceGrpc.BioHeadServiceBlockingStub.class);
|
||||
|
||||
// 请求头
|
||||
Common.CommandHeader.Request header = EdgeCommonUtil.buildRequest(deviceId);
|
||||
BioheadCommand.SpeakStop.Request request = BioheadCommand.SpeakStop.Request.newBuilder().setHeader(header).build();
|
||||
BioheadCommand.SpeakStop.Feedback feedback = stub.speakStop(request);
|
||||
return JSON.toJSONString(feedback.getHeader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String specialExpression(String terminalId, String deviceId, Integer expressKey) {
|
||||
BioHeadServiceGrpc.BioHeadServiceBlockingStub stub = grpcServiceManager.getGrpcClient(terminalId, BioHeadServiceGrpc.BioHeadServiceBlockingStub.class);
|
||||
|
||||
// 请求头
|
||||
Common.CommandHeader.Request header = EdgeCommonUtil.buildRequest(deviceId);
|
||||
|
||||
if (expressKey == 1) {
|
||||
BioheadCommand.Happy.Request happy = BioheadCommand.Happy.Request.newBuilder().setHeader(header).build();
|
||||
BioheadCommand.Happy.Feedback happyBack = stub.happy(happy);
|
||||
return JSON.toJSONString(happyBack.getHeader());
|
||||
}else if (expressKey == 2) {
|
||||
BioheadCommand.Surprise.Request surprise = BioheadCommand.Surprise.Request.newBuilder().setHeader(header).build();
|
||||
BioheadCommand.Surprise.Feedback surpriseBack = stub.surprise(surprise);
|
||||
return JSON.toJSONString(surpriseBack.getHeader());
|
||||
} else if (expressKey == 3) {
|
||||
BioheadCommand.ExpressionTired.Request tired = BioheadCommand.ExpressionTired.Request.newBuilder().setHeader(header).build();
|
||||
BioheadCommand.ExpressionTired.Feedback tiredBack = stub.expressionTired(tired);
|
||||
return JSON.toJSONString(tiredBack.getHeader());
|
||||
}else {
|
||||
throw new GlobalException("错误的传参,1:高兴,2:惊讶,3:疲惫");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -76,4 +76,24 @@ public class EdgeHumanoidRobotServiceImpl implements EdgeHumanoidRobotService {
|
||||
HumanoidRobotCommand.SpeedJ.Response response = stub.speedJ(request);
|
||||
return JSON.toJSONString(response.getHeader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String torqueOn(EdgeCommonVO vo) {
|
||||
HumanoidRobotServiceGrpc.HumanoidRobotServiceBlockingStub stub =
|
||||
grpcServiceManager.getGrpcClient(vo.getTerminalId(), HumanoidRobotServiceGrpc.HumanoidRobotServiceBlockingStub.class);
|
||||
|
||||
Common.CommandHeader.Request header = EdgeCommonUtil.buildRequest(vo.getDeviceId());
|
||||
Common.CommandHeader.Feedback response = stub.torqueOn(header);
|
||||
return JSON.toJSONString(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String torqueOff(EdgeCommonVO vo) {
|
||||
HumanoidRobotServiceGrpc.HumanoidRobotServiceBlockingStub stub =
|
||||
grpcServiceManager.getGrpcClient(vo.getTerminalId(), HumanoidRobotServiceGrpc.HumanoidRobotServiceBlockingStub.class);
|
||||
|
||||
Common.CommandHeader.Request header = EdgeCommonUtil.buildRequest(vo.getDeviceId());
|
||||
Common.CommandHeader.Feedback response = stub.torqueOff(header);
|
||||
return JSON.toJSONString(response);
|
||||
}
|
||||
}
|
||||
|
||||
@ -142,6 +142,161 @@ public final class BioHeadServiceGrpc {
|
||||
return getEmergencyStopMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.SpeakStart.Request,
|
||||
cmvr.api.BioheadCommand.SpeakStart.Feedback> getSpeakStartMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "SpeakStart",
|
||||
requestType = cmvr.api.BioheadCommand.SpeakStart.Request.class,
|
||||
responseType = cmvr.api.BioheadCommand.SpeakStart.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.SpeakStart.Request,
|
||||
cmvr.api.BioheadCommand.SpeakStart.Feedback> getSpeakStartMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.SpeakStart.Request, cmvr.api.BioheadCommand.SpeakStart.Feedback> getSpeakStartMethod;
|
||||
if ((getSpeakStartMethod = BioHeadServiceGrpc.getSpeakStartMethod) == null) {
|
||||
synchronized (BioHeadServiceGrpc.class) {
|
||||
if ((getSpeakStartMethod = BioHeadServiceGrpc.getSpeakStartMethod) == null) {
|
||||
BioHeadServiceGrpc.getSpeakStartMethod = getSpeakStartMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.BioheadCommand.SpeakStart.Request, cmvr.api.BioheadCommand.SpeakStart.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "SpeakStart"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.BioheadCommand.SpeakStart.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.BioheadCommand.SpeakStart.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new BioHeadServiceMethodDescriptorSupplier("SpeakStart"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getSpeakStartMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.SpeakStop.Request,
|
||||
cmvr.api.BioheadCommand.SpeakStop.Feedback> getSpeakStopMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "SpeakStop",
|
||||
requestType = cmvr.api.BioheadCommand.SpeakStop.Request.class,
|
||||
responseType = cmvr.api.BioheadCommand.SpeakStop.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.SpeakStop.Request,
|
||||
cmvr.api.BioheadCommand.SpeakStop.Feedback> getSpeakStopMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.SpeakStop.Request, cmvr.api.BioheadCommand.SpeakStop.Feedback> getSpeakStopMethod;
|
||||
if ((getSpeakStopMethod = BioHeadServiceGrpc.getSpeakStopMethod) == null) {
|
||||
synchronized (BioHeadServiceGrpc.class) {
|
||||
if ((getSpeakStopMethod = BioHeadServiceGrpc.getSpeakStopMethod) == null) {
|
||||
BioHeadServiceGrpc.getSpeakStopMethod = getSpeakStopMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.BioheadCommand.SpeakStop.Request, cmvr.api.BioheadCommand.SpeakStop.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "SpeakStop"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.BioheadCommand.SpeakStop.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.BioheadCommand.SpeakStop.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new BioHeadServiceMethodDescriptorSupplier("SpeakStop"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getSpeakStopMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.Happy.Request,
|
||||
cmvr.api.BioheadCommand.Happy.Feedback> getHappyMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "Happy",
|
||||
requestType = cmvr.api.BioheadCommand.Happy.Request.class,
|
||||
responseType = cmvr.api.BioheadCommand.Happy.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.Happy.Request,
|
||||
cmvr.api.BioheadCommand.Happy.Feedback> getHappyMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.Happy.Request, cmvr.api.BioheadCommand.Happy.Feedback> getHappyMethod;
|
||||
if ((getHappyMethod = BioHeadServiceGrpc.getHappyMethod) == null) {
|
||||
synchronized (BioHeadServiceGrpc.class) {
|
||||
if ((getHappyMethod = BioHeadServiceGrpc.getHappyMethod) == null) {
|
||||
BioHeadServiceGrpc.getHappyMethod = getHappyMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.BioheadCommand.Happy.Request, cmvr.api.BioheadCommand.Happy.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Happy"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.BioheadCommand.Happy.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.BioheadCommand.Happy.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new BioHeadServiceMethodDescriptorSupplier("Happy"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getHappyMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.Surprise.Request,
|
||||
cmvr.api.BioheadCommand.Surprise.Feedback> getSurpriseMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "Surprise",
|
||||
requestType = cmvr.api.BioheadCommand.Surprise.Request.class,
|
||||
responseType = cmvr.api.BioheadCommand.Surprise.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.Surprise.Request,
|
||||
cmvr.api.BioheadCommand.Surprise.Feedback> getSurpriseMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.Surprise.Request, cmvr.api.BioheadCommand.Surprise.Feedback> getSurpriseMethod;
|
||||
if ((getSurpriseMethod = BioHeadServiceGrpc.getSurpriseMethod) == null) {
|
||||
synchronized (BioHeadServiceGrpc.class) {
|
||||
if ((getSurpriseMethod = BioHeadServiceGrpc.getSurpriseMethod) == null) {
|
||||
BioHeadServiceGrpc.getSurpriseMethod = getSurpriseMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.BioheadCommand.Surprise.Request, cmvr.api.BioheadCommand.Surprise.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Surprise"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.BioheadCommand.Surprise.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.BioheadCommand.Surprise.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new BioHeadServiceMethodDescriptorSupplier("Surprise"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getSurpriseMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.ExpressionTired.Request,
|
||||
cmvr.api.BioheadCommand.ExpressionTired.Feedback> getExpressionTiredMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "ExpressionTired",
|
||||
requestType = cmvr.api.BioheadCommand.ExpressionTired.Request.class,
|
||||
responseType = cmvr.api.BioheadCommand.ExpressionTired.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.ExpressionTired.Request,
|
||||
cmvr.api.BioheadCommand.ExpressionTired.Feedback> getExpressionTiredMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.BioheadCommand.ExpressionTired.Request, cmvr.api.BioheadCommand.ExpressionTired.Feedback> getExpressionTiredMethod;
|
||||
if ((getExpressionTiredMethod = BioHeadServiceGrpc.getExpressionTiredMethod) == null) {
|
||||
synchronized (BioHeadServiceGrpc.class) {
|
||||
if ((getExpressionTiredMethod = BioHeadServiceGrpc.getExpressionTiredMethod) == null) {
|
||||
BioHeadServiceGrpc.getExpressionTiredMethod = getExpressionTiredMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.BioheadCommand.ExpressionTired.Request, cmvr.api.BioheadCommand.ExpressionTired.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ExpressionTired"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.BioheadCommand.ExpressionTired.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.BioheadCommand.ExpressionTired.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new BioHeadServiceMethodDescriptorSupplier("ExpressionTired"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getExpressionTiredMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new async stub that supports all call types for the service
|
||||
*/
|
||||
@ -230,6 +385,47 @@ public final class BioHeadServiceGrpc {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getEmergencyStopMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 开始说话
|
||||
* </pre>
|
||||
*/
|
||||
public void speakStart(cmvr.api.BioheadCommand.SpeakStart.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.SpeakStart.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSpeakStartMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 停止说话
|
||||
* </pre>
|
||||
*/
|
||||
public void speakStop(cmvr.api.BioheadCommand.SpeakStop.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.SpeakStop.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSpeakStopMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void happy(cmvr.api.BioheadCommand.Happy.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.Happy.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getHappyMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void surprise(cmvr.api.BioheadCommand.Surprise.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.Surprise.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSurpriseMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void expressionTired(cmvr.api.BioheadCommand.ExpressionTired.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.ExpressionTired.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getExpressionTiredMethod(), responseObserver);
|
||||
}
|
||||
|
||||
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
||||
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
||||
.addMethod(
|
||||
@ -260,6 +456,41 @@ public final class BioHeadServiceGrpc {
|
||||
cmvr.api.BioheadCommand.EmergencyStop.Request,
|
||||
cmvr.api.BioheadCommand.EmergencyStop.Feedback>(
|
||||
this, METHODID_EMERGENCY_STOP)))
|
||||
.addMethod(
|
||||
getSpeakStartMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.BioheadCommand.SpeakStart.Request,
|
||||
cmvr.api.BioheadCommand.SpeakStart.Feedback>(
|
||||
this, METHODID_SPEAK_START)))
|
||||
.addMethod(
|
||||
getSpeakStopMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.BioheadCommand.SpeakStop.Request,
|
||||
cmvr.api.BioheadCommand.SpeakStop.Feedback>(
|
||||
this, METHODID_SPEAK_STOP)))
|
||||
.addMethod(
|
||||
getHappyMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.BioheadCommand.Happy.Request,
|
||||
cmvr.api.BioheadCommand.Happy.Feedback>(
|
||||
this, METHODID_HAPPY)))
|
||||
.addMethod(
|
||||
getSurpriseMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.BioheadCommand.Surprise.Request,
|
||||
cmvr.api.BioheadCommand.Surprise.Feedback>(
|
||||
this, METHODID_SURPRISE)))
|
||||
.addMethod(
|
||||
getExpressionTiredMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.BioheadCommand.ExpressionTired.Request,
|
||||
cmvr.api.BioheadCommand.ExpressionTired.Feedback>(
|
||||
this, METHODID_EXPRESSION_TIRED)))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@ -321,6 +552,52 @@ public final class BioHeadServiceGrpc {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getEmergencyStopMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 开始说话
|
||||
* </pre>
|
||||
*/
|
||||
public void speakStart(cmvr.api.BioheadCommand.SpeakStart.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.SpeakStart.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getSpeakStartMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 停止说话
|
||||
* </pre>
|
||||
*/
|
||||
public void speakStop(cmvr.api.BioheadCommand.SpeakStop.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.SpeakStop.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getSpeakStopMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void happy(cmvr.api.BioheadCommand.Happy.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.Happy.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getHappyMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void surprise(cmvr.api.BioheadCommand.Surprise.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.Surprise.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getSurpriseMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void expressionTired(cmvr.api.BioheadCommand.ExpressionTired.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.ExpressionTired.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getExpressionTiredMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -369,6 +646,47 @@ public final class BioHeadServiceGrpc {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getEmergencyStopMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 开始说话
|
||||
* </pre>
|
||||
*/
|
||||
public cmvr.api.BioheadCommand.SpeakStart.Feedback speakStart(cmvr.api.BioheadCommand.SpeakStart.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSpeakStartMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 停止说话
|
||||
* </pre>
|
||||
*/
|
||||
public cmvr.api.BioheadCommand.SpeakStop.Feedback speakStop(cmvr.api.BioheadCommand.SpeakStop.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSpeakStopMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.BioheadCommand.Happy.Feedback happy(cmvr.api.BioheadCommand.Happy.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getHappyMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.BioheadCommand.Surprise.Feedback surprise(cmvr.api.BioheadCommand.Surprise.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSurpriseMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.BioheadCommand.ExpressionTired.Feedback expressionTired(cmvr.api.BioheadCommand.ExpressionTired.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getExpressionTiredMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -420,12 +738,63 @@ public final class BioHeadServiceGrpc {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getEmergencyStopMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 开始说话
|
||||
* </pre>
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.BioheadCommand.SpeakStart.Feedback> speakStart(
|
||||
cmvr.api.BioheadCommand.SpeakStart.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getSpeakStartMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 停止说话
|
||||
* </pre>
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.BioheadCommand.SpeakStop.Feedback> speakStop(
|
||||
cmvr.api.BioheadCommand.SpeakStop.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getSpeakStopMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.BioheadCommand.Happy.Feedback> happy(
|
||||
cmvr.api.BioheadCommand.Happy.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getHappyMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.BioheadCommand.Surprise.Feedback> surprise(
|
||||
cmvr.api.BioheadCommand.Surprise.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getSurpriseMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.BioheadCommand.ExpressionTired.Feedback> expressionTired(
|
||||
cmvr.api.BioheadCommand.ExpressionTired.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getExpressionTiredMethod(), getCallOptions()), request);
|
||||
}
|
||||
}
|
||||
|
||||
private static final int METHODID_SET_EXPRESSION = 0;
|
||||
private static final int METHODID_GET_SYSTEM_STATUS = 1;
|
||||
private static final int METHODID_EMERGENCY_STOP = 2;
|
||||
private static final int METHODID_STREAM_EXPRESSION = 3;
|
||||
private static final int METHODID_SPEAK_START = 3;
|
||||
private static final int METHODID_SPEAK_STOP = 4;
|
||||
private static final int METHODID_HAPPY = 5;
|
||||
private static final int METHODID_SURPRISE = 6;
|
||||
private static final int METHODID_EXPRESSION_TIRED = 7;
|
||||
private static final int METHODID_STREAM_EXPRESSION = 8;
|
||||
|
||||
private static final class MethodHandlers<Req, Resp> implements
|
||||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
||||
@ -456,6 +825,26 @@ public final class BioHeadServiceGrpc {
|
||||
serviceImpl.emergencyStop((cmvr.api.BioheadCommand.EmergencyStop.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.EmergencyStop.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_SPEAK_START:
|
||||
serviceImpl.speakStart((cmvr.api.BioheadCommand.SpeakStart.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.SpeakStart.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_SPEAK_STOP:
|
||||
serviceImpl.speakStop((cmvr.api.BioheadCommand.SpeakStop.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.SpeakStop.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_HAPPY:
|
||||
serviceImpl.happy((cmvr.api.BioheadCommand.Happy.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.Happy.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_SURPRISE:
|
||||
serviceImpl.surprise((cmvr.api.BioheadCommand.Surprise.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.Surprise.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_EXPRESSION_TIRED:
|
||||
serviceImpl.expressionTired((cmvr.api.BioheadCommand.ExpressionTired.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.BioheadCommand.ExpressionTired.Feedback>) responseObserver);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
@ -524,6 +913,11 @@ public final class BioHeadServiceGrpc {
|
||||
.addMethod(getStreamExpressionMethod())
|
||||
.addMethod(getGetSystemStatusMethod())
|
||||
.addMethod(getEmergencyStopMethod())
|
||||
.addMethod(getSpeakStartMethod())
|
||||
.addMethod(getSpeakStopMethod())
|
||||
.addMethod(getHappyMethod())
|
||||
.addMethod(getSurpriseMethod())
|
||||
.addMethod(getExpressionTiredMethod())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -24,17 +24,27 @@ public final class BioheadService {
|
||||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\036cmvr/api/biohead_service.proto\022\010cmvr.a" +
|
||||
"pi\032\036cmvr/api/biohead_command.proto2\207\003\n\016B" +
|
||||
"pi\032\036cmvr/api/biohead_command.proto2\375\005\n\016B" +
|
||||
"ioHeadService\022`\n\rSetExpression\022%.cmvr.ap" +
|
||||
"i.SetFacialExpression.Request\032&.cmvr.api" +
|
||||
".SetFacialExpression.Feedback\"\000\022m\n\020Strea" +
|
||||
".SetFacialExpression.Feedback\"\000\022k\n\020Strea" +
|
||||
"mExpression\022(.cmvr.api.StreamFacialExpre" +
|
||||
"ssion.Request\032).cmvr.api.StreamFacialExp" +
|
||||
"ression.Feedback\"\000(\0010\001\022N\n\017GetSystemStatu" +
|
||||
"s\022\033.cmvr.api.GetStatus.Request\032\034.cmvr.ap" +
|
||||
"i.GetStatus.Feedback\"\000\022T\n\rEmergencyStop\022" +
|
||||
"\037.cmvr.api.EmergencyStop.Request\032 .cmvr." +
|
||||
"api.EmergencyStop.Feedback\"\000b\006proto3"
|
||||
"ression.Feedback(\0010\001\022N\n\017GetSystemStatus\022" +
|
||||
"\033.cmvr.api.GetStatus.Request\032\034.cmvr.api." +
|
||||
"GetStatus.Feedback\"\000\022T\n\rEmergencyStop\022\037." +
|
||||
"cmvr.api.EmergencyStop.Request\032 .cmvr.ap" +
|
||||
"i.EmergencyStop.Feedback\"\000\022K\n\nSpeakStart" +
|
||||
"\022\034.cmvr.api.SpeakStart.Request\032\035.cmvr.ap" +
|
||||
"i.SpeakStart.Feedback\"\000\022H\n\tSpeakStop\022\033.c" +
|
||||
"mvr.api.SpeakStop.Request\032\034.cmvr.api.Spe" +
|
||||
"akStop.Feedback\"\000\022<\n\005Happy\022\027.cmvr.api.Ha" +
|
||||
"ppy.Request\032\030.cmvr.api.Happy.Feedback\"\000\022" +
|
||||
"E\n\010Surprise\022\032.cmvr.api.Surprise.Request\032" +
|
||||
"\033.cmvr.api.Surprise.Feedback\"\000\022Z\n\017Expres" +
|
||||
"sionTired\022!.cmvr.api.ExpressionTired.Req" +
|
||||
"uest\032\".cmvr.api.ExpressionTired.Feedback" +
|
||||
"\"\000b\006proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
|
||||
@ -173,3 +173,60 @@ message EmergencyStop {
|
||||
string stopped_processes = 2; // 已停止的进程列表
|
||||
}
|
||||
}
|
||||
|
||||
message SpeakStart {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1; // 通用命令头
|
||||
}
|
||||
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1; // 通用反馈头
|
||||
}
|
||||
}
|
||||
|
||||
message SpeakStop {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1; // 通用命令头
|
||||
}
|
||||
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1; // 通用反馈头
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 表情控制 - 高兴
|
||||
message Happy {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1; // 通用命令头
|
||||
}
|
||||
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1; // 通用反馈头
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 表情控制 - 惊讶
|
||||
message Surprise {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1; // 通用命令头
|
||||
}
|
||||
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1; // 通用反馈头
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
message ExpressionTired {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1;
|
||||
}
|
||||
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
}
|
||||
}
|
||||
@ -11,7 +11,7 @@ service BioHeadService {
|
||||
// 流式表情控制
|
||||
//rpc StreamExpression(StreamFacialExpression.Request) returns (StreamFacialExpression.Feedback){};
|
||||
|
||||
rpc StreamExpression (stream StreamFacialExpression.Request) returns (stream StreamFacialExpression.Feedback){};
|
||||
rpc StreamExpression (stream StreamFacialExpression.Request) returns (stream StreamFacialExpression.Feedback);
|
||||
|
||||
|
||||
// 获取状态
|
||||
@ -19,4 +19,18 @@ service BioHeadService {
|
||||
|
||||
// 紧急停止
|
||||
rpc EmergencyStop(EmergencyStop.Request) returns (EmergencyStop.Feedback){};
|
||||
|
||||
// 开始说话
|
||||
rpc SpeakStart(SpeakStart.Request) returns (SpeakStart.Feedback){};
|
||||
// 停止说话
|
||||
rpc SpeakStop(SpeakStop.Request) returns (SpeakStop.Feedback){};
|
||||
|
||||
rpc Happy(Happy.Request) returns (Happy.Feedback){};
|
||||
|
||||
rpc Surprise(Surprise.Request) returns (Surprise.Feedback){};
|
||||
|
||||
rpc ExpressionTired(ExpressionTired.Request) returns (ExpressionTired.Feedback){};
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -46,6 +46,11 @@ public enum ActionEnum {
|
||||
// ---------------机械臂---------------
|
||||
TOUCH("EDGE", "TOUCH", "触控"),
|
||||
|
||||
// --------------- 头部 ---------------
|
||||
BIO_HEAD_SPEAK_START("EDGE", "BIO_HEAD_SPEAK_START", "开始说话"),
|
||||
BIO_HEAD_SPEAK_STOP("EDGE", "BIO_HEAD_SPEAK_STOP", "停止说话"),
|
||||
BIO_HEAD_SPECIAL_EXPRESSION("EDGE", "BIO_HEAD_SPECIAL_EXPRESSION", "表情,1:高兴,2:惊讶,3:疲惫"),
|
||||
|
||||
// 大模型行为
|
||||
// ---------------获取触控坐标---------------
|
||||
TOUCH_COORDINATES("LLM", "TOUCH_COORDINATES", "获取触控坐标"),
|
||||
|
||||
@ -0,0 +1,60 @@
|
||||
package com.cmvr.test.flow.runtime.operator.edge;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import com.cmvr.edge.client.service.EdgeBioHeadService;
|
||||
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 EdgeHeadOperateService implements EdgeOperateService {
|
||||
|
||||
private final EdgeBioHeadService edgeBioHeadService;
|
||||
|
||||
@Override
|
||||
public boolean supports(ActionEnum action) {
|
||||
return action.name().startsWith("BIO_HEAD_");
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskNodeExecuteResult execute(TaskNodeExecuteMessage message) {
|
||||
ActionEnum action = message.getAction();
|
||||
JSONObject inputParams = message.getInputParams();
|
||||
String terminalId = message.getTerminalId();
|
||||
String deviceId = inputParams.getString("deviceId");
|
||||
|
||||
switch (action) {
|
||||
case BIO_HEAD_SPEAK_START: {
|
||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||
edgeCommonVO.setDeviceId(deviceId);
|
||||
edgeCommonVO.setTerminalId(terminalId);
|
||||
edgeBioHeadService.speakStart(edgeCommonVO);
|
||||
break;
|
||||
}
|
||||
case BIO_HEAD_SPEAK_STOP: {
|
||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||
edgeCommonVO.setDeviceId(deviceId);
|
||||
edgeCommonVO.setTerminalId(terminalId);
|
||||
edgeBioHeadService.speakStop(edgeCommonVO);
|
||||
break;
|
||||
}
|
||||
case BIO_HEAD_SPECIAL_EXPRESSION: {
|
||||
Integer expressKey = inputParams.getInteger("expressKey");
|
||||
edgeBioHeadService.specialExpression(terminalId,deviceId,expressKey);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new GlobalException("不支持的头部操作类型: " + action);
|
||||
}
|
||||
return TaskNodeExecuteResult.success();
|
||||
}
|
||||
|
||||
}
|
||||
@ -12,6 +12,8 @@ import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@ -37,6 +39,15 @@ public class EdgeTouchOperateService implements EdgeOperateService {
|
||||
EdgeMoveJVO edgeMoveJVO = JSON.parseObject(touchParams, EdgeMoveJVO.class);
|
||||
edgeMoveJVO.setTerminalId(terminalId);
|
||||
edgeMoveJVO.setDeviceId(deviceId);
|
||||
|
||||
edgeMoveJVO.setAcc(6d);
|
||||
edgeMoveJVO.setVel(6d);
|
||||
List<EdgeMoveJVO.JointCmd> cmds = edgeMoveJVO.getCmds();
|
||||
for (EdgeMoveJVO.JointCmd cmd : cmds) {
|
||||
if (cmd.getJointName().equals("R_WRIST_Y")) {
|
||||
cmd.setRad(cmd.getRad() - 0.12d);
|
||||
}
|
||||
}
|
||||
edgeHumanoidRobotService.moveJ(edgeMoveJVO);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -3,6 +3,8 @@ package com.cmvr.test.flow.runtime.operator.vi;
|
||||
import cmvr.api.SpeakerCommand;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import com.cmvr.edge.client.service.EdgeBioHeadService;
|
||||
import com.cmvr.edge.client.service.EdgeSpeakerService;
|
||||
import com.cmvr.test.enums.ActionEnum;
|
||||
import com.cmvr.test.flow.runtime.message.TaskNodeExecuteMessage;
|
||||
@ -24,6 +26,7 @@ import java.io.File;
|
||||
public class ViPlayOperateService implements VIOperateService {
|
||||
|
||||
private final EdgeSpeakerService edgeSpeakerService;
|
||||
private final EdgeBioHeadService edgeBioHeadService;
|
||||
|
||||
@Override
|
||||
public boolean supports(ActionEnum action) {
|
||||
@ -41,6 +44,11 @@ public class ViPlayOperateService implements VIOperateService {
|
||||
String audioPath = inputParams.getString("audioPath");
|
||||
String terminalId = message.getTerminalId();
|
||||
log.info("播放语料成功,deviceId={},audioPath={},terminalId={}", deviceId, audioPath, terminalId);
|
||||
// 播放前调用张嘴
|
||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||
edgeCommonVO.setDeviceId(deviceId);
|
||||
edgeCommonVO.setTerminalId(terminalId);
|
||||
edgeBioHeadService.speakStart(edgeCommonVO);
|
||||
edgeSpeakerService.playAudio(terminalId, deviceId, audioPath);
|
||||
// 等待播放完成
|
||||
while (true) {
|
||||
@ -55,7 +63,8 @@ public class ViPlayOperateService implements VIOperateService {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 播放完成调用闭嘴
|
||||
edgeBioHeadService.speakStop(edgeCommonVO);
|
||||
// todo 本机测试播放
|
||||
// playAudio(audioPath);
|
||||
return TaskNodeExecuteResult.success();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user