feat: 机械臂moveJ调整、新增获取关节状态

This commit is contained in:
stream 2025-10-17 09:37:15 +08:00
parent 1072e3e553
commit 8286d36968
10 changed files with 14209 additions and 3036 deletions

View File

@ -6,9 +6,11 @@ import com.cmvr.edge.client.service.EdgeHumanoidRobotService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
@Api(tags = "边缘--机械臂") @Api(tags = "边缘--机械臂")
@ -24,4 +26,13 @@ public class EdgeHumanoidRobotController {
public AjaxResult expression(@RequestBody EdgeMoveJVO moveJVO) { public AjaxResult expression(@RequestBody EdgeMoveJVO moveJVO) {
return AjaxResult.ok(edgeHumanoidRobotService.moveJ(moveJVO)); return AjaxResult.ok(edgeHumanoidRobotService.moveJ(moveJVO));
} }
@ApiOperation("获取关节状态")
@GetMapping("/getJointState")
public AjaxResult status(
@RequestParam("deviceId") String deviceId,
@RequestParam("terminalId") String terminalId
) {
return AjaxResult.ok(edgeHumanoidRobotService.getJointState(terminalId, deviceId));
}
} }

View File

@ -11,4 +11,9 @@ public interface EdgeHumanoidRobotService {
*/ */
public String moveJ(EdgeMoveJVO vo); public String moveJ(EdgeMoveJVO vo);
/**
* 获取关节状态
*/
public String getJointState(String terminalId, String deviceId);
} }

View File

@ -1,7 +1,7 @@
package com.cmvr.edge.client.service.impl; package com.cmvr.edge.client.service.impl;
import cmvr.api.Common; import cmvr.api.Common;
import cmvr.api.HumanoidRobot; import cmvr.api.HumanoidRobotCommand;
import cmvr.api.HumanoidRobotServiceGrpc; import cmvr.api.HumanoidRobotServiceGrpc;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.cmvr.edge.client.manage.GrpcServiceManager; import com.cmvr.edge.client.manage.GrpcServiceManager;
@ -27,14 +27,14 @@ public class EdgeHumanoidRobotServiceImpl implements EdgeHumanoidRobotService {
Common.CommandHeader.Request header = EdgeCommonUtil.buildRequest(vo.getDeviceId()); Common.CommandHeader.Request header = EdgeCommonUtil.buildRequest(vo.getDeviceId());
HumanoidRobot.MoveJ.Request.Builder builder = HumanoidRobot.MoveJ.Request.newBuilder() HumanoidRobotCommand.MoveJ.Request.Builder builder = HumanoidRobotCommand.MoveJ.Request.newBuilder()
.setHeader(header) .setHeader(header)
.setVel(vo.getVel()) .setVel(vo.getVel())
.setAcc(vo.getAcc()); .setAcc(vo.getAcc());
if (vo.getCmds() != null) { if (vo.getCmds() != null) {
for (EdgeMoveJVO.JointCmd j : vo.getCmds()) { for (EdgeMoveJVO.JointCmd j : vo.getCmds()) {
builder.addCmds(HumanoidRobot.JointCmd.newBuilder() builder.addCmds(HumanoidRobotCommand.JointCmd.newBuilder()
.setJointName(j.getJointName()) .setJointName(j.getJointName())
.setRad(j.getRad()) .setRad(j.getRad())
.setVel(j.getVel()) .setVel(j.getVel())
@ -42,7 +42,20 @@ public class EdgeHumanoidRobotServiceImpl implements EdgeHumanoidRobotService {
} }
} }
HumanoidRobot.MoveJ.Response response = stub.moveJ(builder.build()); HumanoidRobotCommand.MoveJ.Response response = stub.moveJ(builder.build());
return JSON.toJSONString(response.getHeader()); return JSON.toJSONString(response.getHeader());
} }
@Override
public String getJointState(String terminalId, String deviceId) {
HumanoidRobotServiceGrpc.HumanoidRobotServiceBlockingStub stub =
grpcServiceManager.getGrpcClient(terminalId, HumanoidRobotServiceGrpc.HumanoidRobotServiceBlockingStub.class);
Common.CommandHeader.Request header = EdgeCommonUtil.buildRequest(deviceId);
HumanoidRobotCommand.JointRequest build = HumanoidRobotCommand.JointRequest.newBuilder()
.setHeader(header)
.build();
HumanoidRobotCommand.JointResponse response = stub.getJointState(build);
return JSON.toJSONString(response.getStateList());
}
} }

