feat(arm): 添加机械臂故障清除功能
- 在 ArmService 中新增 clearFault RPC 方法 - 生成对应的 gRPC 客户端和服务端方法实现 - 在 EdgeArmController 中添加 /clearFault 接口 - 实现 EdgeArmService 的 clearFault 业务逻辑 - 更新方法 ID 映射和协议缓冲区描述符 - 添加同步和异步调用支持
This commit is contained in:
parent
9f462e41fc
commit
152cae0323
@ -43,6 +43,16 @@ public class EdgeArmController {
|
|||||||
return AjaxResult.ok();
|
return AjaxResult.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除机械臂故障状态。
|
||||||
|
*/
|
||||||
|
@ApiOperation("清除故障")
|
||||||
|
@GetMapping("/clearFault")
|
||||||
|
public AjaxResult clearFault(EdgeCommonVO vo) {
|
||||||
|
edgeArmService.clearFault(vo);
|
||||||
|
return AjaxResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
@ApiOperation("关节空间运动")
|
@ApiOperation("关节空间运动")
|
||||||
@PostMapping("/moveJ")
|
@PostMapping("/moveJ")
|
||||||
public AjaxResult moveJ(@RequestBody EdgeArmMoveJVO moveJVO) {
|
public AjaxResult moveJ(@RequestBody EdgeArmMoveJVO moveJVO) {
|
||||||
|
|||||||
@ -30,6 +30,14 @@ public interface EdgeArmService {
|
|||||||
*/
|
*/
|
||||||
Common.CommandHeader.Feedback torqueOn(EdgeCommonVO edgeCommonVO);
|
Common.CommandHeader.Feedback torqueOn(EdgeCommonVO edgeCommonVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 清除机械臂故障状态。
|
||||||
|
*
|
||||||
|
* @param edgeCommonVO 边缘设备通用参数,包含 terminalId 和 deviceId
|
||||||
|
* @return 机器人终端返回的通用反馈
|
||||||
|
*/
|
||||||
|
Common.CommandHeader.Feedback clearFault(EdgeCommonVO edgeCommonVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关节空间运动(命令码:moveJ)
|
* 关节空间运动(命令码:moveJ)
|
||||||
* 控制机械臂通过关节空间插值运动到目标关节位置
|
* 控制机械臂通过关节空间插值运动到目标关节位置
|
||||||
|
|||||||
@ -44,6 +44,14 @@ public class EdgeArmServiceImpl implements EdgeArmService {
|
|||||||
return executeGrpcCall(() -> stub.torqueOn(request));
|
return executeGrpcCall(() -> stub.torqueOn(request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Common.CommandHeader.Feedback clearFault(EdgeCommonVO edgeCommonVO) {
|
||||||
|
ArmServiceGrpc.ArmServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||||
|
edgeCommonVO.getTerminalId(), ArmServiceGrpc.ArmServiceBlockingStub.class);
|
||||||
|
Common.CommandHeader.Request request = EdgeCommonUtil.buildRequest(edgeCommonVO.getDeviceId());
|
||||||
|
return executeGrpcCall(() -> stub.clearFault(request));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ArmCommand.MoveJ.Response moveJ(EdgeCommonVO edgeCommonVO, double[] target, Double velocity,
|
public ArmCommand.MoveJ.Response moveJ(EdgeCommonVO edgeCommonVO, double[] target, Double velocity,
|
||||||
Double acceleration, Double blendRadius,
|
Double acceleration, Double blendRadius,
|
||||||
|
|||||||
@ -77,6 +77,37 @@ public final class ArmServiceGrpc {
|
|||||||
return getTorqueOnMethod;
|
return getTorqueOnMethod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static volatile io.grpc.MethodDescriptor<cmvr.api.Common.CommandHeader.Request,
|
||||||
|
cmvr.api.Common.CommandHeader.Feedback> getClearFaultMethod;
|
||||||
|
|
||||||
|
@io.grpc.stub.annotations.RpcMethod(
|
||||||
|
fullMethodName = SERVICE_NAME + '/' + "clearFault",
|
||||||
|
requestType = cmvr.api.Common.CommandHeader.Request.class,
|
||||||
|
responseType = cmvr.api.Common.CommandHeader.Feedback.class,
|
||||||
|
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||||
|
public static io.grpc.MethodDescriptor<cmvr.api.Common.CommandHeader.Request,
|
||||||
|
cmvr.api.Common.CommandHeader.Feedback> getClearFaultMethod() {
|
||||||
|
io.grpc.MethodDescriptor<cmvr.api.Common.CommandHeader.Request, cmvr.api.Common.CommandHeader.Feedback> getClearFaultMethod;
|
||||||
|
if ((getClearFaultMethod = ArmServiceGrpc.getClearFaultMethod) == null) {
|
||||||
|
synchronized (ArmServiceGrpc.class) {
|
||||||
|
if ((getClearFaultMethod = ArmServiceGrpc.getClearFaultMethod) == null) {
|
||||||
|
ArmServiceGrpc.getClearFaultMethod = getClearFaultMethod =
|
||||||
|
io.grpc.MethodDescriptor.<cmvr.api.Common.CommandHeader.Request, cmvr.api.Common.CommandHeader.Feedback>newBuilder()
|
||||||
|
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||||
|
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "clearFault"))
|
||||||
|
.setSampledToLocalTracing(true)
|
||||||
|
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||||
|
cmvr.api.Common.CommandHeader.Request.getDefaultInstance()))
|
||||||
|
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||||
|
cmvr.api.Common.CommandHeader.Feedback.getDefaultInstance()))
|
||||||
|
.setSchemaDescriptor(new ArmServiceMethodDescriptorSupplier("clearFault"))
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getClearFaultMethod;
|
||||||
|
}
|
||||||
|
|
||||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.ArmCommand.MoveJ.Request,
|
private static volatile io.grpc.MethodDescriptor<cmvr.api.ArmCommand.MoveJ.Request,
|
||||||
cmvr.api.ArmCommand.MoveJ.Response> getMoveJMethod;
|
cmvr.api.ArmCommand.MoveJ.Response> getMoveJMethod;
|
||||||
|
|
||||||
@ -480,6 +511,13 @@ public final class ArmServiceGrpc {
|
|||||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getTorqueOnMethod(), responseObserver);
|
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getTorqueOnMethod(), responseObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public void clearFault(cmvr.api.Common.CommandHeader.Request request,
|
||||||
|
io.grpc.stub.StreamObserver<cmvr.api.Common.CommandHeader.Feedback> responseObserver) {
|
||||||
|
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getClearFaultMethod(), responseObserver);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public void moveJ(cmvr.api.ArmCommand.MoveJ.Request request,
|
public void moveJ(cmvr.api.ArmCommand.MoveJ.Request request,
|
||||||
@ -573,6 +611,13 @@ public final class ArmServiceGrpc {
|
|||||||
cmvr.api.Common.CommandHeader.Request,
|
cmvr.api.Common.CommandHeader.Request,
|
||||||
cmvr.api.Common.CommandHeader.Feedback>(
|
cmvr.api.Common.CommandHeader.Feedback>(
|
||||||
this, METHODID_TORQUE_ON)))
|
this, METHODID_TORQUE_ON)))
|
||||||
|
.addMethod(
|
||||||
|
getClearFaultMethod(),
|
||||||
|
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||||
|
new MethodHandlers<
|
||||||
|
cmvr.api.Common.CommandHeader.Request,
|
||||||
|
cmvr.api.Common.CommandHeader.Feedback>(
|
||||||
|
this, METHODID_CLEAR_FAULT)))
|
||||||
.addMethod(
|
.addMethod(
|
||||||
getMoveJMethod(),
|
getMoveJMethod(),
|
||||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||||
@ -684,6 +729,14 @@ public final class ArmServiceGrpc {
|
|||||||
getChannel().newCall(getTorqueOnMethod(), getCallOptions()), request, responseObserver);
|
getChannel().newCall(getTorqueOnMethod(), getCallOptions()), request, responseObserver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public void clearFault(cmvr.api.Common.CommandHeader.Request request,
|
||||||
|
io.grpc.stub.StreamObserver<cmvr.api.Common.CommandHeader.Feedback> responseObserver) {
|
||||||
|
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||||
|
getChannel().newCall(getClearFaultMethod(), getCallOptions()), request, responseObserver);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public void moveJ(cmvr.api.ArmCommand.MoveJ.Request request,
|
public void moveJ(cmvr.api.ArmCommand.MoveJ.Request request,
|
||||||
@ -801,6 +854,13 @@ public final class ArmServiceGrpc {
|
|||||||
getChannel(), getTorqueOnMethod(), getCallOptions(), request);
|
getChannel(), getTorqueOnMethod(), getCallOptions(), request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public cmvr.api.Common.CommandHeader.Feedback clearFault(cmvr.api.Common.CommandHeader.Request request) {
|
||||||
|
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||||
|
getChannel(), getClearFaultMethod(), getCallOptions(), request);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public cmvr.api.ArmCommand.MoveJ.Response moveJ(cmvr.api.ArmCommand.MoveJ.Request request) {
|
public cmvr.api.ArmCommand.MoveJ.Response moveJ(cmvr.api.ArmCommand.MoveJ.Request request) {
|
||||||
@ -909,6 +969,14 @@ public final class ArmServiceGrpc {
|
|||||||
getChannel().newCall(getTorqueOnMethod(), getCallOptions()), request);
|
getChannel().newCall(getTorqueOnMethod(), getCallOptions()), request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*/
|
||||||
|
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.Common.CommandHeader.Feedback> clearFault(
|
||||||
|
cmvr.api.Common.CommandHeader.Request request) {
|
||||||
|
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||||
|
getChannel().newCall(getClearFaultMethod(), getCallOptions()), request);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.ArmCommand.MoveJ.Response> moveJ(
|
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.ArmCommand.MoveJ.Response> moveJ(
|
||||||
@ -1000,17 +1068,18 @@ public final class ArmServiceGrpc {
|
|||||||
|
|
||||||
private static final int METHODID_TORQUE_OFF = 0;
|
private static final int METHODID_TORQUE_OFF = 0;
|
||||||
private static final int METHODID_TORQUE_ON = 1;
|
private static final int METHODID_TORQUE_ON = 1;
|
||||||
private static final int METHODID_MOVE_J = 2;
|
private static final int METHODID_CLEAR_FAULT = 2;
|
||||||
private static final int METHODID_MOVE_L = 3;
|
private static final int METHODID_MOVE_J = 3;
|
||||||
private static final int METHODID_SPEED_J = 4;
|
private static final int METHODID_MOVE_L = 4;
|
||||||
private static final int METHODID_SPEED_L = 5;
|
private static final int METHODID_SPEED_J = 5;
|
||||||
private static final int METHODID_SERVO_J = 6;
|
private static final int METHODID_SPEED_L = 6;
|
||||||
private static final int METHODID_STOP_MOTION = 7;
|
private static final int METHODID_SERVO_J = 7;
|
||||||
private static final int METHODID_GET_JOINT_STATE = 8;
|
private static final int METHODID_STOP_MOTION = 8;
|
||||||
private static final int METHODID_GET_POSE = 9;
|
private static final int METHODID_GET_JOINT_STATE = 9;
|
||||||
private static final int METHODID_CALIBRATE_ZERO_Q = 10;
|
private static final int METHODID_GET_POSE = 10;
|
||||||
private static final int METHODID_GET_POSE_MATRIX = 11;
|
private static final int METHODID_CALIBRATE_ZERO_Q = 11;
|
||||||
private static final int METHODID_COMPUTE_FORWARD_KINEMATICS = 12;
|
private static final int METHODID_GET_POSE_MATRIX = 12;
|
||||||
|
private static final int METHODID_COMPUTE_FORWARD_KINEMATICS = 13;
|
||||||
|
|
||||||
private static final class MethodHandlers<Req, Resp> implements
|
private static final class MethodHandlers<Req, Resp> implements
|
||||||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
||||||
@ -1037,6 +1106,10 @@ public final class ArmServiceGrpc {
|
|||||||
serviceImpl.torqueOn((cmvr.api.Common.CommandHeader.Request) request,
|
serviceImpl.torqueOn((cmvr.api.Common.CommandHeader.Request) request,
|
||||||
(io.grpc.stub.StreamObserver<cmvr.api.Common.CommandHeader.Feedback>) responseObserver);
|
(io.grpc.stub.StreamObserver<cmvr.api.Common.CommandHeader.Feedback>) responseObserver);
|
||||||
break;
|
break;
|
||||||
|
case METHODID_CLEAR_FAULT:
|
||||||
|
serviceImpl.clearFault((cmvr.api.Common.CommandHeader.Request) request,
|
||||||
|
(io.grpc.stub.StreamObserver<cmvr.api.Common.CommandHeader.Feedback>) responseObserver);
|
||||||
|
break;
|
||||||
case METHODID_MOVE_J:
|
case METHODID_MOVE_J:
|
||||||
serviceImpl.moveJ((cmvr.api.ArmCommand.MoveJ.Request) request,
|
serviceImpl.moveJ((cmvr.api.ArmCommand.MoveJ.Request) request,
|
||||||
(io.grpc.stub.StreamObserver<cmvr.api.ArmCommand.MoveJ.Response>) responseObserver);
|
(io.grpc.stub.StreamObserver<cmvr.api.ArmCommand.MoveJ.Response>) responseObserver);
|
||||||
@ -1144,6 +1217,7 @@ public final class ArmServiceGrpc {
|
|||||||
.setSchemaDescriptor(new ArmServiceFileDescriptorSupplier())
|
.setSchemaDescriptor(new ArmServiceFileDescriptorSupplier())
|
||||||
.addMethod(getTorqueOffMethod())
|
.addMethod(getTorqueOffMethod())
|
||||||
.addMethod(getTorqueOnMethod())
|
.addMethod(getTorqueOnMethod())
|
||||||
|
.addMethod(getClearFaultMethod())
|
||||||
.addMethod(getMoveJMethod())
|
.addMethod(getMoveJMethod())
|
||||||
.addMethod(getMoveLMethod())
|
.addMethod(getMoveLMethod())
|
||||||
.addMethod(getSpeedJMethod())
|
.addMethod(getSpeedJMethod())
|
||||||
|
|||||||
@ -25,32 +25,34 @@ public final class ArmServiceOuterClass {
|
|||||||
java.lang.String[] descriptorData = {
|
java.lang.String[] descriptorData = {
|
||||||
"\n\032cmvr/api/arm_service.proto\022\010cmvr.api\032\025" +
|
"\n\032cmvr/api/arm_service.proto\022\010cmvr.api\032\025" +
|
||||||
"cmvr/api/common.proto\032\032cmvr/api/arm_comm" +
|
"cmvr/api/common.proto\032\032cmvr/api/arm_comm" +
|
||||||
"and.proto2\325\007\n\nArmService\022N\n\ttorqueOff\022\037." +
|
"and.proto2\246\010\n\nArmService\022N\n\ttorqueOff\022\037." +
|
||||||
"cmvr.api.CommandHeader.Request\032 .cmvr.ap" +
|
"cmvr.api.CommandHeader.Request\032 .cmvr.ap" +
|
||||||
"i.CommandHeader.Feedback\022M\n\010torqueOn\022\037.c" +
|
"i.CommandHeader.Feedback\022M\n\010torqueOn\022\037.c" +
|
||||||
"mvr.api.CommandHeader.Request\032 .cmvr.api" +
|
"mvr.api.CommandHeader.Request\032 .cmvr.api" +
|
||||||
".CommandHeader.Feedback\022:\n\005moveJ\022\027.cmvr." +
|
".CommandHeader.Feedback\022O\n\nclearFault\022\037." +
|
||||||
"api.MoveJ.Request\032\030.cmvr.api.MoveJ.Respo" +
|
"cmvr.api.CommandHeader.Request\032 .cmvr.ap" +
|
||||||
"nse\022:\n\005moveL\022\027.cmvr.api.MoveL.Request\032\030." +
|
"i.CommandHeader.Feedback\022:\n\005moveJ\022\027.cmvr" +
|
||||||
"cmvr.api.MoveL.Response\022=\n\006speedJ\022\030.cmvr" +
|
".api.MoveJ.Request\032\030.cmvr.api.MoveJ.Resp" +
|
||||||
".api.SpeedJ.Request\032\031.cmvr.api.SpeedJ.Re" +
|
"onse\022:\n\005moveL\022\027.cmvr.api.MoveL.Request\032\030" +
|
||||||
"sponse\022=\n\006speedL\022\030.cmvr.api.SpeedL.Reque" +
|
".cmvr.api.MoveL.Response\022=\n\006speedJ\022\030.cmv" +
|
||||||
"st\032\031.cmvr.api.SpeedL.Response\022=\n\006servoJ\022" +
|
"r.api.SpeedJ.Request\032\031.cmvr.api.SpeedJ.R" +
|
||||||
"\030.cmvr.api.ServoJ.Request\032\031.cmvr.api.Ser" +
|
"esponse\022=\n\006speedL\022\030.cmvr.api.SpeedL.Requ" +
|
||||||
"voJ.Response\022O\n\nstopMotion\022\037.cmvr.api.Co" +
|
"est\032\031.cmvr.api.SpeedL.Response\022=\n\006servoJ" +
|
||||||
"mmandHeader.Request\032 .cmvr.api.CommandHe" +
|
"\022\030.cmvr.api.ServoJ.Request\032\031.cmvr.api.Se" +
|
||||||
"ader.Feedback\022@\n\rgetJointState\022\026.cmvr.ap" +
|
"rvoJ.Response\022O\n\nstopMotion\022\037.cmvr.api.C" +
|
||||||
"i.JointRequest\032\027.cmvr.api.JointResponse\022" +
|
"ommandHeader.Request\032 .cmvr.api.CommandH" +
|
||||||
"@\n\007getPose\022\031.cmvr.api.GetPose.Request\032\032." +
|
"eader.Feedback\022@\n\rgetJointState\022\026.cmvr.a" +
|
||||||
"cmvr.api.GetPose.Response\022U\n\016calibrateZe" +
|
"pi.JointRequest\032\027.cmvr.api.JointResponse" +
|
||||||
"roQ\022 .cmvr.api.CalibrateZeroQ.Request\032!." +
|
"\022@\n\007getPose\022\031.cmvr.api.GetPose.Request\032\032" +
|
||||||
"cmvr.api.CalibrateZeroQ.Response\022R\n\rgetP" +
|
".cmvr.api.GetPose.Response\022U\n\016calibrateZ" +
|
||||||
"oseMatrix\022\037.cmvr.api.GetPoseMatrix.Reque" +
|
"eroQ\022 .cmvr.api.CalibrateZeroQ.Request\032!" +
|
||||||
"st\032 .cmvr.api.GetPoseMatrix.Response\022s\n\030" +
|
".cmvr.api.CalibrateZeroQ.Response\022R\n\rget" +
|
||||||
"computeForwardKinematics\022*.cmvr.api.Comp" +
|
"PoseMatrix\022\037.cmvr.api.GetPoseMatrix.Requ" +
|
||||||
"uteForwardKinematics.Request\032+.cmvr.api." +
|
"est\032 .cmvr.api.GetPoseMatrix.Response\022s\n" +
|
||||||
"ComputeForwardKinematics.Responseb\006proto" +
|
"\030computeForwardKinematics\022*.cmvr.api.Com" +
|
||||||
"3"
|
"puteForwardKinematics.Request\032+.cmvr.api" +
|
||||||
|
".ComputeForwardKinematics.Responseb\006prot" +
|
||||||
|
"o3"
|
||||||
};
|
};
|
||||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||||
.internalBuildGeneratedFileFrom(descriptorData,
|
.internalBuildGeneratedFileFrom(descriptorData,
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import "cmvr/api/arm_command.proto";
|
|||||||
service ArmService {
|
service ArmService {
|
||||||
rpc torqueOff(CommandHeader.Request) returns (CommandHeader.Feedback);
|
rpc torqueOff(CommandHeader.Request) returns (CommandHeader.Feedback);
|
||||||
rpc torqueOn(CommandHeader.Request) returns (CommandHeader.Feedback);
|
rpc torqueOn(CommandHeader.Request) returns (CommandHeader.Feedback);
|
||||||
|
rpc clearFault(CommandHeader.Request) returns (CommandHeader.Feedback);
|
||||||
rpc moveJ(MoveJ.Request) returns (MoveJ.Response);
|
rpc moveJ(MoveJ.Request) returns (MoveJ.Response);
|
||||||
rpc moveL(MoveL.Request) returns (MoveL.Response);
|
rpc moveL(MoveL.Request) returns (MoveL.Response);
|
||||||
rpc speedJ(SpeedJ.Request) returns (SpeedJ.Response);
|
rpc speedJ(SpeedJ.Request) returns (SpeedJ.Response);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user