feat(inspection): 增加AGV机器人地图管理和状态同步功能
- 在GrpcServiceManager中注册AGV服务stub - 为巡检地图服务增加按机器人ID查询地图列表功能 - 为巡检机器人服务增加地图列表获取、绑定、上传下载及状态同步功能 - 在数据库表中增加机器人终端ID字段并更新相关映射 - 生成AGV相关的gRPC协议文件和服务类 - 实现机器人与终端配置的自动关联管理 - 添加机器人的实时状态同步包括电量、位置等信息
This commit is contained in:
parent
be8b306eef
commit
9125dbc2b9
@ -3,19 +3,13 @@ package com.cmvr.web.controller.inspection;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import cmvr.api.AgvCommand;
|
||||
import com.cmvr.inspection.domain.vo.InspectionRobotVo;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.cmvr.common.annotation.Log;
|
||||
import com.cmvr.common.core.controller.BaseController;
|
||||
import com.cmvr.common.core.domain.AjaxResult;
|
||||
@ -107,9 +101,78 @@ public class InspectionRobotController extends BaseController
|
||||
@ApiOperation("删除巡检机器人")
|
||||
@PreAuthorize("@ss.hasPermi('inspection:robot:remove')")
|
||||
@Log(title = "巡检机器人", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable String[] ids)
|
||||
{
|
||||
return toAjax(inspectionRobotService.deleteInspectionRobotByIds(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机器人地图列表(从AGV获取)
|
||||
*/
|
||||
@ApiOperation("获取机器人地图列表")
|
||||
@PreAuthorize("@ss.hasPermi('inspection:robot:query')")
|
||||
@GetMapping("/{robotId}/maps")
|
||||
public AjaxResult getRobotMapList(@PathVariable("robotId") String robotId)
|
||||
{
|
||||
AgvCommand.AgvMapStatus robotMapList = inspectionRobotService.getRobotMapList(robotId);
|
||||
return success(robotMapList.getMapsList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定机器人地图
|
||||
*/
|
||||
@ApiOperation("绑定机器人地图")
|
||||
@PreAuthorize("@ss.hasPermi('inspection:robot:edit')")
|
||||
@Log(title = "绑定机器人地图", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/{robotId}/bind-map/{mapId}")
|
||||
public AjaxResult bindRobotMap(@PathVariable("robotId") String robotId,
|
||||
@PathVariable("mapId") String mapId)
|
||||
{
|
||||
return toAjax(inspectionRobotService.bindRobotMap(robotId, mapId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传地图到机器人
|
||||
*/
|
||||
@ApiOperation("上传地图到机器人")
|
||||
@PreAuthorize("@ss.hasPermi('inspection:robot:edit')")
|
||||
@Log(title = "上传地图到机器人", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/{robotId}/upload-map/{mapId}")
|
||||
public AjaxResult uploadMapToRobot(@PathVariable("robotId") String robotId,
|
||||
@PathVariable("mapId") String mapId)
|
||||
{
|
||||
String result = inspectionRobotService.uploadMapToRobot(robotId, mapId);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从机器人下载地图
|
||||
*/
|
||||
@ApiOperation("从机器人下载地图")
|
||||
@PreAuthorize("@ss.hasPermi('inspection:robot:add')")
|
||||
@Log(title = "从机器人下载地图", businessType = BusinessType.INSERT)
|
||||
@GetMapping("/{robotId}/download-map")
|
||||
public AjaxResult downloadMapFromRobot(
|
||||
@PathVariable(value = "robotId", required = true) @ApiParam("机器人ID") String robotId,
|
||||
@RequestParam(value = "mapName", required = true) @ApiParam("地图名称") String mapName
|
||||
)
|
||||
{
|
||||
Object mapId = inspectionRobotService.downloadMapFromRobot(robotId, mapName);
|
||||
return success(mapId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步机器人状态
|
||||
*/
|
||||
@ApiOperation("同步机器人状态")
|
||||
@PreAuthorize("@ss.hasPermi('inspection:robot:edit')")
|
||||
@Log(title = "同步机器人状态", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/{robotId}/sync-status")
|
||||
public AjaxResult syncRobotStatus(@PathVariable("robotId") String robotId)
|
||||
{
|
||||
return success(inspectionRobotService.syncRobotStatus(robotId));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -57,6 +57,8 @@ public class GrpcServiceManager {
|
||||
// 注册机械臂服务的stub
|
||||
clientFactories.put(HumanoidRobotServiceGrpc.HumanoidRobotServiceBlockingStub.class, new GrpcClientFactory<>(HumanoidRobotServiceGrpc::newBlockingStub));
|
||||
clientFactories.put(HlcServiceGrpc.HlcServiceBlockingStub.class, new GrpcClientFactory<>(HlcServiceGrpc::newBlockingStub));
|
||||
// 注册agv服务的stub
|
||||
clientFactories.put(AgvServiceGrpc.AgvServiceBlockingStub.class, new GrpcClientFactory<>(AgvServiceGrpc::newBlockingStub));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,56 @@
|
||||
package com.cmvr.edge.client.service;
|
||||
|
||||
import cmvr.api.AgvCommand;
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
|
||||
/**
|
||||
* 边缘系统AGV服务
|
||||
*
|
||||
* @author cmvr-iot
|
||||
* @since 2026-06-11
|
||||
*/
|
||||
public interface EdgeAgvService {
|
||||
|
||||
/**
|
||||
* 获取AGV状态信息
|
||||
*
|
||||
* @param edgeCommonVO 边缘通用参数
|
||||
* @return AGV状态信息
|
||||
*/
|
||||
AgvCommand.AgvStatusInfo getStatusInfo(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
|
||||
/**
|
||||
* 获取机器人位置
|
||||
*
|
||||
* @param edgeCommonVO 边缘通用参数
|
||||
* @return 机器人位置
|
||||
*/
|
||||
AgvCommand.AgvRobotLocation getRobotLocation(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
/**
|
||||
* 获取地图状态(地图列表)
|
||||
*
|
||||
* @param edgeCommonVO 边缘通用参数
|
||||
* @return 地图状态
|
||||
*/
|
||||
AgvCommand.AgvMapStatus getMapStatus(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
/**
|
||||
* 下载地图(从机器人下载地图到服务器)
|
||||
*
|
||||
* @param edgeCommonVO 边缘通用参数
|
||||
* @param mapName 地图名称
|
||||
* @return 下载结果(包含地图内容)
|
||||
*/
|
||||
AgvCommand.AgvDownloadMapResult robotConfigDownloadMap(EdgeCommonVO edgeCommonVO, String mapName);
|
||||
|
||||
|
||||
/**
|
||||
* 获取电池状态
|
||||
*
|
||||
* @param edgeCommonVO 边缘通用参数
|
||||
* @return 电池状态
|
||||
*/
|
||||
AgvCommand.AgvBatteryStatus getBatteryStatus(EdgeCommonVO edgeCommonVO);
|
||||
}
|
||||
@ -0,0 +1,110 @@
|
||||
package com.cmvr.edge.client.service.impl;
|
||||
|
||||
import cmvr.api.AgvCommand;
|
||||
import cmvr.api.AgvServiceGrpc;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
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.service.EdgeAgvService;
|
||||
import com.cmvr.edge.client.utils.EdgeCommonUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* AGV服务实现类
|
||||
*
|
||||
* @author cmvr-iot
|
||||
* @since 2026-06-11
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EdgeAgvServiceImpl implements EdgeAgvService {
|
||||
|
||||
private final GrpcServiceManager grpcServiceManager;
|
||||
|
||||
@Override
|
||||
public AgvCommand.AgvStatusInfo getStatusInfo(EdgeCommonVO edgeCommonVO) {
|
||||
AgvServiceGrpc.AgvServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
edgeCommonVO.getTerminalId(), AgvServiceGrpc.AgvServiceBlockingStub.class);
|
||||
AgvCommand.GetAgvStatusInfoCommand.Request request = AgvCommand.GetAgvStatusInfoCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(edgeCommonVO.getDeviceId()))
|
||||
.build();
|
||||
return executeGrpcCall(() -> stub.getStatusInfo(request)).getStatus();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AgvCommand.AgvRobotLocation getRobotLocation(EdgeCommonVO edgeCommonVO) {
|
||||
AgvServiceGrpc.AgvServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
edgeCommonVO.getTerminalId(), AgvServiceGrpc.AgvServiceBlockingStub.class);
|
||||
AgvCommand.RobotStatusLocCommand.Request request = AgvCommand.RobotStatusLocCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(edgeCommonVO.getDeviceId()))
|
||||
.build();
|
||||
return executeGrpcCall(() -> stub.getRobotLocation(request)).getStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvCommand.AgvMapStatus getMapStatus(EdgeCommonVO edgeCommonVO) {
|
||||
AgvServiceGrpc.AgvServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
edgeCommonVO.getTerminalId(), AgvServiceGrpc.AgvServiceBlockingStub.class);
|
||||
AgvCommand.RobotStatusMapCommand.Request request = AgvCommand.RobotStatusMapCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(edgeCommonVO.getDeviceId()))
|
||||
.build();
|
||||
return executeGrpcCall(() -> stub.getMapStatus(request)).getStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvCommand.AgvDownloadMapResult robotConfigDownloadMap(EdgeCommonVO edgeCommonVO, String mapName) {
|
||||
if (StrUtil.isBlank(mapName)) {
|
||||
throw new GlobalException("地图名称不能为空");
|
||||
}
|
||||
AgvServiceGrpc.AgvServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
edgeCommonVO.getTerminalId(), AgvServiceGrpc.AgvServiceBlockingStub.class);
|
||||
AgvCommand.RobotConfigDownloadMapRequestData requestData = AgvCommand.RobotConfigDownloadMapRequestData.newBuilder()
|
||||
.setMapName(mapName)
|
||||
.build();
|
||||
AgvCommand.RobotConfigDownloadMapCommand.Request request = AgvCommand.RobotConfigDownloadMapCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(edgeCommonVO.getDeviceId()))
|
||||
.setData(requestData)
|
||||
.build();
|
||||
AgvCommand.AgvDownloadMapResult result = executeGrpcCall(() -> stub.robotConfigDownloadMap(request)).getStatus();
|
||||
|
||||
if (result.getRetCode() != 0) {
|
||||
throw new GlobalException("下载地图失败: " + result.getErrMsg());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AgvCommand.AgvBatteryStatus getBatteryStatus(EdgeCommonVO edgeCommonVO) {
|
||||
AgvServiceGrpc.AgvServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
edgeCommonVO.getTerminalId(), AgvServiceGrpc.AgvServiceBlockingStub.class);
|
||||
AgvCommand.RobotStatusBatteryRequestData requestData = AgvCommand.RobotStatusBatteryRequestData.newBuilder()
|
||||
.setSimple(true)
|
||||
.build();
|
||||
AgvCommand.RobotStatusBatteryCommand.Request request = AgvCommand.RobotStatusBatteryCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(edgeCommonVO.getDeviceId()))
|
||||
.setData(requestData)
|
||||
.build();
|
||||
return executeGrpcCall(() -> stub.getBatteryStatus(request)).getStatus();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行gRPC调用并处理异常
|
||||
*
|
||||
* @param call gRPC调用
|
||||
* @param <T> 返回类型
|
||||
* @return 调用结果
|
||||
*/
|
||||
private <T> T executeGrpcCall(java.util.function.Supplier<T> call) {
|
||||
try {
|
||||
return call.get();
|
||||
} catch (Exception e) {
|
||||
log.error("AGV gRPC调用失败", e);
|
||||
throw new GlobalException("AGV通信失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,584 @@
|
||||
package cmvr.api;
|
||||
|
||||
import static io.grpc.MethodDescriptor.generateFullMethodName;
|
||||
|
||||
/**
|
||||
*/
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler (version 1.52.0)",
|
||||
comments = "Source: cmvr/api/agv_service.proto")
|
||||
@io.grpc.stub.annotations.GrpcGenerated
|
||||
public final class AgvServiceGrpc {
|
||||
|
||||
private AgvServiceGrpc() {}
|
||||
|
||||
public static final String SERVICE_NAME = "cmvr.api.AgvService";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request,
|
||||
cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback> getGetStatusInfoMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "GetStatusInfo",
|
||||
requestType = cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request.class,
|
||||
responseType = cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request,
|
||||
cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback> getGetStatusInfoMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request, cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback> getGetStatusInfoMethod;
|
||||
if ((getGetStatusInfoMethod = AgvServiceGrpc.getGetStatusInfoMethod) == null) {
|
||||
synchronized (AgvServiceGrpc.class) {
|
||||
if ((getGetStatusInfoMethod = AgvServiceGrpc.getGetStatusInfoMethod) == null) {
|
||||
AgvServiceGrpc.getGetStatusInfoMethod = getGetStatusInfoMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request, cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetStatusInfo"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new AgvServiceMethodDescriptorSupplier("GetStatusInfo"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getGetStatusInfoMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback> getGetBatteryStatusMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "GetBatteryStatus",
|
||||
requestType = cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request.class,
|
||||
responseType = cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback> getGetBatteryStatusMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request, cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback> getGetBatteryStatusMethod;
|
||||
if ((getGetBatteryStatusMethod = AgvServiceGrpc.getGetBatteryStatusMethod) == null) {
|
||||
synchronized (AgvServiceGrpc.class) {
|
||||
if ((getGetBatteryStatusMethod = AgvServiceGrpc.getGetBatteryStatusMethod) == null) {
|
||||
AgvServiceGrpc.getGetBatteryStatusMethod = getGetBatteryStatusMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request, cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetBatteryStatus"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new AgvServiceMethodDescriptorSupplier("GetBatteryStatus"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getGetBatteryStatusMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotStatusLocCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback> getGetRobotLocationMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "GetRobotLocation",
|
||||
requestType = cmvr.api.AgvCommand.RobotStatusLocCommand.Request.class,
|
||||
responseType = cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotStatusLocCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback> getGetRobotLocationMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotStatusLocCommand.Request, cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback> getGetRobotLocationMethod;
|
||||
if ((getGetRobotLocationMethod = AgvServiceGrpc.getGetRobotLocationMethod) == null) {
|
||||
synchronized (AgvServiceGrpc.class) {
|
||||
if ((getGetRobotLocationMethod = AgvServiceGrpc.getGetRobotLocationMethod) == null) {
|
||||
AgvServiceGrpc.getGetRobotLocationMethod = getGetRobotLocationMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.AgvCommand.RobotStatusLocCommand.Request, cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetRobotLocation"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.AgvCommand.RobotStatusLocCommand.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new AgvServiceMethodDescriptorSupplier("GetRobotLocation"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getGetRobotLocationMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback> getRobotConfigDownloadMapMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "RobotConfigDownloadMap",
|
||||
requestType = cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request.class,
|
||||
responseType = cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback> getRobotConfigDownloadMapMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request, cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback> getRobotConfigDownloadMapMethod;
|
||||
if ((getRobotConfigDownloadMapMethod = AgvServiceGrpc.getRobotConfigDownloadMapMethod) == null) {
|
||||
synchronized (AgvServiceGrpc.class) {
|
||||
if ((getRobotConfigDownloadMapMethod = AgvServiceGrpc.getRobotConfigDownloadMapMethod) == null) {
|
||||
AgvServiceGrpc.getRobotConfigDownloadMapMethod = getRobotConfigDownloadMapMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request, cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "RobotConfigDownloadMap"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new AgvServiceMethodDescriptorSupplier("RobotConfigDownloadMap"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getRobotConfigDownloadMapMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotStatusMapCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback> getGetMapStatusMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "GetMapStatus",
|
||||
requestType = cmvr.api.AgvCommand.RobotStatusMapCommand.Request.class,
|
||||
responseType = cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotStatusMapCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback> getGetMapStatusMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.AgvCommand.RobotStatusMapCommand.Request, cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback> getGetMapStatusMethod;
|
||||
if ((getGetMapStatusMethod = AgvServiceGrpc.getGetMapStatusMethod) == null) {
|
||||
synchronized (AgvServiceGrpc.class) {
|
||||
if ((getGetMapStatusMethod = AgvServiceGrpc.getGetMapStatusMethod) == null) {
|
||||
AgvServiceGrpc.getGetMapStatusMethod = getGetMapStatusMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.AgvCommand.RobotStatusMapCommand.Request, cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetMapStatus"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.AgvCommand.RobotStatusMapCommand.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new AgvServiceMethodDescriptorSupplier("GetMapStatus"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getGetMapStatusMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new async stub that supports all call types for the service
|
||||
*/
|
||||
public static AgvServiceStub newStub(io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<AgvServiceStub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<AgvServiceStub>() {
|
||||
@java.lang.Override
|
||||
public AgvServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AgvServiceStub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return AgvServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
public static AgvServiceBlockingStub newBlockingStub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<AgvServiceBlockingStub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<AgvServiceBlockingStub>() {
|
||||
@java.lang.Override
|
||||
public AgvServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AgvServiceBlockingStub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return AgvServiceBlockingStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ListenableFuture-style stub that supports unary calls on the service
|
||||
*/
|
||||
public static AgvServiceFutureStub newFutureStub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<AgvServiceFutureStub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<AgvServiceFutureStub>() {
|
||||
@java.lang.Override
|
||||
public AgvServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AgvServiceFutureStub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return AgvServiceFutureStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static abstract class AgvServiceImplBase implements io.grpc.BindableService {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 基本控制
|
||||
* </pre>
|
||||
*/
|
||||
public void getStatusInfo(cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetStatusInfoMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void getBatteryStatus(cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetBatteryStatusMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void getRobotLocation(cmvr.api.AgvCommand.RobotStatusLocCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetRobotLocationMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void robotConfigDownloadMap(cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getRobotConfigDownloadMapMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void getMapStatus(cmvr.api.AgvCommand.RobotStatusMapCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetMapStatusMethod(), responseObserver);
|
||||
}
|
||||
|
||||
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
||||
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
||||
.addMethod(
|
||||
getGetStatusInfoMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request,
|
||||
cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback>(
|
||||
this, METHODID_GET_STATUS_INFO)))
|
||||
.addMethod(
|
||||
getGetBatteryStatusMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback>(
|
||||
this, METHODID_GET_BATTERY_STATUS)))
|
||||
.addMethod(
|
||||
getGetRobotLocationMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.AgvCommand.RobotStatusLocCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback>(
|
||||
this, METHODID_GET_ROBOT_LOCATION)))
|
||||
.addMethod(
|
||||
getRobotConfigDownloadMapMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback>(
|
||||
this, METHODID_ROBOT_CONFIG_DOWNLOAD_MAP)))
|
||||
.addMethod(
|
||||
getGetMapStatusMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.AgvCommand.RobotStatusMapCommand.Request,
|
||||
cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback>(
|
||||
this, METHODID_GET_MAP_STATUS)))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static final class AgvServiceStub extends io.grpc.stub.AbstractAsyncStub<AgvServiceStub> {
|
||||
private AgvServiceStub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected AgvServiceStub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AgvServiceStub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 基本控制
|
||||
* </pre>
|
||||
*/
|
||||
public void getStatusInfo(cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getGetStatusInfoMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void getBatteryStatus(cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getGetBatteryStatusMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void getRobotLocation(cmvr.api.AgvCommand.RobotStatusLocCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getGetRobotLocationMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void robotConfigDownloadMap(cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getRobotConfigDownloadMapMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void getMapStatus(cmvr.api.AgvCommand.RobotStatusMapCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getGetMapStatusMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static final class AgvServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<AgvServiceBlockingStub> {
|
||||
private AgvServiceBlockingStub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected AgvServiceBlockingStub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AgvServiceBlockingStub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 基本控制
|
||||
* </pre>
|
||||
*/
|
||||
public cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback getStatusInfo(cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetStatusInfoMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback getBatteryStatus(cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetBatteryStatusMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback getRobotLocation(cmvr.api.AgvCommand.RobotStatusLocCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetRobotLocationMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback robotConfigDownloadMap(cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getRobotConfigDownloadMapMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback getMapStatus(cmvr.api.AgvCommand.RobotStatusMapCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetMapStatusMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static final class AgvServiceFutureStub extends io.grpc.stub.AbstractFutureStub<AgvServiceFutureStub> {
|
||||
private AgvServiceFutureStub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected AgvServiceFutureStub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new AgvServiceFutureStub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 基本控制
|
||||
* </pre>
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback> getStatusInfo(
|
||||
cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getGetStatusInfoMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback> getBatteryStatus(
|
||||
cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getGetBatteryStatusMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback> getRobotLocation(
|
||||
cmvr.api.AgvCommand.RobotStatusLocCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getGetRobotLocationMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback> robotConfigDownloadMap(
|
||||
cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getRobotConfigDownloadMapMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback> getMapStatus(
|
||||
cmvr.api.AgvCommand.RobotStatusMapCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getGetMapStatusMethod(), getCallOptions()), request);
|
||||
}
|
||||
}
|
||||
|
||||
private static final int METHODID_GET_STATUS_INFO = 0;
|
||||
private static final int METHODID_GET_BATTERY_STATUS = 1;
|
||||
private static final int METHODID_GET_ROBOT_LOCATION = 2;
|
||||
private static final int METHODID_ROBOT_CONFIG_DOWNLOAD_MAP = 3;
|
||||
private static final int METHODID_GET_MAP_STATUS = 4;
|
||||
|
||||
private static final class MethodHandlers<Req, Resp> implements
|
||||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
||||
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
|
||||
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
|
||||
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
|
||||
private final AgvServiceImplBase serviceImpl;
|
||||
private final int methodId;
|
||||
|
||||
MethodHandlers(AgvServiceImplBase serviceImpl, int methodId) {
|
||||
this.serviceImpl = serviceImpl;
|
||||
this.methodId = methodId;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("unchecked")
|
||||
public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
|
||||
switch (methodId) {
|
||||
case METHODID_GET_STATUS_INFO:
|
||||
serviceImpl.getStatusInfo((cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.GetAgvStatusInfoCommand.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_GET_BATTERY_STATUS:
|
||||
serviceImpl.getBatteryStatus((cmvr.api.AgvCommand.RobotStatusBatteryCommand.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotStatusBatteryCommand.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_GET_ROBOT_LOCATION:
|
||||
serviceImpl.getRobotLocation((cmvr.api.AgvCommand.RobotStatusLocCommand.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotStatusLocCommand.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_ROBOT_CONFIG_DOWNLOAD_MAP:
|
||||
serviceImpl.robotConfigDownloadMap((cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotConfigDownloadMapCommand.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_GET_MAP_STATUS:
|
||||
serviceImpl.getMapStatus((cmvr.api.AgvCommand.RobotStatusMapCommand.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.AgvCommand.RobotStatusMapCommand.Feedback>) responseObserver);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@java.lang.SuppressWarnings("unchecked")
|
||||
public io.grpc.stub.StreamObserver<Req> invoke(
|
||||
io.grpc.stub.StreamObserver<Resp> responseObserver) {
|
||||
switch (methodId) {
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static abstract class AgvServiceBaseDescriptorSupplier
|
||||
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
|
||||
AgvServiceBaseDescriptorSupplier() {}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
|
||||
return cmvr.api.AgvServiceOuterClass.getDescriptor();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
|
||||
return getFileDescriptor().findServiceByName("AgvService");
|
||||
}
|
||||
}
|
||||
|
||||
private static final class AgvServiceFileDescriptorSupplier
|
||||
extends AgvServiceBaseDescriptorSupplier {
|
||||
AgvServiceFileDescriptorSupplier() {}
|
||||
}
|
||||
|
||||
private static final class AgvServiceMethodDescriptorSupplier
|
||||
extends AgvServiceBaseDescriptorSupplier
|
||||
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
|
||||
private final String methodName;
|
||||
|
||||
AgvServiceMethodDescriptorSupplier(String methodName) {
|
||||
this.methodName = methodName;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
|
||||
return getServiceDescriptor().findMethodByName(methodName);
|
||||
}
|
||||
}
|
||||
|
||||
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
|
||||
|
||||
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
|
||||
io.grpc.ServiceDescriptor result = serviceDescriptor;
|
||||
if (result == null) {
|
||||
synchronized (AgvServiceGrpc.class) {
|
||||
result = serviceDescriptor;
|
||||
if (result == null) {
|
||||
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
|
||||
.setSchemaDescriptor(new AgvServiceFileDescriptorSupplier())
|
||||
.addMethod(getGetStatusInfoMethod())
|
||||
.addMethod(getGetBatteryStatusMethod())
|
||||
.addMethod(getGetRobotLocationMethod())
|
||||
.addMethod(getRobotConfigDownloadMapMethod())
|
||||
.addMethod(getGetMapStatusMethod())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: cmvr/api/agv_service.proto
|
||||
|
||||
package cmvr.api;
|
||||
|
||||
public final class AgvServiceOuterClass {
|
||||
private AgvServiceOuterClass() {}
|
||||
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\032cmvr/api/agv_service.proto\022\010cmvr.api\032\032" +
|
||||
"cmvr/api/agv_command.proto2\252\004\n\nAgvServic" +
|
||||
"e\022f\n\rGetStatusInfo\022).cmvr.api.GetAgvStat" +
|
||||
"usInfoCommand.Request\032*.cmvr.api.GetAgvS" +
|
||||
"tatusInfoCommand.Feedback\022m\n\020GetBatteryS" +
|
||||
"tatus\022+.cmvr.api.RobotStatusBatteryComma" +
|
||||
"nd.Request\032,.cmvr.api.RobotStatusBattery" +
|
||||
"Command.Feedback\022e\n\020GetRobotLocation\022\'.c" +
|
||||
"mvr.api.RobotStatusLocCommand.Request\032(." +
|
||||
"cmvr.api.RobotStatusLocCommand.Feedback\022" +
|
||||
"{\n\026RobotConfigDownloadMap\022/.cmvr.api.Rob" +
|
||||
"otConfigDownloadMapCommand.Request\0320.cmv" +
|
||||
"r.api.RobotConfigDownloadMapCommand.Feed" +
|
||||
"back\022a\n\014GetMapStatus\022\'.cmvr.api.RobotSta" +
|
||||
"tusMapCommand.Request\032(.cmvr.api.RobotSt" +
|
||||
"atusMapCommand.Feedbackb\006proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||
cmvr.api.AgvCommand.getDescriptor(),
|
||||
});
|
||||
cmvr.api.AgvCommand.getDescriptor();
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
||||
@ -0,0 +1,147 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "cmvr/api/common.proto";
|
||||
|
||||
package cmvr.api;
|
||||
|
||||
// AGV状态信息
|
||||
message AgvStatusInfo {
|
||||
optional string id = 1; // AGV ID
|
||||
optional string vehicle_id = 2; // 车辆ID
|
||||
optional string version = 3; // 软件版本
|
||||
optional string model = 4; // 型号
|
||||
optional string dsp_version = 5; // DSP版本
|
||||
optional string current_ip = 6; // 当前IP地址
|
||||
optional string mac = 7; // MAC地址
|
||||
optional int32 rssi = 8; // 信号强度
|
||||
optional int32 ret_code = 9; // 返回码
|
||||
optional string err_msg = 10; // 错误信息
|
||||
}
|
||||
|
||||
// 获取AGV状态命令
|
||||
message GetAgvStatusInfoCommand {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1;
|
||||
}
|
||||
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
AgvStatusInfo status = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ===================== 电池状态查询 =====================
|
||||
message AgvBatteryStatus {
|
||||
optional double battery_level = 1; // 电池电量 [0,1]
|
||||
optional double battery_temp = 2; // 电池温度 ℃
|
||||
optional bool charging = 3; // 是否正在充电
|
||||
optional double voltage = 4; // 电压 V
|
||||
optional double current = 5; // 电流 A
|
||||
optional double max_charge_voltage = 6; // 最大充电电压,-1=不支持
|
||||
optional double max_charge_current = 7; // 最大充电电流,-1=不支持
|
||||
optional bool manual_charge = 8; // 手动充电状态
|
||||
optional bool auto_charge = 9; // 自动充电状态
|
||||
optional int32 battery_cycle = 10; // 电池循环次数
|
||||
optional string battery_user_data = 11; // 电池自定义数据
|
||||
optional string extra = 12; // 客户自定义数据
|
||||
optional int32 ret_code = 13; // 错误码
|
||||
optional string create_on = 14; // 时间戳
|
||||
optional string err_msg = 15; // 错误信息
|
||||
}
|
||||
|
||||
message RobotStatusBatteryRequestData {
|
||||
optional bool simple = 1; // true:仅简单数据 false:全量数据,默认false
|
||||
}
|
||||
|
||||
message RobotStatusBatteryCommand {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1;
|
||||
RobotStatusBatteryRequestData data = 2;
|
||||
}
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
AgvBatteryStatus status = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ===================== 机器人位置查询 =====================
|
||||
message AgvRobotLocation {
|
||||
optional double x = 1; // X坐标(m)
|
||||
optional double y = 2; // Y坐标(m)
|
||||
optional double angle = 3; // 姿态角(rad)
|
||||
optional double confidence = 4; // 定位置信度[0,1]
|
||||
optional string current_station = 5; // 当前最近站点ID
|
||||
optional string last_station = 6; // 上一站点ID
|
||||
optional int32 loc_method = 7; // 定位方式
|
||||
optional int32 ret_code = 8; // 错误码
|
||||
optional string create_on = 9; // 时间戳
|
||||
optional string err_msg = 10; // 错误信息
|
||||
}
|
||||
|
||||
message RobotStatusLocCommand {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1;
|
||||
}
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
AgvRobotLocation status = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ===================== 地图下载 =====================
|
||||
message RobotConfigDownloadMapRequestData {
|
||||
optional string map_name = 1; // 地图名称
|
||||
}
|
||||
|
||||
message AgvDownloadMapResult {
|
||||
optional int32 ret_code = 1;
|
||||
optional string create_on = 2;
|
||||
optional string err_msg = 3;
|
||||
optional string map_content = 4; // 完整地图JSON文本
|
||||
}
|
||||
|
||||
message RobotConfigDownloadMapCommand {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1;
|
||||
RobotConfigDownloadMapRequestData data = 2;
|
||||
}
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
AgvDownloadMapResult status = 2;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 单条地图文件信息
|
||||
message MapFileInfo {
|
||||
optional string name = 1;
|
||||
optional string modified = 2;
|
||||
optional int64 size = 3;
|
||||
}
|
||||
|
||||
// 地图查询响应
|
||||
message AgvMapStatus {
|
||||
optional string current_map = 1;
|
||||
optional string current_map_md5 = 2;
|
||||
repeated string maps = 3;
|
||||
repeated MapFileInfo map_files_info = 4;
|
||||
optional int32 ret_code = 5;
|
||||
optional string create_on = 6;
|
||||
optional string err_msg = 7;
|
||||
}
|
||||
|
||||
// 查询地图状态命令
|
||||
message RobotStatusMapCommand {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1;
|
||||
}
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
AgvMapStatus status = 2;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "cmvr/api/agv_command.proto";
|
||||
|
||||
package cmvr.api;
|
||||
|
||||
service AgvService {
|
||||
// 基本控制
|
||||
rpc GetStatusInfo(GetAgvStatusInfoCommand.Request) returns (GetAgvStatusInfoCommand.Feedback);
|
||||
|
||||
rpc GetBatteryStatus(RobotStatusBatteryCommand.Request) returns (RobotStatusBatteryCommand.Feedback);
|
||||
|
||||
rpc GetRobotLocation(RobotStatusLocCommand.Request) returns (RobotStatusLocCommand.Feedback);
|
||||
|
||||
rpc RobotConfigDownloadMap(RobotConfigDownloadMapCommand.Request) returns (RobotConfigDownloadMapCommand.Feedback);
|
||||
|
||||
rpc GetMapStatus(RobotStatusMapCommand.Request) returns (RobotStatusMapCommand.Feedback);
|
||||
|
||||
}
|
||||
@ -59,7 +59,7 @@ public class InspectionRobot extends BaseEntity
|
||||
/** 端口号 */
|
||||
@Excel(name = "端口号")
|
||||
@ApiModelProperty("端口号")
|
||||
private Integer port;
|
||||
private Long port;
|
||||
|
||||
/** 当前地图 */
|
||||
@Excel(name = "当前地图")
|
||||
@ -81,4 +81,9 @@ public class InspectionRobot extends BaseEntity
|
||||
@ApiModelProperty("当前位置")
|
||||
private String currentPosition;
|
||||
|
||||
/** 终端id */
|
||||
@Excel(name = "终端id")
|
||||
@ApiModelProperty("终端id")
|
||||
private String terminalId;
|
||||
|
||||
}
|
||||
|
||||
@ -68,6 +68,11 @@ public class InspectionRobotVo extends BaseEntity
|
||||
@ApiModelProperty("当前地图名称")
|
||||
private String currentMapName;
|
||||
|
||||
/** 机器人中地图名称 */
|
||||
@Excel(name = "机器人中地图名称")
|
||||
@ApiModelProperty("机器人中地图名称")
|
||||
private String robotMapName;
|
||||
|
||||
/** 当前状态 */
|
||||
@Excel(name = "当前状态")
|
||||
@ApiModelProperty("当前状态(0在线 1离线 2充电中 3巡检中)")
|
||||
@ -93,4 +98,9 @@ public class InspectionRobotVo extends BaseEntity
|
||||
@ApiModelProperty("修改人昵称")
|
||||
private String updateByName;
|
||||
|
||||
/** 终端id */
|
||||
@Excel(name = "终端id")
|
||||
@ApiModelProperty("终端id")
|
||||
private String terminalId;
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.List;
|
||||
import com.cmvr.inspection.domain.InspectionMap;
|
||||
import com.cmvr.inspection.domain.vo.InspectionMapVo;
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* 巡检地图Mapper接口
|
||||
@ -51,4 +52,13 @@ public interface InspectionMapMapper extends MPJBaseMapper<InspectionMap>
|
||||
* @return 巡检地图视图集合
|
||||
*/
|
||||
List<InspectionMapVo> selectInspectionMapVoList(InspectionMap inspectionMap);
|
||||
|
||||
/**
|
||||
* 根据机器人ID查询地图列表
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @return 地图列表
|
||||
*/
|
||||
List<InspectionMapVo> selectMapsByRobotId(@Param("robotId") String robotId);
|
||||
}
|
||||
|
||||
|
||||
@ -54,4 +54,13 @@ public interface IInspectionMapService extends IService<InspectionMap>
|
||||
*/
|
||||
int deleteInspectionMapByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 根据机器人ID查询地图列表
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @return 地图列表
|
||||
*/
|
||||
List<InspectionMapVo> getMapsByRobotId(String robotId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
package com.cmvr.inspection.service;
|
||||
|
||||
import java.util.List;
|
||||
@ -5,6 +6,7 @@ import java.util.List;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.cmvr.inspection.domain.InspectionRobot;
|
||||
import com.cmvr.inspection.domain.vo.InspectionRobotVo;
|
||||
import cmvr.api.AgvCommand;
|
||||
|
||||
/**
|
||||
* 巡检机器人Service接口
|
||||
@ -54,4 +56,47 @@ public interface IInspectionRobotService extends IService<InspectionRobot>
|
||||
*/
|
||||
int deleteInspectionRobotByIds(String[] ids);
|
||||
|
||||
/**
|
||||
* 获取机器人地图列表(从AGV获取)
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @return 地图状态信息
|
||||
*/
|
||||
AgvCommand.AgvMapStatus getRobotMapList(String robotId);
|
||||
|
||||
/**
|
||||
* 绑定机器人地图
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @param mapId 地图ID
|
||||
* @return 结果
|
||||
*/
|
||||
int bindRobotMap(String robotId, String mapId);
|
||||
|
||||
/**
|
||||
* 上传地图到机器人
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @param mapId 地图ID
|
||||
* @return 结果
|
||||
*/
|
||||
String uploadMapToRobot(String robotId, String mapId);
|
||||
|
||||
/**
|
||||
* 从机器人下载地图
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @param mapName 地图名称
|
||||
* @return 地图ID
|
||||
*/
|
||||
String downloadMapFromRobot(String robotId, String mapName);
|
||||
|
||||
/**
|
||||
* 同步机器人状态(电量、位置等)
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @return 更新后的机器人信息
|
||||
*/
|
||||
InspectionRobot syncRobotStatus(String robotId);
|
||||
|
||||
}
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
package com.cmvr.inspection.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
@ -92,4 +93,17 @@ public class InspectionMapServiceImpl extends ServiceImpl<InspectionMapMapper, I
|
||||
{
|
||||
return inspectionMapMapper.deleteInspectionMapByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据机器人ID查询地图列表
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @return 地图列表
|
||||
*/
|
||||
@Override
|
||||
public List<InspectionMapVo> getMapsByRobotId(String robotId)
|
||||
{
|
||||
return inspectionMapMapper.selectMapsByRobotId(robotId);
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,17 +1,28 @@
|
||||
|
||||
package com.cmvr.inspection.service.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import cmvr.api.AgvCommand;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.cmvr.common.utils.SecurityUtils;
|
||||
import com.cmvr.device.domain.DeDeviceTerminalConfig;
|
||||
import com.cmvr.device.service.IDeDeviceTerminalConfigService;
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import com.cmvr.edge.client.service.EdgeAgvService;
|
||||
import com.cmvr.inspection.domain.InspectionMap;
|
||||
import com.cmvr.inspection.domain.vo.InspectionRobotVo;
|
||||
import com.cmvr.inspection.mapper.InspectionMapMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.cmvr.common.utils.DateUtils;
|
||||
import com.cmvr.inspection.mapper.InspectionRobotMapper;
|
||||
import com.cmvr.inspection.domain.InspectionRobot;
|
||||
import com.cmvr.inspection.service.IInspectionRobotService;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
|
||||
/**
|
||||
* 巡检机器人Service业务层处理
|
||||
@ -25,6 +36,15 @@ public class InspectionRobotServiceImpl extends ServiceImpl<InspectionRobotMappe
|
||||
@Autowired
|
||||
private InspectionRobotMapper inspectionRobotMapper;
|
||||
|
||||
@Autowired
|
||||
private InspectionMapMapper inspectionMapMapper;
|
||||
|
||||
@Autowired
|
||||
private EdgeAgvService edgeAgvService;
|
||||
|
||||
@Autowired
|
||||
private IDeDeviceTerminalConfigService deDeviceTerminalConfigService;
|
||||
|
||||
/**
|
||||
* 查询巡检机器人
|
||||
*
|
||||
@ -58,6 +78,15 @@ public class InspectionRobotServiceImpl extends ServiceImpl<InspectionRobotMappe
|
||||
@Override
|
||||
public int insertInspectionRobot(InspectionRobot inspectionRobot)
|
||||
{
|
||||
DeDeviceTerminalConfig deDeviceTerminalConfig = new DeDeviceTerminalConfig();
|
||||
deDeviceTerminalConfig.setName(inspectionRobot.getRobotName());
|
||||
deDeviceTerminalConfig.setDescription("机器人终端");
|
||||
deDeviceTerminalConfig.setStatus("1");
|
||||
deDeviceTerminalConfig.setHost(inspectionRobot.getIpAddress());
|
||||
deDeviceTerminalConfig.setPort(inspectionRobot.getPort());
|
||||
// 自动创建设备管理模块的终端并将终端id保存机器人中
|
||||
deDeviceTerminalConfigService.insertDeDeviceTerminalConfig(deDeviceTerminalConfig);
|
||||
inspectionRobot.setTerminalId(deDeviceTerminalConfig.getId());
|
||||
// 生成UUID作为主键
|
||||
if (inspectionRobot.getId() == null || inspectionRobot.getId().isEmpty()) {
|
||||
inspectionRobot.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
@ -78,6 +107,11 @@ public class InspectionRobotServiceImpl extends ServiceImpl<InspectionRobotMappe
|
||||
{
|
||||
inspectionRobot.setUpdateTime(DateUtils.getNowDate());
|
||||
inspectionRobot.setUpdateBy(SecurityUtils.getUsername());
|
||||
DeDeviceTerminalConfig deDeviceTerminalConfig = deDeviceTerminalConfigService.selectDeDeviceTerminalConfigById(inspectionRobot.getTerminalId());
|
||||
deDeviceTerminalConfig.setName(inspectionRobot.getRobotName());
|
||||
deDeviceTerminalConfig.setHost(inspectionRobot.getIpAddress());
|
||||
deDeviceTerminalConfig.setPort(inspectionRobot.getPort());
|
||||
deDeviceTerminalConfigService.updateDeDeviceTerminalConfig(deDeviceTerminalConfig);
|
||||
return inspectionRobotMapper.updateInspectionRobot(inspectionRobot);
|
||||
}
|
||||
|
||||
@ -90,7 +124,198 @@ public class InspectionRobotServiceImpl extends ServiceImpl<InspectionRobotMappe
|
||||
@Override
|
||||
public int deleteInspectionRobotByIds(String[] ids)
|
||||
{
|
||||
List<InspectionRobot> inspectionRobots = inspectionRobotMapper.selectBatchIds(Arrays.asList(ids));
|
||||
deDeviceTerminalConfigService.deleteDeDeviceTerminalConfigByIds(inspectionRobots.stream().map(InspectionRobot::getTerminalId).toArray(String[]::new));
|
||||
return inspectionRobotMapper.deleteInspectionRobotByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取机器人地图列表(从AGV获取)
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @return 地图状态信息
|
||||
*/
|
||||
@Override
|
||||
public AgvCommand.AgvMapStatus getRobotMapList(String robotId)
|
||||
{
|
||||
InspectionRobot robot = inspectionRobotMapper.selectInspectionRobotById(robotId);
|
||||
if (robot == null) {
|
||||
throw new GlobalException("机器人不存在");
|
||||
}
|
||||
if (StrUtil.isBlank(robot.getIpAddress())) {
|
||||
throw new GlobalException("机器人IP地址未配置");
|
||||
}
|
||||
|
||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||
edgeCommonVO.setTerminalId(robot.getTerminalId());
|
||||
edgeCommonVO.setDeviceId(robot.getRobotCode());
|
||||
|
||||
return edgeAgvService.getMapStatus(edgeCommonVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定机器人地图
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @param mapId 地图ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int bindRobotMap(String robotId, String mapId)
|
||||
{
|
||||
InspectionRobot robot = inspectionRobotMapper.selectInspectionRobotById(robotId);
|
||||
if (robot == null) {
|
||||
throw new GlobalException("机器人不存在");
|
||||
}
|
||||
|
||||
InspectionMap map = inspectionMapMapper.selectInspectionMapById(mapId);
|
||||
if (map == null) {
|
||||
throw new GlobalException("地图不存在");
|
||||
}
|
||||
|
||||
robot.setCurrentMapId(mapId);
|
||||
robot.setUpdateTime(DateUtils.getNowDate());
|
||||
robot.setUpdateBy(SecurityUtils.getUsername());
|
||||
|
||||
return inspectionRobotMapper.updateInspectionRobot(robot);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传地图到机器人
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @param mapId 地图ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String uploadMapToRobot(String robotId, String mapId)
|
||||
{
|
||||
InspectionRobot robot = inspectionRobotMapper.selectInspectionRobotById(robotId);
|
||||
if (robot == null) {
|
||||
throw new GlobalException("机器人不存在");
|
||||
}
|
||||
|
||||
InspectionMap map = inspectionMapMapper.selectInspectionMapById(mapId);
|
||||
if (map == null) {
|
||||
throw new GlobalException("地图不存在");
|
||||
}
|
||||
|
||||
if (StrUtil.isBlank(map.getMapFilePath())) {
|
||||
throw new GlobalException("地图文件路径不存在");
|
||||
}
|
||||
|
||||
// TODO: 从文件路径读取地图内容
|
||||
// 这里需要根据实际存储方式实现
|
||||
String mapContent = readMapFile(map.getMapFilePath());
|
||||
|
||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||
edgeCommonVO.setTerminalId(robot.getTerminalId());
|
||||
edgeCommonVO.setDeviceId(robot.getRobotCode());
|
||||
|
||||
// cmvr.api.AgvCommand.AgvUploadMapResult result = edgeAgvService.robotConfigUploadMap(edgeCommonVO, mapContent);
|
||||
//
|
||||
// if (result.getRetCode() != 0) {
|
||||
// throw new GlobalException("上传地图失败: " + result.getErrMsg());
|
||||
// }
|
||||
|
||||
return "上传成功";
|
||||
}
|
||||
|
||||
/**
|
||||
* 从机器人下载地图
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @param mapName 地图名称
|
||||
* @return 地图ID
|
||||
*/
|
||||
@Override
|
||||
public String downloadMapFromRobot(String robotId, String mapName)
|
||||
{
|
||||
InspectionRobot robot = inspectionRobotMapper.selectInspectionRobotById(robotId);
|
||||
if (robot == null) {
|
||||
throw new GlobalException("机器人不存在");
|
||||
}
|
||||
|
||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||
edgeCommonVO.setTerminalId(robot.getTerminalId());
|
||||
edgeCommonVO.setDeviceId(robot.getRobotCode());
|
||||
|
||||
cmvr.api.AgvCommand.AgvDownloadMapResult result = edgeAgvService.robotConfigDownloadMap(edgeCommonVO, mapName);
|
||||
|
||||
// 保存地图到数据库
|
||||
// InspectionMap inspectionMap = new InspectionMap();
|
||||
// inspectionMap.setId(UUID.randomUUID().toString().replace("-", ""));
|
||||
// inspectionMap.setMapName(mapName);
|
||||
// inspectionMap.setMapSourceRobotId(robotId);
|
||||
// inspectionMap.setMapSourceName(mapName);
|
||||
//
|
||||
// // TODO: 将地图内容保存到文件系统,并返回文件路径
|
||||
// // String filePath = saveMapToFile(result.getMapContent(), mapName);
|
||||
// // inspectionMap.setMapFilePath(filePath);
|
||||
//
|
||||
// inspectionMap.setStatus("0");
|
||||
// inspectionMap.setCreateTime(DateUtils.getNowDate());
|
||||
// inspectionMap.setCreateBy(SecurityUtils.getUsername());
|
||||
//
|
||||
// inspectionMapMapper.insertInspectionMap(inspectionMap);
|
||||
|
||||
|
||||
|
||||
|
||||
return result.getMapContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步机器人状态(电量、位置等)
|
||||
*
|
||||
* @param robotId 机器人ID
|
||||
* @return 更新后的机器人信息
|
||||
*/
|
||||
@Override
|
||||
public InspectionRobot syncRobotStatus(String robotId)
|
||||
{
|
||||
InspectionRobot robot = inspectionRobotMapper.selectInspectionRobotById(robotId);
|
||||
if (robot == null) {
|
||||
throw new GlobalException("机器人不存在");
|
||||
}
|
||||
|
||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||
edgeCommonVO.setTerminalId(robot.getTerminalId());
|
||||
edgeCommonVO.setDeviceId(robot.getRobotCode());
|
||||
|
||||
try {
|
||||
// 获取电池状态
|
||||
cmvr.api.AgvCommand.AgvBatteryStatus batteryStatus = edgeAgvService.getBatteryStatus(edgeCommonVO);
|
||||
robot.setBatteryLevel((int)(batteryStatus.getBatteryLevel() * 100));
|
||||
|
||||
// 获取位置信息
|
||||
cmvr.api.AgvCommand.AgvRobotLocation location = edgeAgvService.getRobotLocation(edgeCommonVO);
|
||||
robot.setCurrentPosition(location.getX() + "," + location.getY() + "," + location.getAngle());
|
||||
|
||||
// 获取状态信息
|
||||
cmvr.api.AgvCommand.AgvStatusInfo statusInfo = edgeAgvService.getStatusInfo(edgeCommonVO);
|
||||
|
||||
robot.setUpdateTime(DateUtils.getNowDate());
|
||||
inspectionRobotMapper.updateInspectionRobot(robot);
|
||||
|
||||
} catch (Exception e) {
|
||||
// 记录日志但不抛出异常,允许部分失败
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return robot;
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取地图文件内容
|
||||
*
|
||||
* @param filePath 文件路径
|
||||
* @return 文件内容
|
||||
*/
|
||||
private String readMapFile(String filePath)
|
||||
{
|
||||
// TODO: 实现文件读取逻辑
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
||||
@ -130,4 +130,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null and status != ''"> and m.status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectInspectionMapVoList" parameterType="InspectionMap" resultMap="InspectionMapVoResult">
|
||||
select m.id, m.create_by, m.create_time, m.update_by, m.update_time, m.remark,
|
||||
m.map_name, m.map_source_robot_id, r.robot_name as map_source_robot_name,
|
||||
m.map_source_name, m.map_file_path, m.status, m.map_desc,
|
||||
u1.nick_name as create_by_name, u2.nick_name as update_by_name
|
||||
from inspection_map m
|
||||
left join inspection_robot r on m.map_source_robot_id = r.id
|
||||
left join sys_user u1 on m.create_by = u1.user_name <!-- 创建人关联用户 -->
|
||||
left join sys_user u2 on m.update_by = u2.user_name <!-- 更新人关联用户 -->
|
||||
<where>
|
||||
<if test="mapName != null and mapName != ''"> and m.map_name like concat('%', #{mapName}, '%')</if>
|
||||
<if test="mapDesc != null and mapDesc != ''"> and m.map_desc like concat('%', #{mapDesc}, '%')</if>
|
||||
<if test="status != null and status != ''"> and m.status = #{status}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectMapsByRobotId" resultMap="InspectionMapVoResult">
|
||||
select m.id, m.create_by, m.create_time, m.update_by, m.update_time, m.remark,
|
||||
m.map_name, m.map_source_robot_id, r.robot_name as map_source_robot_name,
|
||||
m.map_source_name, m.map_file_path, m.status, m.map_desc,
|
||||
u1.nick_name as create_by_name, u2.nick_name as update_by_name
|
||||
from inspection_map m
|
||||
left join inspection_robot r on m.map_source_robot_id = r.id
|
||||
left join sys_user u1 on m.create_by = u1.user_name
|
||||
left join sys_user u2 on m.update_by = u2.user_name
|
||||
where m.map_source_robot_id = #{robotId}
|
||||
order by m.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -21,6 +21,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="status" column="status" />
|
||||
<result property="batteryLevel" column="battery_level" />
|
||||
<result property="currentPosition" column="current_position" />
|
||||
<result property="terminalId" column="terminal_id" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.cmvr.inspection.domain.vo.InspectionRobotVo" id="InspectionRobotVoResult">
|
||||
@ -43,10 +44,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="currentPosition" column="current_position" />
|
||||
<result property="createByName" column="create_by_name" />
|
||||
<result property="updateByName" column="update_by_name" />
|
||||
<result property="terminalId" column="terminal_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInspectionRobotVo">
|
||||
select id, create_by, create_time, update_by, update_time, remark, robot_code, robot_name, robot_model, robot_type, ip_address, port, current_map_id, status, battery_level, current_position from inspection_robot
|
||||
select id, create_by, create_time, update_by, update_time, remark, robot_code, robot_name, robot_model, robot_type, ip_address, port, current_map_id, status, battery_level, current_position, terminal_id from inspection_robot
|
||||
</sql>
|
||||
|
||||
<select id="selectInspectionRobotList" parameterType="InspectionRobot" resultMap="InspectionRobotResult">
|
||||
@ -85,6 +87,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null">status,</if>
|
||||
<if test="batteryLevel != null">battery_level,</if>
|
||||
<if test="currentPosition != null">current_position,</if>
|
||||
<if test="terminalId != null">terminal_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">#{id},</if>
|
||||
@ -103,6 +106,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="batteryLevel != null">#{batteryLevel},</if>
|
||||
<if test="currentPosition != null">#{currentPosition},</if>
|
||||
<if test="terminalId != null">#{terminalId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@ -124,6 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="batteryLevel != null">battery_level = #{batteryLevel},</if>
|
||||
<if test="currentPosition != null">current_position = #{currentPosition},</if>
|
||||
<if test="terminalId != null">terminal_id = #{terminalId},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
@ -144,7 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
r.robot_code, r.robot_name, r.robot_model, r.robot_type,
|
||||
r.ip_address, r.port, r.current_map_id,
|
||||
m.map_name as current_map_name,
|
||||
r.status, r.battery_level, r.current_position,
|
||||
r.status, r.battery_level, r.current_position, r.terminal_id,
|
||||
u1.nick_name as create_by_name, u2.nick_name as update_by_name
|
||||
from inspection_robot r
|
||||
left join inspection_map m on r.current_map_id = m.id
|
||||
|
||||
@ -21,6 +21,7 @@ CREATE TABLE `inspection_robot` (
|
||||
`status` char(1) DEFAULT '0' COMMENT '状态(0在线 1离线 2充电中 3巡检中)',
|
||||
`battery_level` int(3) DEFAULT NULL COMMENT '电量百分比',
|
||||
`current_position` varchar(200) DEFAULT NULL COMMENT '当前位置',
|
||||
`terminal_id` varchar(64) DEFAULT NULL COMMENT '终端ID',
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `uk_robot_code` (`robot_code`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='巡检机器人表';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user