View File

@ -6,7 +6,7 @@ import static io.grpc.MethodDescriptor.generateFullMethodName;
*/ */
@javax.annotation.Generated( @javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.52.0)", value = "by gRPC proto compiler (version 1.52.0)",
comments = "Source: cmvr/api/humanoid_robot.proto") comments = "Source: cmvr/api/humanoid_robot_service.proto")
@io.grpc.stub.annotations.GrpcGenerated @io.grpc.stub.annotations.GrpcGenerated
public final class HumanoidRobotServiceGrpc { public final class HumanoidRobotServiceGrpc {
@ -77,29 +77,29 @@ public final class HumanoidRobotServiceGrpc {
return getTorqueOnMethod; return getTorqueOnMethod;
} }
private static volatile io.grpc.MethodDescriptor<cmvr.api.HumanoidRobot.MoveJ.Request, private static volatile io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.MoveJ.Request,
cmvr.api.HumanoidRobot.MoveJ.Response> getMoveJMethod; cmvr.api.HumanoidRobotCommand.MoveJ.Response> getMoveJMethod;
@io.grpc.stub.annotations.RpcMethod( @io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "moveJ", fullMethodName = SERVICE_NAME + '/' + "moveJ",
requestType = cmvr.api.HumanoidRobot.MoveJ.Request.class, requestType = cmvr.api.HumanoidRobotCommand.MoveJ.Request.class,
responseType = cmvr.api.HumanoidRobot.MoveJ.Response.class, responseType = cmvr.api.HumanoidRobotCommand.MoveJ.Response.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY) methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<cmvr.api.HumanoidRobot.MoveJ.Request, public static io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.MoveJ.Request,
cmvr.api.HumanoidRobot.MoveJ.Response> getMoveJMethod() { cmvr.api.HumanoidRobotCommand.MoveJ.Response> getMoveJMethod() {
io.grpc.MethodDescriptor<cmvr.api.HumanoidRobot.MoveJ.Request, cmvr.api.HumanoidRobot.MoveJ.Response> getMoveJMethod; io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.MoveJ.Request, cmvr.api.HumanoidRobotCommand.MoveJ.Response> getMoveJMethod;
if ((getMoveJMethod = HumanoidRobotServiceGrpc.getMoveJMethod) == null) { if ((getMoveJMethod = HumanoidRobotServiceGrpc.getMoveJMethod) == null) {
synchronized (HumanoidRobotServiceGrpc.class) { synchronized (HumanoidRobotServiceGrpc.class) {
if ((getMoveJMethod = HumanoidRobotServiceGrpc.getMoveJMethod) == null) { if ((getMoveJMethod = HumanoidRobotServiceGrpc.getMoveJMethod) == null) {
HumanoidRobotServiceGrpc.getMoveJMethod = getMoveJMethod = HumanoidRobotServiceGrpc.getMoveJMethod = getMoveJMethod =
io.grpc.MethodDescriptor.<cmvr.api.HumanoidRobot.MoveJ.Request, cmvr.api.HumanoidRobot.MoveJ.Response>newBuilder() io.grpc.MethodDescriptor.<cmvr.api.HumanoidRobotCommand.MoveJ.Request, cmvr.api.HumanoidRobotCommand.MoveJ.Response>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY) .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "moveJ")) .setFullMethodName(generateFullMethodName(SERVICE_NAME, "moveJ"))
.setSampledToLocalTracing(true) .setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
cmvr.api.HumanoidRobot.MoveJ.Request.getDefaultInstance())) cmvr.api.HumanoidRobotCommand.MoveJ.Request.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller( .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
cmvr.api.HumanoidRobot.MoveJ.Response.getDefaultInstance())) cmvr.api.HumanoidRobotCommand.MoveJ.Response.getDefaultInstance()))
.setSchemaDescriptor(new HumanoidRobotServiceMethodDescriptorSupplier("moveJ")) .setSchemaDescriptor(new HumanoidRobotServiceMethodDescriptorSupplier("moveJ"))
.build(); .build();
} }
@ -108,6 +108,130 @@ public final class HumanoidRobotServiceGrpc {
return getMoveJMethod; return getMoveJMethod;
} }
private static volatile io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.MoveL.Request,
cmvr.api.HumanoidRobotCommand.MoveL.Response> getMoveLMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "moveL",
requestType = cmvr.api.HumanoidRobotCommand.MoveL.Request.class,
responseType = cmvr.api.HumanoidRobotCommand.MoveL.Response.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.MoveL.Request,
cmvr.api.HumanoidRobotCommand.MoveL.Response> getMoveLMethod() {
io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.MoveL.Request, cmvr.api.HumanoidRobotCommand.MoveL.Response> getMoveLMethod;
if ((getMoveLMethod = HumanoidRobotServiceGrpc.getMoveLMethod) == null) {
synchronized (HumanoidRobotServiceGrpc.class) {
if ((getMoveLMethod = HumanoidRobotServiceGrpc.getMoveLMethod) == null) {
HumanoidRobotServiceGrpc.getMoveLMethod = getMoveLMethod =
io.grpc.MethodDescriptor.<cmvr.api.HumanoidRobotCommand.MoveL.Request, cmvr.api.HumanoidRobotCommand.MoveL.Response>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "moveL"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
cmvr.api.HumanoidRobotCommand.MoveL.Request.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
cmvr.api.HumanoidRobotCommand.MoveL.Response.getDefaultInstance()))
.setSchemaDescriptor(new HumanoidRobotServiceMethodDescriptorSupplier("moveL"))
.build();
}
}
}
return getMoveLMethod;
}
private static volatile io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.SpeedJ.Request,
cmvr.api.HumanoidRobotCommand.SpeedJ.Response> getSpeedJMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "speedJ",
requestType = cmvr.api.HumanoidRobotCommand.SpeedJ.Request.class,
responseType = cmvr.api.HumanoidRobotCommand.SpeedJ.Response.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.SpeedJ.Request,
cmvr.api.HumanoidRobotCommand.SpeedJ.Response> getSpeedJMethod() {
io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.SpeedJ.Request, cmvr.api.HumanoidRobotCommand.SpeedJ.Response> getSpeedJMethod;
if ((getSpeedJMethod = HumanoidRobotServiceGrpc.getSpeedJMethod) == null) {
synchronized (HumanoidRobotServiceGrpc.class) {
if ((getSpeedJMethod = HumanoidRobotServiceGrpc.getSpeedJMethod) == null) {
HumanoidRobotServiceGrpc.getSpeedJMethod = getSpeedJMethod =
io.grpc.MethodDescriptor.<cmvr.api.HumanoidRobotCommand.SpeedJ.Request, cmvr.api.HumanoidRobotCommand.SpeedJ.Response>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "speedJ"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
cmvr.api.HumanoidRobotCommand.SpeedJ.Request.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
cmvr.api.HumanoidRobotCommand.SpeedJ.Response.getDefaultInstance()))
.setSchemaDescriptor(new HumanoidRobotServiceMethodDescriptorSupplier("speedJ"))
.build();
}
}
}
return getSpeedJMethod;
}
private static volatile io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.SpeedL.Request,
cmvr.api.HumanoidRobotCommand.SpeedL.Response> getSpeedLMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "speedL",
requestType = cmvr.api.HumanoidRobotCommand.SpeedL.Request.class,
responseType = cmvr.api.HumanoidRobotCommand.SpeedL.Response.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.SpeedL.Request,
cmvr.api.HumanoidRobotCommand.SpeedL.Response> getSpeedLMethod() {
io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.SpeedL.Request, cmvr.api.HumanoidRobotCommand.SpeedL.Response> getSpeedLMethod;
if ((getSpeedLMethod = HumanoidRobotServiceGrpc.getSpeedLMethod) == null) {
synchronized (HumanoidRobotServiceGrpc.class) {
if ((getSpeedLMethod = HumanoidRobotServiceGrpc.getSpeedLMethod) == null) {
HumanoidRobotServiceGrpc.getSpeedLMethod = getSpeedLMethod =
io.grpc.MethodDescriptor.<cmvr.api.HumanoidRobotCommand.SpeedL.Request, cmvr.api.HumanoidRobotCommand.SpeedL.Response>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "speedL"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
cmvr.api.HumanoidRobotCommand.SpeedL.Request.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
cmvr.api.HumanoidRobotCommand.SpeedL.Response.getDefaultInstance()))
.setSchemaDescriptor(new HumanoidRobotServiceMethodDescriptorSupplier("speedL"))
.build();
}
}
}
return getSpeedLMethod;
}
private static volatile io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.JointRequest,
cmvr.api.HumanoidRobotCommand.JointResponse> getGetJointStateMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "getJointState",
requestType = cmvr.api.HumanoidRobotCommand.JointRequest.class,
responseType = cmvr.api.HumanoidRobotCommand.JointResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.JointRequest,
cmvr.api.HumanoidRobotCommand.JointResponse> getGetJointStateMethod() {
io.grpc.MethodDescriptor<cmvr.api.HumanoidRobotCommand.JointRequest, cmvr.api.HumanoidRobotCommand.JointResponse> getGetJointStateMethod;
if ((getGetJointStateMethod = HumanoidRobotServiceGrpc.getGetJointStateMethod) == null) {
synchronized (HumanoidRobotServiceGrpc.class) {
if ((getGetJointStateMethod = HumanoidRobotServiceGrpc.getGetJointStateMethod) == null) {
HumanoidRobotServiceGrpc.getGetJointStateMethod = getGetJointStateMethod =
io.grpc.MethodDescriptor.<cmvr.api.HumanoidRobotCommand.JointRequest, cmvr.api.HumanoidRobotCommand.JointResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "getJointState"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
cmvr.api.HumanoidRobotCommand.JointRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
cmvr.api.HumanoidRobotCommand.JointResponse.getDefaultInstance()))
.setSchemaDescriptor(new HumanoidRobotServiceMethodDescriptorSupplier("getJointState"))
.build();
}
}
}
return getGetJointStateMethod;
}
/** /**
* Creates a new async stub that supports all call types for the service * Creates a new async stub that supports all call types for the service
*/ */
@ -172,11 +296,39 @@ public final class HumanoidRobotServiceGrpc {
/** /**
*/ */
public void moveJ(cmvr.api.HumanoidRobot.MoveJ.Request request, public void moveJ(cmvr.api.HumanoidRobotCommand.MoveJ.Request request,
io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobot.MoveJ.Response> responseObserver) { io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.MoveJ.Response> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getMoveJMethod(), responseObserver); io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getMoveJMethod(), responseObserver);
} }
/**
*/
public void moveL(cmvr.api.HumanoidRobotCommand.MoveL.Request request,
io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.MoveL.Response> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getMoveLMethod(), responseObserver);
}
/**
*/
public void speedJ(cmvr.api.HumanoidRobotCommand.SpeedJ.Request request,
io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.SpeedJ.Response> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSpeedJMethod(), responseObserver);
}
/**
*/
public void speedL(cmvr.api.HumanoidRobotCommand.SpeedL.Request request,
io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.SpeedL.Response> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSpeedLMethod(), responseObserver);
}
/**
*/
public void getJointState(cmvr.api.HumanoidRobotCommand.JointRequest request,
io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.JointResponse> responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetJointStateMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() { @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor()) return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod( .addMethod(
@ -197,9 +349,37 @@ public final class HumanoidRobotServiceGrpc {
getMoveJMethod(), getMoveJMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall( io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers< new MethodHandlers<
cmvr.api.HumanoidRobot.MoveJ.Request, cmvr.api.HumanoidRobotCommand.MoveJ.Request,
cmvr.api.HumanoidRobot.MoveJ.Response>( cmvr.api.HumanoidRobotCommand.MoveJ.Response>(
this, METHODID_MOVE_J))) this, METHODID_MOVE_J)))
.addMethod(
getMoveLMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
cmvr.api.HumanoidRobotCommand.MoveL.Request,
cmvr.api.HumanoidRobotCommand.MoveL.Response>(
this, METHODID_MOVE_L)))
.addMethod(
getSpeedJMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
cmvr.api.HumanoidRobotCommand.SpeedJ.Request,
cmvr.api.HumanoidRobotCommand.SpeedJ.Response>(
this, METHODID_SPEED_J)))
.addMethod(
getSpeedLMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
cmvr.api.HumanoidRobotCommand.SpeedL.Request,
cmvr.api.HumanoidRobotCommand.SpeedL.Response>(
this, METHODID_SPEED_L)))
.addMethod(
getGetJointStateMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
cmvr.api.HumanoidRobotCommand.JointRequest,
cmvr.api.HumanoidRobotCommand.JointResponse>(
this, METHODID_GET_JOINT_STATE)))
.build(); .build();
} }
} }
@ -236,11 +416,43 @@ public final class HumanoidRobotServiceGrpc {
/** /**
*/ */
public void moveJ(cmvr.api.HumanoidRobot.MoveJ.Request request, public void moveJ(cmvr.api.HumanoidRobotCommand.MoveJ.Request request,
io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobot.MoveJ.Response> responseObserver) { io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.MoveJ.Response> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall( io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getMoveJMethod(), getCallOptions()), request, responseObserver); getChannel().newCall(getMoveJMethod(), getCallOptions()), request, responseObserver);
} }
/**
*/
public void moveL(cmvr.api.HumanoidRobotCommand.MoveL.Request request,
io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.MoveL.Response> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getMoveLMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void speedJ(cmvr.api.HumanoidRobotCommand.SpeedJ.Request request,
io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.SpeedJ.Response> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getSpeedJMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void speedL(cmvr.api.HumanoidRobotCommand.SpeedL.Request request,
io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.SpeedL.Response> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getSpeedLMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void getJointState(cmvr.api.HumanoidRobotCommand.JointRequest request,
io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.JointResponse> responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getGetJointStateMethod(), getCallOptions()), request, responseObserver);
}
} }
/** /**
@ -273,10 +485,38 @@ public final class HumanoidRobotServiceGrpc {
/** /**
*/ */
public cmvr.api.HumanoidRobot.MoveJ.Response moveJ(cmvr.api.HumanoidRobot.MoveJ.Request request) { public cmvr.api.HumanoidRobotCommand.MoveJ.Response moveJ(cmvr.api.HumanoidRobotCommand.MoveJ.Request request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall( return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getMoveJMethod(), getCallOptions(), request); getChannel(), getMoveJMethod(), getCallOptions(), request);
} }
/**
*/
public cmvr.api.HumanoidRobotCommand.MoveL.Response moveL(cmvr.api.HumanoidRobotCommand.MoveL.Request request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getMoveLMethod(), getCallOptions(), request);
}
/**
*/
public cmvr.api.HumanoidRobotCommand.SpeedJ.Response speedJ(cmvr.api.HumanoidRobotCommand.SpeedJ.Request request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getSpeedJMethod(), getCallOptions(), request);
}
/**
*/
public cmvr.api.HumanoidRobotCommand.SpeedL.Response speedL(cmvr.api.HumanoidRobotCommand.SpeedL.Request request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getSpeedLMethod(), getCallOptions(), request);
}
/**
*/
public cmvr.api.HumanoidRobotCommand.JointResponse getJointState(cmvr.api.HumanoidRobotCommand.JointRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getGetJointStateMethod(), getCallOptions(), request);
}
} }
/** /**
@ -311,16 +551,52 @@ public final class HumanoidRobotServiceGrpc {
/** /**
*/ */
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.HumanoidRobot.MoveJ.Response> moveJ( public com.google.common.util.concurrent.ListenableFuture<cmvr.api.HumanoidRobotCommand.MoveJ.Response> moveJ(
cmvr.api.HumanoidRobot.MoveJ.Request request) { cmvr.api.HumanoidRobotCommand.MoveJ.Request request) {
return io.grpc.stub.ClientCalls.futureUnaryCall( return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getMoveJMethod(), getCallOptions()), request); getChannel().newCall(getMoveJMethod(), getCallOptions()), request);
} }
/**
*/
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.HumanoidRobotCommand.MoveL.Response> moveL(
cmvr.api.HumanoidRobotCommand.MoveL.Request request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getMoveLMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.HumanoidRobotCommand.SpeedJ.Response> speedJ(
cmvr.api.HumanoidRobotCommand.SpeedJ.Request request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getSpeedJMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.HumanoidRobotCommand.SpeedL.Response> speedL(
cmvr.api.HumanoidRobotCommand.SpeedL.Request request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getSpeedLMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.HumanoidRobotCommand.JointResponse> getJointState(
cmvr.api.HumanoidRobotCommand.JointRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getGetJointStateMethod(), getCallOptions()), request);
}
} }
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_MOVE_J = 2;
private static final int METHODID_MOVE_L = 3;
private static final int METHODID_SPEED_J = 4;
private static final int METHODID_SPEED_L = 5;
private static final int METHODID_GET_JOINT_STATE = 6;
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>,
@ -348,8 +624,24 @@ public final class HumanoidRobotServiceGrpc {
(io.grpc.stub.StreamObserver<cmvr.api.Common.CommandHeader.Feedback>) responseObserver); (io.grpc.stub.StreamObserver<cmvr.api.Common.CommandHeader.Feedback>) responseObserver);
break; break;
case METHODID_MOVE_J: case METHODID_MOVE_J:
serviceImpl.moveJ((cmvr.api.HumanoidRobot.MoveJ.Request) request, serviceImpl.moveJ((cmvr.api.HumanoidRobotCommand.MoveJ.Request) request,
(io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobot.MoveJ.Response>) responseObserver); (io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.MoveJ.Response>) responseObserver);
break;
case METHODID_MOVE_L:
serviceImpl.moveL((cmvr.api.HumanoidRobotCommand.MoveL.Request) request,
(io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.MoveL.Response>) responseObserver);
break;
case METHODID_SPEED_J:
serviceImpl.speedJ((cmvr.api.HumanoidRobotCommand.SpeedJ.Request) request,
(io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.SpeedJ.Response>) responseObserver);
break;
case METHODID_SPEED_L:
serviceImpl.speedL((cmvr.api.HumanoidRobotCommand.SpeedL.Request) request,
(io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.SpeedL.Response>) responseObserver);
break;
case METHODID_GET_JOINT_STATE:
serviceImpl.getJointState((cmvr.api.HumanoidRobotCommand.JointRequest) request,
(io.grpc.stub.StreamObserver<cmvr.api.HumanoidRobotCommand.JointResponse>) responseObserver);
break; break;
default: default:
throw new AssertionError(); throw new AssertionError();
@ -373,7 +665,7 @@ public final class HumanoidRobotServiceGrpc {
@java.lang.Override @java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() { public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return cmvr.api.HumanoidRobot.getDescriptor(); return cmvr.api.HumanoidRobotServiceOuterClass.getDescriptor();
} }
@java.lang.Override @java.lang.Override
@ -415,6 +707,10 @@ public final class HumanoidRobotServiceGrpc {
.addMethod(getTorqueOffMethod()) .addMethod(getTorqueOffMethod())
.addMethod(getTorqueOnMethod()) .addMethod(getTorqueOnMethod())
.addMethod(getMoveJMethod()) .addMethod(getMoveJMethod())
.addMethod(getMoveLMethod())
.addMethod(getSpeedJMethod())
.addMethod(getSpeedLMethod())
.addMethod(getGetJointStateMethod())
.build(); .build();
} }
} }

View File

@ -0,0 +1,54 @@
// Generated by the protocol buffer compiler. DO NOT EDIT!
// source: cmvr/api/humanoid_robot_service.proto
package cmvr.api;
public final class HumanoidRobotServiceOuterClass {
private HumanoidRobotServiceOuterClass() {}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistryLite registry) {
}
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
registerAllExtensions(
(com.google.protobuf.ExtensionRegistryLite) registry);
}
public static com.google.protobuf.Descriptors.FileDescriptor
getDescriptor() {
return descriptor;
}
private static com.google.protobuf.Descriptors.FileDescriptor
descriptor;
static {
java.lang.String[] descriptorData = {
"\n%cmvr/api/humanoid_robot_service.proto\022" +
"\010cmvr.api\032\025cmvr/api/common.proto\032%cmvr/a" +
"pi/humanoid_robot_command.proto2\355\003\n\024Huma" +
"noidRobotService\022N\n\ttorqueOff\022\037.cmvr.api" +
".CommandHeader.Request\032 .cmvr.api.Comman" +
"dHeader.Feedback\022M\n\010torqueOn\022\037.cmvr.api." +
"CommandHeader.Request\032 .cmvr.api.Command" +
"Header.Feedback\022:\n\005moveJ\022\027.cmvr.api.Move" +
"J.Request\032\030.cmvr.api.MoveJ.Response\022:\n\005m" +
"oveL\022\027.cmvr.api.MoveL.Request\032\030.cmvr.api" +
".MoveL.Response\022=\n\006speedJ\022\030.cmvr.api.Spe" +
"edJ.Request\032\031.cmvr.api.SpeedJ.Response\022=" +
"\n\006speedL\022\030.cmvr.api.SpeedL.Request\032\031.cmv" +
"r.api.SpeedL.Response\022@\n\rgetJointState\022\026" +
".cmvr.api.JointRequest\032\027.cmvr.api.JointR" +
"esponseb\006proto3"
};
descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
cmvr.api.Common.getDescriptor(),
cmvr.api.HumanoidRobotCommand.getDescriptor(),
});
cmvr.api.Common.getDescriptor();
cmvr.api.HumanoidRobotCommand.getDescriptor();
}
// @@protoc_insertion_point(outer_class_scope)
}

View File

@ -1,32 +0,0 @@
syntax = "proto3";
package cmvr.api;
import "cmvr/api/common.proto";
message JointCmd {
string joint_name = 1; //
double rad = 2; //
double vel = 3; // rad/s
}
message MoveJ{
message Request{
CommandHeader.Request header = 1;
repeated JointCmd cmds = 2;
double vel = 3;
double acc = 4;
}
message Response{
CommandHeader.Feedback header= 1;
}
}
service HumanoidRobotService{
rpc torqueOff(CommandHeader.Request) returns (CommandHeader.Feedback);
rpc torqueOn(CommandHeader.Request) returns (CommandHeader.Feedback);
rpc moveJ(MoveJ.Request) returns (MoveJ.Response);
}

View File

@ -0,0 +1,122 @@
syntax = "proto3";
package cmvr.api;
import "cmvr/api/common.proto";
message JointCmd {
string joint_name = 1; //
double rad = 2; //
double vel = 3; // rad/s
}
message Pose3D{
double x = 1;
double y = 2;
double z = 3;
double rx = 4;
double ry = 5;
double rz = 6;
}
enum RobotCartesian{
X = 0;
Y = 1;
Z = 2;
RX = 3;
RY = 4;
RZ = 5;
} ;
enum RobotJointIndexDirection{
FORWARD = 0;
BACKWARD = 1;
X_POSITIVE = 2; // X轴正向
X_NEGATIVE = 3; // X轴负向
Y_POSITIVE = 4; // Y轴正向
Y_NEGATIVE = 5; // Y轴负向
Z_POSITIVE = 6; // Z轴正向
Z_NEGATIVE = 7; // Z轴负向
ROTATE_X = 8; // X轴旋转
ROTATE_Y = 9; // Y轴旋转
ROTATE_Z = 10; // Z轴旋转
}
message MoveJ{
message Request{
CommandHeader.Request header = 1;
repeated JointCmd cmds = 2;
double vel = 3;
double acc = 4;
}
message Response{
CommandHeader.Feedback header= 1;
}
}
message MoveL{
message Request{
CommandHeader.Request header = 1;
string ee_link = 2; //
Pose3D targetPose = 3;
double vel = 4;
double acc = 5;
}
message Response{
CommandHeader.Feedback header= 1;
}
}
message SpeedJ{
message Request{
CommandHeader.Request header = 1;
string joint_name = 2;
double vel = 3;
double acc = 4;
RobotJointIndexDirection dir = 5;
}
message Response{
CommandHeader.Feedback header= 1;
}
}
message SpeedL{
message Request{
CommandHeader.Request header = 1;
string ee_link = 2;
double vel = 3;
double acc = 4;
RobotJointIndexDirection dir = 5;
RobotCartesian cart = 6;
}
message Response{
CommandHeader.Feedback header= 1;
}
}
//
message JointState {
repeated string name = 1; //
repeated double position = 2; //
repeated double velocity = 3; //
repeated double effort = 4; //
double timestamp = 5; //
}
//
message JointResponse {
CommandHeader.Feedback header= 1;
repeated JointState state = 2;
}
//
message JointRequest {
CommandHeader.Request header = 1;
}

View File

@ -0,0 +1,16 @@
syntax = "proto3";
package cmvr.api;
import "cmvr/api/common.proto";
import "cmvr/api/humanoid_robot_command.proto";
service HumanoidRobotService{
rpc torqueOff(CommandHeader.Request) returns (CommandHeader.Feedback);
rpc torqueOn(CommandHeader.Request) returns (CommandHeader.Feedback);
rpc moveJ(MoveJ.Request) returns (MoveJ.Response);
rpc moveL(MoveL.Request) returns (MoveL.Response);
rpc speedJ(SpeedJ.Request) returns (SpeedJ.Response);
rpc speedL(SpeedL.Request) returns (SpeedL.Response);
rpc getJointState(JointRequest) returns (JointResponse);
}