feat(agv): 添加AGV移动到指定站点功能和设备通用指令支持
- 新增 AGV_MOVE_TO_STATION 操作类型用于移动到指定站点 - 添加 DEVICE_EXECUTE_JSON_COMMAND 类型用于执行设备通用指令 - 移除独立的 agv.proto 文件并将相关内容合并到 agv_utils.proto - 更新 AGV 命令协议导入路径指向新的工具协议文件 - 优化 AGV 运动选项注释说明同步阻塞行为默认设置 - 为路径导航命令添加执行选项参数支持 - 新增臂式机器人远程操作服务协议定义 - 实现臂式机器人远程操作服务的gRPC接口代码
This commit is contained in:
parent
e62f445013
commit
c8b2c39d74
@ -1,6 +1,6 @@
|
||||
package com.cmvr.web.controller.api;
|
||||
|
||||
import cmvr.msgs.Agv;
|
||||
import cmvr.msgs.AgvUtils;
|
||||
import com.cmvr.common.core.domain.AjaxResult;
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import com.cmvr.edge.client.model.agv.EdgeAgvMapNameVO;
|
||||
@ -12,12 +12,14 @@ import com.cmvr.edge.client.model.agv.EdgeAgvVelocityVO;
|
||||
import com.cmvr.edge.client.service.EdgeAgvService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -48,8 +50,13 @@ public class EdgeAgvController {
|
||||
*/
|
||||
@ApiOperation("获取AGV运行时状态")
|
||||
@GetMapping("/getRuntimeState")
|
||||
public AjaxResult getRuntimeState(@Validated EdgeCommonVO vo) {
|
||||
Agv.AgvRuntimeState state = edgeAgvService.getRuntimeState(vo);
|
||||
public AjaxResult getRuntimeState(
|
||||
@ApiParam(value = "终端设备ID", required = true)
|
||||
@RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true)
|
||||
@RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO vo = commonVo(terminalId, deviceId);
|
||||
AgvUtils.AgvRuntimeState state = edgeAgvService.getRuntimeState(vo);
|
||||
return AjaxResult.ok(toRuntimeStateMap(state));
|
||||
}
|
||||
|
||||
@ -58,8 +65,13 @@ public class EdgeAgvController {
|
||||
*/
|
||||
@ApiOperation("获取导航状态")
|
||||
@GetMapping("/getNavigationStatus")
|
||||
public AjaxResult getNavigationStatus(@Validated EdgeCommonVO vo) {
|
||||
Agv.AgvNavigationStatus status = edgeAgvService.getNavigationStatus(vo);
|
||||
public AjaxResult getNavigationStatus(
|
||||
@ApiParam(value = "终端设备ID", required = true)
|
||||
@RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true)
|
||||
@RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO vo = commonVo(terminalId, deviceId);
|
||||
AgvUtils.AgvNavigationStatus status = edgeAgvService.getNavigationStatus(vo);
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("state", status.getState());
|
||||
resultMap.put("type", status.getType());
|
||||
@ -94,7 +106,7 @@ public class EdgeAgvController {
|
||||
@ApiOperation("导航到指定位置")
|
||||
@PostMapping("/navigateToPose")
|
||||
public AjaxResult navigateToPose(@RequestBody @Validated EdgeAgvNavigateToPoseVO vo) {
|
||||
Agv.AgvPose2d pose = Agv.AgvPose2d.newBuilder()
|
||||
AgvUtils.AgvPose2d pose = AgvUtils.AgvPose2d.newBuilder()
|
||||
.setX(vo.getX())
|
||||
.setY(vo.getY())
|
||||
.setTheta(vo.getTheta())
|
||||
@ -149,7 +161,7 @@ public class EdgeAgvController {
|
||||
@ApiOperation("设置速度")
|
||||
@PostMapping("/setVelocity")
|
||||
public AjaxResult setVelocity(@RequestBody @Validated EdgeAgvVelocityVO vo) {
|
||||
Agv.AgvVelocity velocity = Agv.AgvVelocity.newBuilder()
|
||||
AgvUtils.AgvVelocity velocity = AgvUtils.AgvVelocity.newBuilder()
|
||||
.setVx(vo.getVx())
|
||||
.setVy(vo.getVy())
|
||||
.setWz(vo.getWz())
|
||||
@ -173,7 +185,12 @@ public class EdgeAgvController {
|
||||
*/
|
||||
@ApiOperation("列出所有地图")
|
||||
@GetMapping("/listMaps")
|
||||
public AjaxResult listMaps(@Validated EdgeCommonVO vo) {
|
||||
public AjaxResult listMaps(
|
||||
@ApiParam(value = "终端设备ID", required = true)
|
||||
@RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true)
|
||||
@RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO vo = commonVo(terminalId, deviceId);
|
||||
List<String> maps = edgeAgvService.listMaps(vo);
|
||||
return AjaxResult.ok(maps);
|
||||
}
|
||||
@ -183,10 +200,15 @@ public class EdgeAgvController {
|
||||
*/
|
||||
@ApiOperation("列出所有站点")
|
||||
@GetMapping("/listStations")
|
||||
public AjaxResult listStations(@Validated EdgeCommonVO vo) {
|
||||
List<Agv.AgvStation> stations = edgeAgvService.listStations(vo);
|
||||
public AjaxResult listStations(
|
||||
@ApiParam(value = "终端设备ID", required = true)
|
||||
@RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true)
|
||||
@RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO vo = commonVo(terminalId, deviceId);
|
||||
List<AgvUtils.AgvStation> stations = edgeAgvService.listStations(vo);
|
||||
List<Map<String, Object>> stationList = new ArrayList<>();
|
||||
for (Agv.AgvStation station : stations) {
|
||||
for (AgvUtils.AgvStation station : stations) {
|
||||
stationList.add(toStationMap(station));
|
||||
}
|
||||
return AjaxResult.ok(stationList);
|
||||
@ -217,7 +239,17 @@ public class EdgeAgvController {
|
||||
*/
|
||||
@ApiOperation("下载地图")
|
||||
@GetMapping("/downloadMap")
|
||||
public AjaxResult downloadMap(@Validated EdgeAgvMapNameVO vo) {
|
||||
public AjaxResult downloadMap(
|
||||
@ApiParam(value = "终端设备ID", required = true)
|
||||
@RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true)
|
||||
@RequestParam("deviceId") String deviceId,
|
||||
@ApiParam(value = "地图名称", required = true)
|
||||
@RequestParam("mapName") String mapName) {
|
||||
EdgeAgvMapNameVO vo = new EdgeAgvMapNameVO();
|
||||
vo.setTerminalId(terminalId);
|
||||
vo.setDeviceId(deviceId);
|
||||
vo.setMapName(mapName);
|
||||
String content = edgeAgvService.downloadMap(vo, vo.getMapName());
|
||||
return AjaxResult.ok(content);
|
||||
}
|
||||
@ -228,7 +260,7 @@ public class EdgeAgvController {
|
||||
@ApiOperation("开始建图")
|
||||
@PostMapping("/startMapping")
|
||||
public AjaxResult startMapping(@RequestBody @Validated EdgeAgvStartMappingVO vo) {
|
||||
Agv.AgvMapDimension mapDimension = Agv.AgvMapDimension.forNumber(vo.getDimension());
|
||||
AgvUtils.AgvMapDimension mapDimension = AgvUtils.AgvMapDimension.forNumber(vo.getDimension());
|
||||
if (mapDimension == null) {
|
||||
return AjaxResult.error("建图维度不合法,允许值:0=未指定,1=2D,2=3D,3=2D+3D");
|
||||
}
|
||||
@ -252,7 +284,14 @@ public class EdgeAgvController {
|
||||
/**
|
||||
* 将 protobuf 运行时状态转换为前端友好的 Map,避免直接暴露 protobuf 对象结构。
|
||||
*/
|
||||
private Map<String, Object> toRuntimeStateMap(Agv.AgvRuntimeState state) {
|
||||
private EdgeCommonVO commonVo(String terminalId, String deviceId) {
|
||||
EdgeCommonVO vo = new EdgeCommonVO();
|
||||
vo.setTerminalId(terminalId);
|
||||
vo.setDeviceId(deviceId);
|
||||
return vo;
|
||||
}
|
||||
|
||||
private Map<String, Object> toRuntimeStateMap(AgvUtils.AgvRuntimeState state) {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("timestamp", state.getTimestamp());
|
||||
resultMap.put("mode", state.getMode());
|
||||
@ -291,7 +330,7 @@ public class EdgeAgvController {
|
||||
/**
|
||||
* 将 protobuf 站点对象转换为普通 Map。
|
||||
*/
|
||||
private Map<String, Object> toStationMap(Agv.AgvStation station) {
|
||||
private Map<String, Object> toStationMap(AgvUtils.AgvStation station) {
|
||||
Map<String, Object> stationMap = new HashMap<>();
|
||||
stationMap.put("id", station.getId());
|
||||
stationMap.put("type", station.getType());
|
||||
@ -305,7 +344,7 @@ public class EdgeAgvController {
|
||||
/**
|
||||
* 将 protobuf 二维位姿转换为普通 Map。
|
||||
*/
|
||||
private Map<String, Object> toPoseMap(Agv.AgvPose2d pose) {
|
||||
private Map<String, Object> toPoseMap(AgvUtils.AgvPose2d pose) {
|
||||
Map<String, Object> poseMap = new HashMap<>();
|
||||
poseMap.put("x", pose.getX());
|
||||
poseMap.put("y", pose.getY());
|
||||
|
||||
@ -7,12 +7,13 @@ import com.cmvr.edge.client.model.arm.*;
|
||||
import com.cmvr.edge.client.service.EdgeArmService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
@ -31,14 +32,20 @@ public class EdgeArmController {
|
||||
|
||||
@ApiOperation("关闭力矩")
|
||||
@GetMapping("/torqueOff")
|
||||
public AjaxResult torqueOff(EdgeCommonVO vo) {
|
||||
public AjaxResult torqueOff(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO vo = commonVo(terminalId, deviceId);
|
||||
edgeArmService.torqueOff(vo);
|
||||
return AjaxResult.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("开启力矩")
|
||||
@GetMapping("/torqueOn")
|
||||
public AjaxResult torqueOn(EdgeCommonVO vo) {
|
||||
public AjaxResult torqueOn(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO vo = commonVo(terminalId, deviceId);
|
||||
edgeArmService.torqueOn(vo);
|
||||
return AjaxResult.ok();
|
||||
}
|
||||
@ -48,7 +55,10 @@ public class EdgeArmController {
|
||||
*/
|
||||
@ApiOperation("清除故障")
|
||||
@GetMapping("/clearFault")
|
||||
public AjaxResult clearFault(EdgeCommonVO vo) {
|
||||
public AjaxResult clearFault(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO vo = commonVo(terminalId, deviceId);
|
||||
edgeArmService.clearFault(vo);
|
||||
return AjaxResult.ok();
|
||||
}
|
||||
@ -126,14 +136,20 @@ public class EdgeArmController {
|
||||
|
||||
@ApiOperation("停止运动")
|
||||
@GetMapping("/stopMotion")
|
||||
public AjaxResult stopMotion(EdgeCommonVO vo) {
|
||||
public AjaxResult stopMotion(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO vo = commonVo(terminalId, deviceId);
|
||||
edgeArmService.stopMotion(vo);
|
||||
return AjaxResult.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("获取关节状态")
|
||||
@GetMapping("/getJointState")
|
||||
public AjaxResult getJointState(EdgeCommonVO vo) {
|
||||
public AjaxResult getJointState(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO vo = commonVo(terminalId, deviceId);
|
||||
ArmCommand.JointResponse result = edgeArmService.getJointState(vo);
|
||||
ArmCommand.JointState state = result.getState();
|
||||
|
||||
@ -150,7 +166,12 @@ public class EdgeArmController {
|
||||
|
||||
@ApiOperation("获取末端位姿")
|
||||
@GetMapping("/getPose")
|
||||
public AjaxResult getPose(@Validated EdgeArmPoseQueryVO vo) {
|
||||
public AjaxResult getPose(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId,
|
||||
@ApiParam("基座连杆名称") @RequestParam(value = "baseLink", required = false) String baseLink,
|
||||
@ApiParam("末端执行器连杆名称") @RequestParam(value = "eeLink", required = false) String eeLink) {
|
||||
EdgeArmPoseQueryVO vo = poseQueryVo(terminalId, deviceId, baseLink, eeLink);
|
||||
ArmCommand.GetPose.Response result = edgeArmService.getPose(vo, vo.getBaseLink(), vo.getEeLink());
|
||||
ArmCommand.CartesianPose pose = result.getPose();
|
||||
|
||||
@ -168,14 +189,26 @@ public class EdgeArmController {
|
||||
|
||||
@ApiOperation("标定零点")
|
||||
@GetMapping("/calibrateZeroQ")
|
||||
public AjaxResult calibrateZeroQ(@Validated EdgeArmCalibrateZeroQVO vo) {
|
||||
public AjaxResult calibrateZeroQ(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId,
|
||||
@ApiParam(value = "关节名称", required = true) @RequestParam("jointName") String jointName) {
|
||||
EdgeArmCalibrateZeroQVO vo = new EdgeArmCalibrateZeroQVO();
|
||||
vo.setTerminalId(terminalId);
|
||||
vo.setDeviceId(deviceId);
|
||||
vo.setJointName(jointName);
|
||||
edgeArmService.calibrateZeroQ(vo, vo.getJointName());
|
||||
return AjaxResult.ok();
|
||||
}
|
||||
|
||||
@ApiOperation("获取位姿矩阵")
|
||||
@GetMapping("/getPoseMatrix")
|
||||
public AjaxResult getPoseMatrix(@Validated EdgeArmPoseQueryVO vo) {
|
||||
public AjaxResult getPoseMatrix(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId,
|
||||
@ApiParam("基座连杆名称") @RequestParam(value = "baseLink", required = false) String baseLink,
|
||||
@ApiParam("末端执行器连杆名称") @RequestParam(value = "eeLink", required = false) String eeLink) {
|
||||
EdgeArmPoseQueryVO vo = poseQueryVo(terminalId, deviceId, baseLink, eeLink);
|
||||
ArmCommand.GetPoseMatrix.Response result = edgeArmService.getPoseMatrix(vo, vo.getBaseLink(), vo.getEeLink());
|
||||
// 将TransformMatrix4x4转换为Map
|
||||
ArmCommand.TransformMatrix4x4 matrix = result.getMatrix();
|
||||
@ -229,4 +262,20 @@ public class EdgeArmController {
|
||||
matrixMap.put("m33", matrix.getM33());
|
||||
return AjaxResult.ok(matrixMap);
|
||||
}
|
||||
|
||||
private EdgeCommonVO commonVo(String terminalId, String deviceId) {
|
||||
EdgeCommonVO vo = new EdgeCommonVO();
|
||||
vo.setTerminalId(terminalId);
|
||||
vo.setDeviceId(deviceId);
|
||||
return vo;
|
||||
}
|
||||
|
||||
private EdgeArmPoseQueryVO poseQueryVo(String terminalId, String deviceId, String baseLink, String eeLink) {
|
||||
EdgeArmPoseQueryVO vo = new EdgeArmPoseQueryVO();
|
||||
vo.setTerminalId(terminalId);
|
||||
vo.setDeviceId(deviceId);
|
||||
vo.setBaseLink(baseLink);
|
||||
vo.setEeLink(eeLink);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,62 @@
|
||||
package com.cmvr.web.controller.api;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.cmvr.common.core.controller.BaseController;
|
||||
import com.cmvr.common.core.domain.AjaxResult;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopHeartbeatVO;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopOpenVO;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopSetpointVO;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopStopVO;
|
||||
import com.cmvr.edge.client.service.EdgeArmTeleopService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Api(tags = "Edge - Arm teleoperation")
|
||||
@RestController
|
||||
@RequestMapping("/api/edge/armTeleop")
|
||||
@RequiredArgsConstructor
|
||||
public class EdgeArmTeleopController extends BaseController {
|
||||
|
||||
private final EdgeArmTeleopService edgeArmTeleopService;
|
||||
|
||||
@ApiOperation("Open an arm teleoperation session")
|
||||
@PostMapping("/open")
|
||||
public AjaxResult open(@RequestBody EdgeArmTeleopOpenVO request) {
|
||||
return success(edgeArmTeleopService.open(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Send an arm joint setpoint")
|
||||
@PostMapping("/setpoint")
|
||||
public AjaxResult setpoint(@RequestBody EdgeArmTeleopSetpointVO request) {
|
||||
edgeArmTeleopService.sendSetpoint(request);
|
||||
return success();
|
||||
}
|
||||
|
||||
@ApiOperation("Send a teleoperation heartbeat")
|
||||
@PostMapping("/heartbeat")
|
||||
public AjaxResult heartbeat(@RequestBody EdgeArmTeleopHeartbeatVO request) {
|
||||
edgeArmTeleopService.heartbeat(request);
|
||||
return success();
|
||||
}
|
||||
|
||||
@ApiOperation("Get the latest teleoperation state")
|
||||
@GetMapping("/status")
|
||||
public AjaxResult status(@RequestParam("sessionId") String sessionId) {
|
||||
Object status = edgeArmTeleopService.getStatus(sessionId);
|
||||
return success(status == null ? null : JSON.toJSONString(status));
|
||||
}
|
||||
|
||||
@ApiOperation("Stop an arm teleoperation session")
|
||||
@PostMapping("/stop")
|
||||
public AjaxResult stop(@RequestBody EdgeArmTeleopStopVO request) {
|
||||
edgeArmTeleopService.stop(request);
|
||||
return success();
|
||||
}
|
||||
}
|
||||
@ -4,13 +4,24 @@ import com.alibaba.fastjson2.JSON;
|
||||
import com.cmvr.common.core.controller.BaseController;
|
||||
import com.cmvr.common.core.domain.AjaxResult;
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import com.cmvr.edge.client.model.camera.EdgeCameraPtzVO;
|
||||
import com.cmvr.edge.client.service.EdgeCameraService;
|
||||
import com.cmvr.web.service.CameraStreamTicketService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.http.CacheControl;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
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.servlet.mvc.method.annotation.StreamingResponseBody;
|
||||
|
||||
@Api(tags = "边缘--相机")
|
||||
@RestController
|
||||
@ -19,46 +30,127 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class EdgeCameraController extends BaseController {
|
||||
|
||||
private final EdgeCameraService edgeCameraService;
|
||||
private final CameraStreamTicketService cameraStreamTicketService;
|
||||
|
||||
@ApiOperation("获取相机状态")
|
||||
@GetMapping("/status")
|
||||
public AjaxResult status(EdgeCommonVO edgeCommonVO) {
|
||||
public AjaxResult status(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO edgeCommonVO = commonVo(terminalId, deviceId);
|
||||
return success(JSON.toJSONString(edgeCameraService.status(edgeCommonVO)));
|
||||
}
|
||||
|
||||
@ApiOperation("开启相机")
|
||||
@GetMapping("/start")
|
||||
public AjaxResult start(EdgeCommonVO edgeCommonVO) {
|
||||
public AjaxResult start(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO edgeCommonVO = commonVo(terminalId, deviceId);
|
||||
return success(edgeCameraService.start(edgeCommonVO));
|
||||
}
|
||||
|
||||
@ApiOperation("关闭相机")
|
||||
@GetMapping("/stop")
|
||||
public AjaxResult stop(EdgeCommonVO edgeCommonVO) {
|
||||
public AjaxResult stop(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO edgeCommonVO = commonVo(terminalId, deviceId);
|
||||
return success(edgeCameraService.stop(edgeCommonVO));
|
||||
}
|
||||
|
||||
@ApiOperation("获取图片")
|
||||
@GetMapping("/getRGBImage")
|
||||
public AjaxResult getRGBImage(EdgeCommonVO edgeCommonVO) {
|
||||
public AjaxResult getRGBImage(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO edgeCommonVO = commonVo(terminalId, deviceId);
|
||||
return success(edgeCameraService.getRGBImage(edgeCommonVO));
|
||||
}
|
||||
|
||||
@ApiOperation("Get one depth image")
|
||||
@GetMapping("/getDepthImage")
|
||||
public AjaxResult getDepthImage(
|
||||
@RequestParam("terminalId") String terminalId,
|
||||
@RequestParam("deviceId") String deviceId) {
|
||||
return success(edgeCameraService.getDepthImage(commonVo(terminalId, deviceId)));
|
||||
}
|
||||
|
||||
@ApiOperation("Control camera PTZ")
|
||||
@PostMapping("/controlPtz")
|
||||
public AjaxResult controlPtz(@RequestBody EdgeCameraPtzVO request) {
|
||||
return success(edgeCameraService.controlPtz(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Get a short-lived RGB video stream URL")
|
||||
@GetMapping("/rgb-stream-url")
|
||||
public AjaxResult rgbStreamUrl(
|
||||
@RequestParam("terminalId") String terminalId,
|
||||
@RequestParam("deviceId") String deviceId) {
|
||||
String ticket = cameraStreamTicketService.issue(terminalId, deviceId);
|
||||
return success((Object) ("/api/edge/camera/rgb-stream?ticket=" + ticket));
|
||||
}
|
||||
|
||||
@ApiOperation("RGB fragmented MP4 live stream")
|
||||
@GetMapping(value = "/rgb-stream", produces = "video/mp4")
|
||||
public ResponseEntity<StreamingResponseBody> rgbStream(@RequestParam("ticket") String ticket) {
|
||||
CameraStreamTicketService.StreamTarget target = cameraStreamTicketService.consume(ticket);
|
||||
if (target == null) {
|
||||
return ResponseEntity.status(HttpStatus.UNAUTHORIZED).build();
|
||||
}
|
||||
return videoStreamResponse(target.terminalId(), target.deviceId());
|
||||
}
|
||||
|
||||
@ApiOperation("Public RGB fragmented MP4 live stream")
|
||||
@GetMapping(value = "/rgb-stream/public", produces = "video/mp4")
|
||||
public ResponseEntity<StreamingResponseBody> publicRgbStream(
|
||||
@RequestParam("terminalId") String terminalId,
|
||||
@RequestParam("deviceId") String deviceId) {
|
||||
return videoStreamResponse(terminalId, deviceId);
|
||||
}
|
||||
|
||||
private ResponseEntity<StreamingResponseBody> videoStreamResponse(String terminalId, String deviceId) {
|
||||
StreamingResponseBody body = outputStream -> edgeCameraService.writeRGBVideoStream(
|
||||
terminalId, deviceId, outputStream);
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.parseMediaType("video/mp4"))
|
||||
.cacheControl(CacheControl.noStore())
|
||||
.header("X-Accel-Buffering", "no")
|
||||
.header("X-Content-Type-Options", "nosniff")
|
||||
.body(body);
|
||||
}
|
||||
|
||||
@ApiOperation("开始录制视频")
|
||||
@GetMapping("/startRecording")
|
||||
public AjaxResult startRecording(EdgeCommonVO edgeCommonVO) {
|
||||
public AjaxResult startRecording(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO edgeCommonVO = commonVo(terminalId, deviceId);
|
||||
return success(edgeCameraService.startRecording(edgeCommonVO));
|
||||
}
|
||||
|
||||
@ApiOperation("停止录制视频")
|
||||
@GetMapping("/stopRecording")
|
||||
public AjaxResult stopRecording(EdgeCommonVO edgeCommonVO) {
|
||||
public AjaxResult stopRecording(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO edgeCommonVO = commonVo(terminalId, deviceId);
|
||||
return success(edgeCameraService.stopRecording(edgeCommonVO));
|
||||
}
|
||||
|
||||
@ApiOperation("获取图片和视频")
|
||||
@GetMapping("/getRGBDImages")
|
||||
public AjaxResult getRGBDImages(EdgeCommonVO edgeCommonVO) {
|
||||
public AjaxResult getRGBDImages(
|
||||
@ApiParam(value = "终端设备ID", required = true) @RequestParam("terminalId") String terminalId,
|
||||
@ApiParam(value = "设备ID", required = true) @RequestParam("deviceId") String deviceId) {
|
||||
EdgeCommonVO edgeCommonVO = commonVo(terminalId, deviceId);
|
||||
return success(edgeCameraService.getRGBDImages(edgeCommonVO));
|
||||
}
|
||||
|
||||
private EdgeCommonVO commonVo(String terminalId, String deviceId) {
|
||||
EdgeCommonVO vo = new EdgeCommonVO();
|
||||
vo.setTerminalId(terminalId);
|
||||
vo.setDeviceId(deviceId);
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,114 @@
|
||||
package com.cmvr.web.controller.api;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.cmvr.common.core.controller.BaseController;
|
||||
import com.cmvr.common.core.domain.AjaxResult;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorCyclicOpenVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorCyclicSetpointVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorEnabledVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorMotionVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorTargetVO;
|
||||
import com.cmvr.edge.client.service.EdgeMotorService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Api(tags = "Edge - Motor")
|
||||
@RestController
|
||||
@RequestMapping("/api/edge/motor")
|
||||
@RequiredArgsConstructor
|
||||
public class EdgeMotorController extends BaseController {
|
||||
|
||||
private final EdgeMotorService edgeMotorService;
|
||||
|
||||
@ApiOperation("Set the current motor position as zero")
|
||||
@PostMapping("/setZero")
|
||||
public AjaxResult setZero(@RequestBody EdgeMotorTargetVO request) {
|
||||
return protobuf(edgeMotorService.setZero(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Move motor to zero")
|
||||
@PostMapping("/moveToZero")
|
||||
public AjaxResult moveToZero(@RequestBody EdgeMotorMotionVO request) {
|
||||
return protobuf(edgeMotorService.moveToZero(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Execute profile position control")
|
||||
@PostMapping("/profilePosition")
|
||||
public AjaxResult profilePosition(@RequestBody EdgeMotorMotionVO request) {
|
||||
return protobuf(edgeMotorService.profilePosition(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Execute profile velocity control")
|
||||
@PostMapping("/profileVelocity")
|
||||
public AjaxResult profileVelocity(@RequestBody EdgeMotorMotionVO request) {
|
||||
return protobuf(edgeMotorService.profileVelocity(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Emergency stop a motor")
|
||||
@PostMapping("/emergencyStop")
|
||||
public AjaxResult emergencyStop(@RequestBody EdgeMotorTargetVO request) {
|
||||
return protobuf(edgeMotorService.emergencyStop(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Get motor status")
|
||||
@PostMapping("/status")
|
||||
public AjaxResult status(@RequestBody EdgeMotorTargetVO request) {
|
||||
return protobuf(edgeMotorService.getStatus(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Enable or disable a motor")
|
||||
@PostMapping("/enabled")
|
||||
public AjaxResult enabled(@RequestBody EdgeMotorEnabledVO request) {
|
||||
return protobuf(edgeMotorService.setEnabled(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Open cyclic position stream")
|
||||
@PostMapping("/cyclicPosition/open")
|
||||
public AjaxResult openCyclicPosition(@RequestBody EdgeMotorCyclicOpenVO request) {
|
||||
return success(edgeMotorService.openCyclicPosition(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Send cyclic position setpoint")
|
||||
@PostMapping("/cyclicPosition/setpoint")
|
||||
public AjaxResult cyclicPosition(@RequestBody EdgeMotorCyclicSetpointVO request) {
|
||||
edgeMotorService.sendCyclicPosition(request);
|
||||
return success();
|
||||
}
|
||||
|
||||
@ApiOperation("Open cyclic velocity stream")
|
||||
@PostMapping("/cyclicVelocity/open")
|
||||
public AjaxResult openCyclicVelocity(@RequestBody EdgeMotorCyclicOpenVO request) {
|
||||
return success(edgeMotorService.openCyclicVelocity(request));
|
||||
}
|
||||
|
||||
@ApiOperation("Send cyclic velocity setpoint")
|
||||
@PostMapping("/cyclicVelocity/setpoint")
|
||||
public AjaxResult cyclicVelocity(@RequestBody EdgeMotorCyclicSetpointVO request) {
|
||||
edgeMotorService.sendCyclicVelocity(request);
|
||||
return success();
|
||||
}
|
||||
|
||||
@ApiOperation("Get the latest cyclic stream response")
|
||||
@GetMapping("/stream/status")
|
||||
public AjaxResult streamStatus(@RequestParam("sessionId") String sessionId) {
|
||||
return protobuf(edgeMotorService.getStreamStatus(sessionId));
|
||||
}
|
||||
|
||||
@ApiOperation("Close a cyclic stream")
|
||||
@PostMapping("/stream/close")
|
||||
public AjaxResult closeStream(@RequestParam("sessionId") String sessionId) {
|
||||
edgeMotorService.closeStream(sessionId);
|
||||
return success();
|
||||
}
|
||||
|
||||
private AjaxResult protobuf(Object value) {
|
||||
return success(value == null ? null : JSON.toJSONString(value));
|
||||
}
|
||||
}
|
||||
@ -1,12 +1,18 @@
|
||||
package com.cmvr.web.controller.api;
|
||||
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.cmvr.common.core.controller.BaseController;
|
||||
import com.cmvr.common.core.domain.AjaxResult;
|
||||
import com.cmvr.edge.client.model.system.EdgeSystemJsonCommandVO;
|
||||
import com.cmvr.edge.client.model.system.EdgeSystemUpdateParamsVO;
|
||||
import com.cmvr.edge.client.service.EdgeSystemService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@ -18,9 +24,33 @@ public class EdgeSystemController extends BaseController {
|
||||
|
||||
private final EdgeSystemService edgeSystemService;
|
||||
|
||||
@ApiOperation("Get edge system information")
|
||||
@GetMapping("/info")
|
||||
public AjaxResult info(@RequestParam("terminalId") String terminalId) {
|
||||
return success(JSON.toJSONString(edgeSystemService.getSystemInfo(terminalId)));
|
||||
}
|
||||
|
||||
@ApiOperation("Get edge system runtime status")
|
||||
@GetMapping("/status")
|
||||
public AjaxResult status(@RequestParam("terminalId") String terminalId) {
|
||||
return success(JSON.toJSONString(edgeSystemService.getSystemStatus(terminalId)));
|
||||
}
|
||||
|
||||
@ApiOperation("Update edge device parameters")
|
||||
@PostMapping("/params")
|
||||
public AjaxResult updateParams(@RequestBody EdgeSystemUpdateParamsVO request) {
|
||||
return success(JSON.toJSONString(edgeSystemService.updateParams(request)));
|
||||
}
|
||||
|
||||
@ApiOperation("Execute a JSON device command")
|
||||
@PostMapping("/executeJsonCommand")
|
||||
public AjaxResult executeJsonCommand(@RequestBody EdgeSystemJsonCommandVO request) {
|
||||
return success(JSON.toJSONString(edgeSystemService.executeJsonCommand(request)));
|
||||
}
|
||||
|
||||
@ApiOperation("停止所有设备")
|
||||
@GetMapping("/stopAll")
|
||||
public AjaxResult stopAll(String terminalId) {
|
||||
public AjaxResult stopAll(@RequestParam("terminalId") String terminalId) {
|
||||
return AjaxResult.ok(edgeSystemService.stopAll(terminalId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ package com.cmvr.web.controller.inspection;
|
||||
import java.util.List;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
|
||||
import cmvr.msgs.Agv;
|
||||
import cmvr.msgs.AgvUtils;
|
||||
import com.cmvr.inspection.domain.vo.InspectionRobotVo;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
@ -180,7 +180,7 @@ public class InspectionRobotController extends BaseController
|
||||
@GetMapping("/{robotId}/location")
|
||||
public AjaxResult getRobotRealtimeLocation(@PathVariable String robotId)
|
||||
{
|
||||
Agv.AgvPose2d location = inspectionRobotService.getRobotRealtimeLocation(robotId);
|
||||
AgvUtils.AgvPose2d location = inspectionRobotService.getRobotRealtimeLocation(robotId);
|
||||
return success(location);
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +157,8 @@ public class TeFlowController extends BaseController {
|
||||
|
||||
@PostMapping("/action")
|
||||
@ApiOperation(value = "单个节点执行",
|
||||
notes = "巡检仪表节点action=INSPECTION_METER_RECOGNIZE,payload使用InspectionMeterRecognizeConfigVO;"
|
||||
notes = "设备通用指令action=DEVICE_EXECUTE_JSON_COMMAND,payload需要terminalId、deviceId、requestJson;"
|
||||
+ "巡检仪表节点action=INSPECTION_METER_RECOGNIZE,payload使用InspectionMeterRecognizeConfigVO;"
|
||||
+ "人工判断节点action=INSPECTION_MANUAL_REVIEW_CREATE,payload使用InspectionManualReviewConfigVO。"
|
||||
+ "该接口用于试调节点,不会生成正式巡检任务结果")
|
||||
public AjaxResult actionExecute(
|
||||
|
||||
@ -0,0 +1,38 @@
|
||||
package com.cmvr.web.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@Service
|
||||
public class CameraStreamTicketService {
|
||||
|
||||
private static final long TICKET_LIFETIME_MILLIS = Duration.ofSeconds(30).toMillis();
|
||||
private final Map<String, StreamTarget> tickets = new ConcurrentHashMap<>();
|
||||
|
||||
public String issue(String terminalId, String deviceId) {
|
||||
long now = System.currentTimeMillis();
|
||||
tickets.entrySet().removeIf(entry -> entry.getValue().expiresAt() < now);
|
||||
String ticket = UUID.randomUUID().toString().replace("-", "");
|
||||
tickets.put(ticket, new StreamTarget(terminalId, deviceId, now + TICKET_LIFETIME_MILLIS));
|
||||
return ticket;
|
||||
}
|
||||
|
||||
public StreamTarget consume(String ticket) {
|
||||
if (ticket == null || ticket.isBlank()) {
|
||||
return null;
|
||||
}
|
||||
StreamTarget target = tickets.get(ticket);
|
||||
if (target == null || target.expiresAt() < System.currentTimeMillis()) {
|
||||
tickets.remove(ticket);
|
||||
return null;
|
||||
}
|
||||
return target;
|
||||
}
|
||||
|
||||
public record StreamTarget(String terminalId, String deviceId, long expiresAt) {
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
package com.cmvr.edge.client.manage;
|
||||
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
|
||||
/** Maintains independently addressable bidirectional gRPC streams for HTTP clients. */
|
||||
public class GrpcBidiSessionRegistry<Req, Resp> {
|
||||
|
||||
private final ConcurrentMap<String, Session<Req, Resp>> sessions = new ConcurrentHashMap<>();
|
||||
|
||||
public String open(Function<StreamObserver<Resp>, StreamObserver<Req>> opener, Req initialRequest) {
|
||||
String sessionId = UUID.randomUUID().toString();
|
||||
Session<Req, Resp> session = new Session<>();
|
||||
StreamObserver<Resp> responseObserver = new StreamObserver<Resp>() {
|
||||
@Override
|
||||
public void onNext(Resp value) {
|
||||
session.latest.set(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable throwable) {
|
||||
session.error.set(throwable);
|
||||
session.completed.set(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
session.completed.set(true);
|
||||
}
|
||||
};
|
||||
session.requestObserver = opener.apply(responseObserver);
|
||||
sessions.put(sessionId, session);
|
||||
try {
|
||||
session.requestObserver.onNext(initialRequest);
|
||||
} catch (RuntimeException exception) {
|
||||
sessions.remove(sessionId);
|
||||
throw exception;
|
||||
}
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void send(String sessionId, Req request) {
|
||||
Session<Req, Resp> session = require(sessionId);
|
||||
checkAvailable(sessionId, session);
|
||||
session.requestObserver.onNext(request);
|
||||
}
|
||||
|
||||
public Resp getLatest(String sessionId) {
|
||||
Session<Req, Resp> session = require(sessionId);
|
||||
Throwable error = session.error.get();
|
||||
if (error != null) {
|
||||
throw new GlobalException("gRPC stream failed: " + error.getMessage());
|
||||
}
|
||||
return session.latest.get();
|
||||
}
|
||||
|
||||
public void close(String sessionId) {
|
||||
Session<Req, Resp> session = sessions.remove(sessionId);
|
||||
if (session == null) {
|
||||
throw new GlobalException("Unknown stream session: " + sessionId);
|
||||
}
|
||||
if (!session.completed.get()) {
|
||||
session.requestObserver.onCompleted();
|
||||
session.completed.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
private Session<Req, Resp> require(String sessionId) {
|
||||
if (sessionId == null || sessionId.trim().isEmpty()) {
|
||||
throw new GlobalException("Stream session ID cannot be empty");
|
||||
}
|
||||
Session<Req, Resp> session = sessions.get(sessionId);
|
||||
if (session == null) {
|
||||
throw new GlobalException("Unknown stream session: " + sessionId);
|
||||
}
|
||||
return session;
|
||||
}
|
||||
|
||||
private void checkAvailable(String sessionId, Session<Req, Resp> session) {
|
||||
Throwable error = session.error.get();
|
||||
if (error != null) {
|
||||
throw new GlobalException("gRPC stream failed: " + error.getMessage());
|
||||
}
|
||||
if (session.completed.get()) {
|
||||
throw new GlobalException("gRPC stream is already completed: " + sessionId);
|
||||
}
|
||||
}
|
||||
|
||||
private static final class Session<Req, Resp> {
|
||||
private StreamObserver<Req> requestObserver;
|
||||
private final AtomicReference<Resp> latest = new AtomicReference<>();
|
||||
private final AtomicReference<Throwable> error = new AtomicReference<>();
|
||||
private final AtomicBoolean completed = new AtomicBoolean();
|
||||
}
|
||||
}
|
||||
@ -1,8 +1,8 @@
|
||||
package com.cmvr.edge.client.manage;
|
||||
|
||||
import cmvr.api.*;
|
||||
import cmvr.api.armteleop.v1.ArmTeleopServiceGrpc;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.cmvr.device.domain.DeDeviceTerminalConfig;
|
||||
import com.cmvr.device.service.IDeDeviceTerminalConfigService;
|
||||
import io.grpc.ManagedChannel;
|
||||
@ -13,6 +13,7 @@ import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.*;
|
||||
import java.util.function.Function;
|
||||
@ -61,6 +62,9 @@ public class GrpcServiceManager {
|
||||
clientFactories.put(HlcServiceGrpc.HlcServiceBlockingStub.class, new GrpcClientFactory<>(HlcServiceGrpc::newBlockingStub));
|
||||
// 注册agv服务的stub
|
||||
clientFactories.put(AgvServiceGrpc.AgvServiceBlockingStub.class, new GrpcClientFactory<>(AgvServiceGrpc::newBlockingStub));
|
||||
clientFactories.put(MotorServiceGrpc.MotorServiceBlockingStub.class, new GrpcClientFactory<>(MotorServiceGrpc::newBlockingStub));
|
||||
clientFactories.put(MotorServiceGrpc.MotorServiceStub.class, new GrpcClientFactory<>(MotorServiceGrpc::newStub));
|
||||
clientFactories.put(ArmTeleopServiceGrpc.ArmTeleopServiceStub.class, new GrpcClientFactory<>(ArmTeleopServiceGrpc::newStub));
|
||||
// 注册机器人实时语音双向流服务的异步Stub
|
||||
}
|
||||
|
||||
@ -84,8 +88,8 @@ public class GrpcServiceManager {
|
||||
* 创建gRPC通道
|
||||
*/
|
||||
private ManagedChannel createChannel(String terminalId) {
|
||||
String grpcAddress = getGrpcServiceAddress(terminalId);
|
||||
return ManagedChannelBuilder.forTarget(grpcAddress)
|
||||
InetSocketAddress endpoint = getGrpcServiceEndpoint(terminalId);
|
||||
return ManagedChannelBuilder.forAddress(endpoint.getHostString(), endpoint.getPort())
|
||||
.usePlaintext()
|
||||
.maxInboundMessageSize(50 * 1024 * 1024) // 50MB
|
||||
.build();
|
||||
@ -94,12 +98,69 @@ public class GrpcServiceManager {
|
||||
/**
|
||||
* 获取终端地址
|
||||
*/
|
||||
private String getGrpcServiceAddress(String terminalId) {
|
||||
private InetSocketAddress getGrpcServiceEndpoint(String terminalId) {
|
||||
DeDeviceTerminalConfig terminal = deviceTerminalConfigService.selectDeDeviceTerminalConfigById(terminalId);
|
||||
if (ObjUtil.isEmpty(terminal)) {
|
||||
return DEFAULT_GRPC_ADDRESS;
|
||||
return parseGrpcAddress(DEFAULT_GRPC_ADDRESS);
|
||||
}
|
||||
return StrUtil.format("static://{}:{}", terminal.getHost(), terminal.getPort());
|
||||
return createEndpoint(terminal.getHost(), terminal.getPort(), "终端 " + terminalId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 兼容原有 static://host:port 配置,但使用主机和端口直接创建通道。
|
||||
*/
|
||||
static InetSocketAddress parseGrpcAddress(String address) {
|
||||
if (address == null || address.trim().isEmpty()) {
|
||||
throw new IllegalArgumentException("gRPC 默认地址不能为空");
|
||||
}
|
||||
|
||||
String endpoint = address.trim();
|
||||
int schemeIndex = endpoint.indexOf("://");
|
||||
if (schemeIndex >= 0) {
|
||||
endpoint = endpoint.substring(schemeIndex + 3);
|
||||
}
|
||||
while (endpoint.startsWith("/")) {
|
||||
endpoint = endpoint.substring(1);
|
||||
}
|
||||
|
||||
String host;
|
||||
String portText;
|
||||
if (endpoint.startsWith("[")) {
|
||||
int bracketEnd = endpoint.indexOf(']');
|
||||
if (bracketEnd < 0 || bracketEnd + 1 >= endpoint.length() || endpoint.charAt(bracketEnd + 1) != ':') {
|
||||
throw invalidGrpcAddress(address);
|
||||
}
|
||||
host = endpoint.substring(1, bracketEnd);
|
||||
portText = endpoint.substring(bracketEnd + 2);
|
||||
} else {
|
||||
int portSeparator = endpoint.lastIndexOf(':');
|
||||
if (portSeparator <= 0 || portSeparator == endpoint.length() - 1) {
|
||||
throw invalidGrpcAddress(address);
|
||||
}
|
||||
host = endpoint.substring(0, portSeparator);
|
||||
portText = endpoint.substring(portSeparator + 1);
|
||||
}
|
||||
|
||||
try {
|
||||
return createEndpoint(host, Long.parseLong(portText), "默认配置");
|
||||
} catch (NumberFormatException exception) {
|
||||
throw invalidGrpcAddress(address);
|
||||
}
|
||||
}
|
||||
|
||||
private static InetSocketAddress createEndpoint(String host, Long port, String source) {
|
||||
String normalizedHost = host == null ? "" : host.trim();
|
||||
if (normalizedHost.isEmpty()) {
|
||||
throw new IllegalArgumentException(source + " 的 gRPC 主机不能为空");
|
||||
}
|
||||
if (port == null || port <= 0 || port > 65535) {
|
||||
throw new IllegalArgumentException(source + " 的 gRPC 端口无效: " + port);
|
||||
}
|
||||
return InetSocketAddress.createUnresolved(normalizedHost, port.intValue());
|
||||
}
|
||||
|
||||
private static IllegalArgumentException invalidGrpcAddress(String address) {
|
||||
return new IllegalArgumentException("gRPC 默认地址格式无效: " + address + ",应为 static://host:port 或 host:port");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -0,0 +1,9 @@
|
||||
package com.cmvr.edge.client.model.armteleop;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EdgeArmTeleopHeartbeatVO {
|
||||
private String sessionId;
|
||||
private long sequence;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.cmvr.edge.client.model.armteleop;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class EdgeArmTeleopOpenVO {
|
||||
private String terminalId;
|
||||
private Integer protocolMajor;
|
||||
private Integer protocolMinor;
|
||||
private String clientInstanceId;
|
||||
private String robotId;
|
||||
private String modelSha256;
|
||||
private String calibrationSha256;
|
||||
private List<String> jointNames;
|
||||
private String positionUnit;
|
||||
private String velocityUnit;
|
||||
private String effortUnit;
|
||||
private String baseFrame;
|
||||
private String toolFrame;
|
||||
private Integer commandRateHz;
|
||||
private Integer stateRateHz;
|
||||
private Integer watchdogTimeoutMs;
|
||||
private Integer leaseMs;
|
||||
private boolean forceFeedback;
|
||||
}
|
||||
@ -0,0 +1,12 @@
|
||||
package com.cmvr.edge.client.model.armteleop;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EdgeArmTeleopSetpointVO {
|
||||
private String sessionId;
|
||||
private long sequence;
|
||||
private double[] positionRad;
|
||||
private double[] velocityRadS;
|
||||
private Integer validForUs;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.cmvr.edge.client.model.armteleop;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EdgeArmTeleopStopVO {
|
||||
private String sessionId;
|
||||
private String reason;
|
||||
private String detail;
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.cmvr.edge.client.model.camera;
|
||||
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("Camera PTZ control parameters")
|
||||
public class EdgeCameraPtzVO extends EdgeCommonVO {
|
||||
|
||||
@ApiModelProperty(value = "PTZ command, for example PAN_LEFT or ZOOM_IN", required = true)
|
||||
private String command;
|
||||
|
||||
@ApiModelProperty(value = "Action: START or STOP", required = true)
|
||||
private String action;
|
||||
|
||||
@ApiModelProperty("Movement speed")
|
||||
private Integer speed;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.cmvr.edge.client.model.motor;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EdgeMotorCyclicOpenVO extends EdgeMotorTargetVO {
|
||||
private Integer watchdogTimeoutMs;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.cmvr.edge.client.model.motor;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EdgeMotorCyclicSetpointVO {
|
||||
@ApiModelProperty(value = "Session ID returned by the open endpoint", required = true)
|
||||
private String sessionId;
|
||||
private long sequence;
|
||||
private Double targetPositionRad;
|
||||
private Double targetVelocityRadS;
|
||||
}
|
||||
@ -0,0 +1,10 @@
|
||||
package com.cmvr.edge.client.model.motor;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EdgeMotorEnabledVO extends EdgeMotorTargetVO {
|
||||
private boolean enabled;
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.cmvr.edge.client.model.motor;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EdgeMotorMotionVO extends EdgeMotorTargetVO {
|
||||
private Double targetPositionRad;
|
||||
private Double targetVelocityRadS;
|
||||
private Double maxVelocityRadS;
|
||||
private Double accelerationRadS2;
|
||||
private Integer timeoutMs;
|
||||
private Integer pollPeriodMs;
|
||||
private Double positionToleranceRad;
|
||||
private Double velocityToleranceRadS;
|
||||
private Integer settleSampleCount;
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package com.cmvr.edge.client.model.motor;
|
||||
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("Motor target")
|
||||
public class EdgeMotorTargetVO extends EdgeCommonVO {
|
||||
|
||||
@ApiModelProperty("Motor numeric ID; use either motorId or jointName")
|
||||
private Integer motorId;
|
||||
|
||||
@ApiModelProperty("Joint name; use either motorId or jointName")
|
||||
private String jointName;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.cmvr.edge.client.model.system;
|
||||
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("System JSON device command")
|
||||
public class EdgeSystemJsonCommandVO extends EdgeCommonVO {
|
||||
|
||||
@ApiModelProperty(value = "JSON request passed to the target device", required = true)
|
||||
private String requestJson;
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package com.cmvr.edge.client.model.system;
|
||||
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel("System configuration update")
|
||||
public class EdgeSystemUpdateParamsVO extends EdgeCommonVO {
|
||||
|
||||
@ApiModelProperty(value = "Configuration parameters", required = true)
|
||||
private List<Param> params;
|
||||
|
||||
@Data
|
||||
@ApiModel("Typed configuration parameter")
|
||||
public static class Param {
|
||||
@ApiModelProperty(value = "Parameter name", required = true)
|
||||
private String name;
|
||||
private Integer intValue;
|
||||
private Double doubleValue;
|
||||
private String stringValue;
|
||||
private Boolean boolValue;
|
||||
@ApiModelProperty("Base64 encoded byte value")
|
||||
private String bytesBase64;
|
||||
}
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
package com.cmvr.edge.client.service;
|
||||
|
||||
import cmvr.msgs.Agv;
|
||||
import cmvr.msgs.Agv.AgvRuntimeState;
|
||||
import cmvr.msgs.AgvUtils;
|
||||
import cmvr.msgs.AgvUtils.AgvRuntimeState;
|
||||
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
|
||||
@ -29,7 +29,7 @@ public interface EdgeAgvService {
|
||||
* @param edgeCommonVO 边缘通用参数
|
||||
* @return 导航状态
|
||||
*/
|
||||
Agv.AgvNavigationStatus getNavigationStatus(EdgeCommonVO edgeCommonVO);
|
||||
AgvUtils.AgvNavigationStatus getNavigationStatus(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
/**
|
||||
* 紧急停止
|
||||
@ -51,7 +51,7 @@ public interface EdgeAgvService {
|
||||
* @param edgeCommonVO 边缘通用参数
|
||||
* @param pose 目标位姿
|
||||
*/
|
||||
void navigateToPose(EdgeCommonVO edgeCommonVO, Agv.AgvPose2d pose);
|
||||
void navigateToPose(EdgeCommonVO edgeCommonVO, AgvUtils.AgvPose2d pose);
|
||||
|
||||
/**
|
||||
* 导航到站点
|
||||
@ -67,7 +67,7 @@ public interface EdgeAgvService {
|
||||
* @param edgeCommonVO 边缘通用参数
|
||||
* @param pathSegments 路径段列表
|
||||
*/
|
||||
void followPath(EdgeCommonVO edgeCommonVO, List<Agv.AgvPathSegment> pathSegments);
|
||||
void followPath(EdgeCommonVO edgeCommonVO, List<AgvUtils.AgvPathSegment> pathSegments);
|
||||
|
||||
/**
|
||||
* 暂停导航
|
||||
@ -96,7 +96,7 @@ public interface EdgeAgvService {
|
||||
* @param edgeCommonVO 边缘通用参数
|
||||
* @param velocity 速度
|
||||
*/
|
||||
void setVelocity(EdgeCommonVO edgeCommonVO, Agv.AgvVelocity velocity);
|
||||
void setVelocity(EdgeCommonVO edgeCommonVO, AgvUtils.AgvVelocity velocity);
|
||||
|
||||
/**
|
||||
* 停止速度控制
|
||||
@ -119,7 +119,7 @@ public interface EdgeAgvService {
|
||||
* @param edgeCommonVO 边缘通用参数
|
||||
* @return 站点列表
|
||||
*/
|
||||
List<Agv.AgvStation> listStations(EdgeCommonVO edgeCommonVO);
|
||||
List<AgvUtils.AgvStation> listStations(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
/**
|
||||
* 切换地图
|
||||
@ -156,7 +156,7 @@ public interface EdgeAgvService {
|
||||
* @param realTime 是否实时建图
|
||||
* @return 会话ID
|
||||
*/
|
||||
String startMapping(EdgeCommonVO edgeCommonVO, Agv.AgvMapDimension dimension, String mapName, boolean realTime);
|
||||
String startMapping(EdgeCommonVO edgeCommonVO, AgvUtils.AgvMapDimension dimension, String mapName, boolean realTime);
|
||||
|
||||
/**
|
||||
* 停止建图
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
package com.cmvr.edge.client.service;
|
||||
|
||||
import cmvr.api.armteleop.v1.ArmTeleopV1;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopHeartbeatVO;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopOpenVO;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopSetpointVO;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopStopVO;
|
||||
|
||||
public interface EdgeArmTeleopService {
|
||||
String open(EdgeArmTeleopOpenVO request);
|
||||
|
||||
void sendSetpoint(EdgeArmTeleopSetpointVO request);
|
||||
|
||||
void heartbeat(EdgeArmTeleopHeartbeatVO request);
|
||||
|
||||
ArmTeleopV1.ServerFrame getStatus(String sessionId);
|
||||
|
||||
void stop(EdgeArmTeleopStopVO request);
|
||||
}
|
||||
@ -2,8 +2,11 @@ package com.cmvr.edge.client.service;
|
||||
|
||||
import cmvr.api.CameraCommand;
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import com.cmvr.edge.client.model.camera.EdgeCameraPtzVO;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
|
||||
import java.io.OutputStream;
|
||||
|
||||
/**
|
||||
* 边缘系统摄像头服务
|
||||
*/
|
||||
@ -34,6 +37,8 @@ public interface EdgeCameraService {
|
||||
*/
|
||||
public String getRGBImage(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
String getDepthImage(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
/**
|
||||
* 开始录制视频
|
||||
*/
|
||||
@ -49,8 +54,14 @@ public interface EdgeCameraService {
|
||||
*/
|
||||
public String getRGBDImages(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
String controlPtz(EdgeCameraPtzVO ptzVO);
|
||||
|
||||
StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request> getRGBImageStream(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request> getRGBImageStream(String terminalId, String deviceId);
|
||||
|
||||
void writeRGBVideoStream(String terminalId, String deviceId, OutputStream outputStream);
|
||||
|
||||
void getDepthImageStream(EdgeCommonVO edgeCommonVO);
|
||||
void getRGBDImagesStream(EdgeCommonVO edgeCommonVO);
|
||||
|
||||
|
||||
@ -0,0 +1,36 @@
|
||||
package com.cmvr.edge.client.service;
|
||||
|
||||
import cmvr.api.MotorCommand;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorCyclicOpenVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorCyclicSetpointVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorEnabledVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorMotionVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorTargetVO;
|
||||
|
||||
public interface EdgeMotorService {
|
||||
MotorCommand.MotorCommandResponse setZero(EdgeMotorTargetVO request);
|
||||
|
||||
MotorCommand.MotorCommandResponse moveToZero(EdgeMotorMotionVO request);
|
||||
|
||||
MotorCommand.MotorCommandResponse profilePosition(EdgeMotorMotionVO request);
|
||||
|
||||
MotorCommand.MotorCommandResponse profileVelocity(EdgeMotorMotionVO request);
|
||||
|
||||
MotorCommand.MotorCommandResponse emergencyStop(EdgeMotorTargetVO request);
|
||||
|
||||
MotorCommand.GetMotorStatusResponse getStatus(EdgeMotorTargetVO request);
|
||||
|
||||
MotorCommand.MotorCommandResponse setEnabled(EdgeMotorEnabledVO request);
|
||||
|
||||
String openCyclicPosition(EdgeMotorCyclicOpenVO request);
|
||||
|
||||
void sendCyclicPosition(EdgeMotorCyclicSetpointVO request);
|
||||
|
||||
String openCyclicVelocity(EdgeMotorCyclicOpenVO request);
|
||||
|
||||
void sendCyclicVelocity(EdgeMotorCyclicSetpointVO request);
|
||||
|
||||
MotorCommand.CyclicControlResponse getStreamStatus(String sessionId);
|
||||
|
||||
void closeStream(String sessionId);
|
||||
}
|
||||
@ -1,8 +1,10 @@
|
||||
package com.cmvr.edge.client.service;
|
||||
|
||||
import cmvr.api.Common;
|
||||
import cmvr.api.SystemCommand;
|
||||
import com.cmvr.device.domain.DeDeviceRegistration;
|
||||
import com.cmvr.device.domain.vo.Device;
|
||||
import com.cmvr.edge.client.model.system.EdgeSystemJsonCommandVO;
|
||||
import com.cmvr.edge.client.model.system.EdgeSystemUpdateParamsVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -10,12 +12,18 @@ import java.util.List;
|
||||
* 边缘系统服务接口
|
||||
*/
|
||||
public interface EdgeSystemService {
|
||||
SystemCommand.GetSystemInfoCommand.Feedback getSystemInfo(String terminalId);
|
||||
|
||||
/**
|
||||
* 获取系统状态
|
||||
* @return 系统状态信息,包含CPU使用率、内存使用情况、磁盘使用情况和设备列表
|
||||
*/
|
||||
SystemCommand.GetSystemStatusCommand.Feedback getSystemStatus(String terminalId);
|
||||
|
||||
Common.CommandHeader.Feedback updateParams(EdgeSystemUpdateParamsVO request);
|
||||
|
||||
Common.JsonDeviceCommand.Feedback executeJsonCommand(EdgeSystemJsonCommandVO request);
|
||||
|
||||
|
||||
public List<DeDeviceRegistration> deviceList(String terminalId);
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@ package com.cmvr.edge.client.service.impl;
|
||||
import cmvr.api.AgvCommand;
|
||||
import cmvr.api.AgvServiceGrpc;
|
||||
import cmvr.api.Common;
|
||||
import cmvr.msgs.Agv;
|
||||
import cmvr.msgs.AgvUtils;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.edge.client.manage.GrpcServiceManager;
|
||||
@ -30,7 +30,7 @@ public class EdgeAgvServiceImpl implements EdgeAgvService {
|
||||
private final GrpcServiceManager grpcServiceManager;
|
||||
|
||||
@Override
|
||||
public Agv.AgvRuntimeState getRuntimeState(EdgeCommonVO edgeCommonVO) {
|
||||
public AgvUtils.AgvRuntimeState getRuntimeState(EdgeCommonVO edgeCommonVO) {
|
||||
AgvServiceGrpc.AgvServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
edgeCommonVO.getTerminalId(), AgvServiceGrpc.AgvServiceBlockingStub.class);
|
||||
AgvCommand.AgvRuntimeStateCommand.Request request = AgvCommand.AgvRuntimeStateCommand.Request.newBuilder()
|
||||
@ -40,7 +40,7 @@ public class EdgeAgvServiceImpl implements EdgeAgvService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Agv.AgvNavigationStatus getNavigationStatus(EdgeCommonVO edgeCommonVO) {
|
||||
public AgvUtils.AgvNavigationStatus getNavigationStatus(EdgeCommonVO edgeCommonVO) {
|
||||
AgvServiceGrpc.AgvServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
edgeCommonVO.getTerminalId(), AgvServiceGrpc.AgvServiceBlockingStub.class);
|
||||
AgvCommand.AgvNavigationStatusCommand.Request request = AgvCommand.AgvNavigationStatusCommand.Request.newBuilder()
|
||||
@ -66,7 +66,7 @@ public class EdgeAgvServiceImpl implements EdgeAgvService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void navigateToPose(EdgeCommonVO edgeCommonVO, Agv.AgvPose2d pose) {
|
||||
public void navigateToPose(EdgeCommonVO edgeCommonVO, AgvUtils.AgvPose2d pose) {
|
||||
if (pose == null) {
|
||||
throw new GlobalException("目标位姿不能为空");
|
||||
}
|
||||
@ -96,7 +96,7 @@ public class EdgeAgvServiceImpl implements EdgeAgvService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void followPath(EdgeCommonVO edgeCommonVO, List<Agv.AgvPathSegment> pathSegments) {
|
||||
public void followPath(EdgeCommonVO edgeCommonVO, List<AgvUtils.AgvPathSegment> pathSegments) {
|
||||
if (pathSegments == null || pathSegments.isEmpty()) {
|
||||
throw new GlobalException("路径段不能为空");
|
||||
}
|
||||
@ -135,7 +135,7 @@ public class EdgeAgvServiceImpl implements EdgeAgvService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVelocity(EdgeCommonVO edgeCommonVO, Agv.AgvVelocity velocity) {
|
||||
public void setVelocity(EdgeCommonVO edgeCommonVO, AgvUtils.AgvVelocity velocity) {
|
||||
if (velocity == null) {
|
||||
throw new GlobalException("速度不能为空");
|
||||
}
|
||||
@ -168,7 +168,7 @@ public class EdgeAgvServiceImpl implements EdgeAgvService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Agv.AgvStation> listStations(EdgeCommonVO edgeCommonVO) {
|
||||
public List<AgvUtils.AgvStation> listStations(EdgeCommonVO edgeCommonVO) {
|
||||
AgvServiceGrpc.AgvServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
edgeCommonVO.getTerminalId(), AgvServiceGrpc.AgvServiceBlockingStub.class);
|
||||
AgvCommand.AgvListStationsCommand.Request request = AgvCommand.AgvListStationsCommand.Request.newBuilder()
|
||||
@ -227,12 +227,12 @@ public class EdgeAgvServiceImpl implements EdgeAgvService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String startMapping(EdgeCommonVO edgeCommonVO, Agv.AgvMapDimension dimension, String mapName, boolean realTime) {
|
||||
public String startMapping(EdgeCommonVO edgeCommonVO, AgvUtils.AgvMapDimension dimension, String mapName, boolean realTime) {
|
||||
AgvServiceGrpc.AgvServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
edgeCommonVO.getTerminalId(), AgvServiceGrpc.AgvServiceBlockingStub.class);
|
||||
AgvCommand.AgvStartMappingCommand.Request.Builder requestBuilder = AgvCommand.AgvStartMappingCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(edgeCommonVO.getDeviceId()))
|
||||
.setDimension(dimension != null ? dimension : Agv.AgvMapDimension.AGV_MAP_DIMENSION_UNSPECIFIED)
|
||||
.setDimension(dimension != null ? dimension : AgvUtils.AgvMapDimension.AGV_MAP_DIMENSION_UNSPECIFIED)
|
||||
.setRealTime(realTime);
|
||||
|
||||
if (StrUtil.isNotBlank(mapName)) {
|
||||
|
||||
@ -0,0 +1,100 @@
|
||||
package com.cmvr.edge.client.service.impl;
|
||||
|
||||
import cmvr.api.armteleop.v1.ArmTeleopServiceGrpc;
|
||||
import cmvr.api.armteleop.v1.ArmTeleopV1;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.edge.client.manage.GrpcBidiSessionRegistry;
|
||||
import com.cmvr.edge.client.manage.GrpcServiceManager;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopHeartbeatVO;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopOpenVO;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopSetpointVO;
|
||||
import com.cmvr.edge.client.model.armteleop.EdgeArmTeleopStopVO;
|
||||
import com.cmvr.edge.client.service.EdgeArmTeleopService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EdgeArmTeleopServiceImpl implements EdgeArmTeleopService {
|
||||
|
||||
private final GrpcServiceManager grpcServiceManager;
|
||||
private final GrpcBidiSessionRegistry<ArmTeleopV1.ClientFrame,
|
||||
ArmTeleopV1.ServerFrame> sessions = new GrpcBidiSessionRegistry<>();
|
||||
|
||||
@Override
|
||||
public String open(EdgeArmTeleopOpenVO request) {
|
||||
if (request.getTerminalId() == null || request.getTerminalId().trim().isEmpty()) {
|
||||
throw new GlobalException("terminalId cannot be empty");
|
||||
}
|
||||
ArmTeleopV1.RobotManifest.Builder manifest = ArmTeleopV1.RobotManifest.newBuilder();
|
||||
if (request.getRobotId() != null) manifest.setRobotId(request.getRobotId());
|
||||
if (request.getModelSha256() != null) manifest.setModelSha256(request.getModelSha256());
|
||||
if (request.getCalibrationSha256() != null) manifest.setCalibrationSha256(request.getCalibrationSha256());
|
||||
if (request.getJointNames() != null) manifest.addAllJointNames(request.getJointNames());
|
||||
if (request.getPositionUnit() != null) manifest.setPositionUnit(request.getPositionUnit());
|
||||
if (request.getVelocityUnit() != null) manifest.setVelocityUnit(request.getVelocityUnit());
|
||||
if (request.getEffortUnit() != null) manifest.setEffortUnit(request.getEffortUnit());
|
||||
if (request.getBaseFrame() != null) manifest.setBaseFrame(request.getBaseFrame());
|
||||
if (request.getToolFrame() != null) manifest.setToolFrame(request.getToolFrame());
|
||||
|
||||
ArmTeleopV1.OpenSession.Builder open = ArmTeleopV1.OpenSession.newBuilder()
|
||||
.setExpectedRobot(manifest)
|
||||
.setRequestForceFeedback(request.isForceFeedback());
|
||||
if (request.getProtocolMajor() != null) open.setProtocolMajor(request.getProtocolMajor());
|
||||
if (request.getProtocolMinor() != null) open.setProtocolMinor(request.getProtocolMinor());
|
||||
if (request.getClientInstanceId() != null) open.setClientInstanceId(request.getClientInstanceId());
|
||||
if (request.getCommandRateHz() != null) open.setRequestedCommandRateHz(request.getCommandRateHz());
|
||||
if (request.getStateRateHz() != null) open.setRequestedStateRateHz(request.getStateRateHz());
|
||||
if (request.getWatchdogTimeoutMs() != null) open.setWatchdogTimeoutMs(request.getWatchdogTimeoutMs());
|
||||
if (request.getLeaseMs() != null) open.setRequestedLeaseMs(request.getLeaseMs());
|
||||
|
||||
ArmTeleopServiceGrpc.ArmTeleopServiceStub stub = grpcServiceManager.getGrpcClient(
|
||||
request.getTerminalId(), ArmTeleopServiceGrpc.ArmTeleopServiceStub.class);
|
||||
return sessions.open(stub::teleoperate, ArmTeleopV1.ClientFrame.newBuilder().setOpen(open).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendSetpoint(EdgeArmTeleopSetpointVO request) {
|
||||
if (request.getSequence() <= 0) throw new GlobalException("sequence must be greater than zero");
|
||||
if (request.getValidForUs() == null || request.getValidForUs() <= 0) {
|
||||
throw new GlobalException("validForUs must be greater than zero");
|
||||
}
|
||||
ArmTeleopV1.JointSetpoint.Builder setpoint = ArmTeleopV1.JointSetpoint.newBuilder()
|
||||
.setSequence(request.getSequence()).setValidForUs(request.getValidForUs());
|
||||
if (request.getPositionRad() != null) {
|
||||
for (double value : request.getPositionRad()) setpoint.addPositionRad(value);
|
||||
}
|
||||
if (request.getVelocityRadS() != null) {
|
||||
for (double value : request.getVelocityRadS()) setpoint.addVelocityRadS(value);
|
||||
}
|
||||
sessions.send(request.getSessionId(), ArmTeleopV1.ClientFrame.newBuilder().setSetpoint(setpoint).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void heartbeat(EdgeArmTeleopHeartbeatVO request) {
|
||||
ArmTeleopV1.ClientHeartbeat heartbeat = ArmTeleopV1.ClientHeartbeat.newBuilder()
|
||||
.setSequence(request.getSequence()).build();
|
||||
sessions.send(request.getSessionId(), ArmTeleopV1.ClientFrame.newBuilder().setHeartbeat(heartbeat).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArmTeleopV1.ServerFrame getStatus(String sessionId) {
|
||||
return sessions.getLatest(sessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(EdgeArmTeleopStopVO request) {
|
||||
ArmTeleopV1.StopReason reason;
|
||||
try {
|
||||
reason = request.getReason() == null || request.getReason().trim().isEmpty()
|
||||
? ArmTeleopV1.StopReason.STOP_REASON_OPERATOR_REQUEST
|
||||
: ArmTeleopV1.StopReason.valueOf(request.getReason().trim().toUpperCase());
|
||||
} catch (IllegalArgumentException exception) {
|
||||
throw new GlobalException("Invalid teleoperation stop reason");
|
||||
}
|
||||
ArmTeleopV1.StopSession stop = ArmTeleopV1.StopSession.newBuilder()
|
||||
.setReason(reason).setDetail(request.getDetail() == null ? "" : request.getDetail()).build();
|
||||
sessions.send(request.getSessionId(), ArmTeleopV1.ClientFrame.newBuilder().setStop(stop).build());
|
||||
sessions.close(request.getSessionId());
|
||||
}
|
||||
}
|
||||
@ -10,14 +10,17 @@ import com.cmvr.common.enums.FileType;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.edge.client.file.ByteArrayMultipartFile;
|
||||
import com.cmvr.edge.client.manage.GrpcServiceManager;
|
||||
import com.cmvr.edge.client.manage.GrpcStreamManager;
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
import com.cmvr.edge.client.model.camera.EdgeCameraPtzVO;
|
||||
import com.cmvr.edge.client.service.EdgeCameraService;
|
||||
import com.cmvr.edge.client.service.EdgeStreamService;
|
||||
import com.cmvr.edge.client.utils.EdgeCommonUtil;
|
||||
import com.cmvr.edge.client.utils.H265DecoderUtil;
|
||||
import com.cmvr.edge.client.utils.H265Fmp4Transcoder;
|
||||
import com.cmvr.framework.websocket.service.MessagePushService;
|
||||
import com.cmvr.system.service.ISysFileService;
|
||||
import com.google.protobuf.ByteString;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@ -43,12 +46,17 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.util.ArrayList;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.util.Base64;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@ -127,6 +135,31 @@ public class EdgeCameraServiceImpl implements EdgeCameraService, EdgeStreamServi
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDepthImage(EdgeCommonVO edgeCommonVO) {
|
||||
if (!checkStatus(edgeCommonVO)) {
|
||||
start(edgeCommonVO);
|
||||
}
|
||||
CameraServiceGrpc.CameraServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
edgeCommonVO.getTerminalId(), CameraServiceGrpc.CameraServiceBlockingStub.class);
|
||||
CameraCommand.GetDepthImageCommand.Request request = CameraCommand.GetDepthImageCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(edgeCommonVO.getDeviceId()))
|
||||
.build();
|
||||
CameraCommand.GetDepthImageCommand.Feedback feedback = executeGrpcCall(() -> stub.getDepthImage(request));
|
||||
CameraCommand.FrameData frame = feedback.getDepthFrame();
|
||||
if (!feedback.hasDepthFrame() || frame.getWidth() <= 0 || frame.getHeight() <= 0) {
|
||||
throw new GlobalException("Depth image data is invalid");
|
||||
}
|
||||
String filePath = saveDepthImage(frame);
|
||||
try {
|
||||
return sysFileService.uploadFile(convertFileToMultipartFile(filePath), FileType.IMAGE.code());
|
||||
} catch (IOException exception) {
|
||||
throw new GlobalException("Depth image upload failed: " + exception.getMessage());
|
||||
} finally {
|
||||
deleteTempFile(filePath);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String startRecording(EdgeCommonVO edgeCommonVO) {
|
||||
if (!checkStatus(edgeCommonVO)) {
|
||||
@ -193,75 +226,251 @@ public class EdgeCameraServiceImpl implements EdgeCameraService, EdgeStreamServi
|
||||
// return JSON.toJSONString(result);
|
||||
}
|
||||
|
||||
// 缓冲区和收集状态
|
||||
private final List<byte[]> framesBuffer = new ArrayList<>();
|
||||
private boolean isCollectingFrames = false;
|
||||
@Override
|
||||
public String controlPtz(EdgeCameraPtzVO ptzVO) {
|
||||
CameraCommand.ControlPtzCommand.Command command;
|
||||
CameraCommand.ControlPtzCommand.Action action;
|
||||
try {
|
||||
command = CameraCommand.ControlPtzCommand.Command.valueOf(ptzVO.getCommand().trim().toUpperCase());
|
||||
action = CameraCommand.ControlPtzCommand.Action.valueOf(ptzVO.getAction().trim().toUpperCase());
|
||||
} catch (RuntimeException exception) {
|
||||
throw new GlobalException("Invalid PTZ command or action");
|
||||
}
|
||||
CameraServiceGrpc.CameraServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
ptzVO.getTerminalId(), CameraServiceGrpc.CameraServiceBlockingStub.class);
|
||||
CameraCommand.ControlPtzCommand.Request request = CameraCommand.ControlPtzCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(ptzVO.getDeviceId()))
|
||||
.setCommand(command)
|
||||
.setAction(action)
|
||||
.setSpeed(ptzVO.getSpeed() == null ? 0 : ptzVO.getSpeed())
|
||||
.build();
|
||||
return JSON.toJSONString(executeGrpcCall(() -> stub.controlPtz(request)).getHeader());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request> getRGBImageStream(EdgeCommonVO edgeCommonVO) {
|
||||
if (!checkStatus(edgeCommonVO)) {
|
||||
start(edgeCommonVO);
|
||||
return getRGBImageStream(edgeCommonVO.getTerminalId(), edgeCommonVO.getDeviceId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request> getRGBImageStream(String terminalId, String deviceId) {
|
||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||
edgeCommonVO.setTerminalId(terminalId);
|
||||
edgeCommonVO.setDeviceId(deviceId);
|
||||
CameraCommand.CameraState cameraState = status(edgeCommonVO);
|
||||
if (cameraState.getIsError()) {
|
||||
throw new GlobalException("Camera is in error state");
|
||||
}
|
||||
String terminalId = edgeCommonVO.getTerminalId();
|
||||
String deviceId = edgeCommonVO.getDeviceId();
|
||||
if (!cameraState.getIsOpened() || !cameraState.getIsStreaming()) {
|
||||
start(edgeCommonVO);
|
||||
cameraState = status(edgeCommonVO);
|
||||
}
|
||||
int frameRate = cameraState.getFps();
|
||||
String channel = "edgeCameraServiceImpl/getRGBImageStream/" + terminalId + "/" + deviceId;
|
||||
String streamKey = terminalId + deviceId + "edgeCameraServiceImpl" + "getRGBImageStream";
|
||||
AtomicInteger sequence = new AtomicInteger();
|
||||
AtomicBoolean firstMediaChunk = new AtomicBoolean(true);
|
||||
AtomicReference<StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request>> requestObserverRef = new AtomicReference<>();
|
||||
|
||||
H265Fmp4Transcoder transcoder;
|
||||
try {
|
||||
transcoder = new H265Fmp4Transcoder(
|
||||
terminalId + "-" + deviceId,
|
||||
frameRate,
|
||||
chunk -> {
|
||||
int currentSequence = sequence.incrementAndGet();
|
||||
if (firstMediaChunk.compareAndSet(true, false)) {
|
||||
log.info("摄像头流已输出首个fMP4片段, terminalId: {}, deviceId: {}, bytes: {}",
|
||||
terminalId, deviceId, chunk.length);
|
||||
}
|
||||
messagePushService.pushH264Fmp4ToChannel(channel, chunk, currentSequence);
|
||||
},
|
||||
throwable -> {
|
||||
log.error("摄像头媒体转码失败, terminalId: {}, deviceId: {}", terminalId, deviceId, throwable);
|
||||
messagePushService.pushToChannel(channel, "500");
|
||||
StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request> observer = requestObserverRef.get();
|
||||
if (observer != null) {
|
||||
observer.onError(Status.INTERNAL.withDescription("媒体转码失败").withCause(throwable).asRuntimeException());
|
||||
}
|
||||
}
|
||||
);
|
||||
transcoder.start();
|
||||
} catch (IOException exception) {
|
||||
throw new GlobalException("摄像头媒体转码器初始化失败: " + exception.getMessage());
|
||||
}
|
||||
|
||||
CameraServiceGrpc.CameraServiceStub stub = grpcServiceManager.getGrpcClient(terminalId, CameraServiceGrpc.CameraServiceStub.class);
|
||||
// 创建StreamObserver来处理响应
|
||||
StreamObserver<CameraCommand.GetRGBImageStreamCommand.Feedback> responseObserver = new StreamObserver<CameraCommand.GetRGBImageStreamCommand.Feedback>() {
|
||||
@Override
|
||||
public void onNext(CameraCommand.GetRGBImageStreamCommand.Feedback value) {
|
||||
CameraCommand.FrameData frame = value.getColorFrame();
|
||||
byte[] frameData = frame.getData().toByteArray();
|
||||
|
||||
if (frame.getIsKeyFrame()) { // I帧
|
||||
if (isCollectingFrames) {
|
||||
// 处理之前的缓冲区数据
|
||||
String videoBase64 = H265DecoderUtil.convertH265FramesToVideo(framesBuffer);
|
||||
if (videoBase64 != null) {
|
||||
messagePushService.pushToChannel(
|
||||
"edgeCameraServiceImpl/getRGBImageStream/" + terminalId + "/" + deviceId,
|
||||
videoBase64
|
||||
);
|
||||
}
|
||||
// 重置缓冲区
|
||||
framesBuffer.clear();
|
||||
}
|
||||
// 开始新收集段
|
||||
framesBuffer.add(frameData);
|
||||
isCollectingFrames = true;
|
||||
} else {
|
||||
// 非I帧且正在收集时加入缓冲区
|
||||
if (isCollectingFrames) {
|
||||
framesBuffer.add(frameData);
|
||||
}
|
||||
try {
|
||||
CameraCommand.FrameData frame = value.getColorFrame();
|
||||
transcoder.write(frame.getData().toByteArray(), frame.getIsKeyFrame(), frame.getCodec());
|
||||
} catch (IOException exception) {
|
||||
log.error("写入摄像头媒体流失败, terminalId: {}, deviceId: {}", terminalId, deviceId, exception);
|
||||
transcoder.close();
|
||||
messagePushService.pushToChannel(channel, "500");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable t) {
|
||||
// 记录详细的错误信息
|
||||
log.error("Error occurred in getRGBImageStream for terminalId: {}, deviceId: {}. Error: {}", terminalId, deviceId, t.getMessage(), t);
|
||||
// 推送错误信息
|
||||
messagePushService.pushToChannel("edgeCameraServiceImpl/getRGBImageStream/" + terminalId + "/" + deviceId, "500");
|
||||
transcoder.close();
|
||||
GrpcStreamManager.removeStream(streamKey);
|
||||
Status status = Status.fromThrowable(t);
|
||||
if (status.getCode() != Status.Code.CANCELLED) {
|
||||
log.error("摄像头gRPC流异常, terminalId: {}, deviceId: {}", terminalId, deviceId, t);
|
||||
messagePushService.pushToChannel(channel, "500");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
// 流结束
|
||||
System.out.println("Stream completed.");
|
||||
transcoder.close();
|
||||
GrpcStreamManager.removeStream(streamKey);
|
||||
log.info("摄像头gRPC流结束, terminalId: {}, deviceId: {}", terminalId, deviceId);
|
||||
}
|
||||
};
|
||||
// 创建StreamObserver来发送请求
|
||||
StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request> requestObserver = stub.getRGBImageStream(responseObserver);
|
||||
StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request> grpcRequestObserver;
|
||||
try {
|
||||
grpcRequestObserver = stub.getRGBImageStream(responseObserver);
|
||||
requestObserverRef.set(grpcRequestObserver);
|
||||
} catch (RuntimeException exception) {
|
||||
transcoder.close();
|
||||
throw exception;
|
||||
}
|
||||
|
||||
// 构建请求并发送
|
||||
CameraCommand.GetRGBImageStreamCommand.Request request = CameraCommand.GetRGBImageStreamCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(deviceId))
|
||||
.setEof(false)
|
||||
.build();
|
||||
|
||||
requestObserver.onNext(request);
|
||||
return requestObserver;
|
||||
grpcRequestObserver.onNext(request);
|
||||
return new StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request>() {
|
||||
@Override
|
||||
public void onNext(CameraCommand.GetRGBImageStreamCommand.Request value) {
|
||||
grpcRequestObserver.onNext(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable throwable) {
|
||||
transcoder.close();
|
||||
grpcRequestObserver.onError(throwable);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
transcoder.close();
|
||||
grpcRequestObserver.onCompleted();
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeRGBVideoStream(String terminalId, String deviceId, OutputStream outputStream) {
|
||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||
edgeCommonVO.setTerminalId(terminalId);
|
||||
edgeCommonVO.setDeviceId(deviceId);
|
||||
CameraCommand.CameraState cameraState = status(edgeCommonVO);
|
||||
if (cameraState.getIsError()) {
|
||||
throw new GlobalException("Camera is in error state");
|
||||
}
|
||||
if (!cameraState.getIsOpened() || !cameraState.getIsStreaming()) {
|
||||
start(edgeCommonVO);
|
||||
cameraState = status(edgeCommonVO);
|
||||
}
|
||||
|
||||
CountDownLatch finished = new CountDownLatch(1);
|
||||
AtomicBoolean streamFinished = new AtomicBoolean(false);
|
||||
AtomicReference<StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request>> requestObserverRef =
|
||||
new AtomicReference<>();
|
||||
Runnable finishStream = () -> {
|
||||
if (streamFinished.compareAndSet(false, true)) {
|
||||
finished.countDown();
|
||||
}
|
||||
};
|
||||
|
||||
H265Fmp4Transcoder transcoder;
|
||||
try {
|
||||
transcoder = new H265Fmp4Transcoder(
|
||||
"http-" + terminalId + "-" + deviceId,
|
||||
cameraState.getFps(),
|
||||
chunk -> {
|
||||
try {
|
||||
outputStream.write(chunk);
|
||||
outputStream.flush();
|
||||
} catch (IOException exception) {
|
||||
throw new CameraStreamWriteException(exception);
|
||||
}
|
||||
},
|
||||
throwable -> {
|
||||
if (!(throwable instanceof CameraStreamWriteException)) {
|
||||
log.error("HTTP camera media transcoding failed, terminalId: {}, deviceId: {}",
|
||||
terminalId, deviceId, throwable);
|
||||
}
|
||||
finishStream.run();
|
||||
}
|
||||
);
|
||||
transcoder.start();
|
||||
} catch (IOException exception) {
|
||||
throw new GlobalException("Failed to initialize camera video stream: " + exception.getMessage());
|
||||
}
|
||||
|
||||
CameraServiceGrpc.CameraServiceStub stub = grpcServiceManager.getGrpcClient(
|
||||
terminalId, CameraServiceGrpc.CameraServiceStub.class);
|
||||
StreamObserver<CameraCommand.GetRGBImageStreamCommand.Feedback> responseObserver =
|
||||
new StreamObserver<CameraCommand.GetRGBImageStreamCommand.Feedback>() {
|
||||
@Override
|
||||
public void onNext(CameraCommand.GetRGBImageStreamCommand.Feedback value) {
|
||||
CameraCommand.FrameData frame = value.getColorFrame();
|
||||
try {
|
||||
transcoder.write(frame.getData().toByteArray(), frame.getIsKeyFrame(), frame.getCodec());
|
||||
} catch (IOException exception) {
|
||||
log.error("Failed to write HTTP camera frame, terminalId: {}, deviceId: {}, codec: {}",
|
||||
terminalId, deviceId, frame.getCodec(), exception);
|
||||
finishStream.run();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onError(Throwable throwable) {
|
||||
Status status = Status.fromThrowable(throwable);
|
||||
if (status.getCode() != Status.Code.CANCELLED && !streamFinished.get()) {
|
||||
log.warn("HTTP camera gRPC stream ended, terminalId: {}, deviceId: {}, status: {}",
|
||||
terminalId, deviceId, status);
|
||||
}
|
||||
finishStream.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCompleted() {
|
||||
finishStream.run();
|
||||
}
|
||||
};
|
||||
|
||||
try {
|
||||
StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request> requestObserver =
|
||||
stub.getRGBImageStream(responseObserver);
|
||||
requestObserverRef.set(requestObserver);
|
||||
requestObserver.onNext(CameraCommand.GetRGBImageStreamCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(deviceId))
|
||||
.setEof(false)
|
||||
.build());
|
||||
finished.await();
|
||||
} catch (InterruptedException exception) {
|
||||
Thread.currentThread().interrupt();
|
||||
} finally {
|
||||
transcoder.close();
|
||||
StreamObserver<CameraCommand.GetRGBImageStreamCommand.Request> requestObserver =
|
||||
requestObserverRef.getAndSet(null);
|
||||
if (requestObserver != null) {
|
||||
try {
|
||||
requestObserver.onCompleted();
|
||||
} catch (RuntimeException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -447,4 +656,57 @@ public class EdgeCameraServiceImpl implements EdgeCameraService, EdgeStreamServi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String saveDepthImage(CameraCommand.FrameData frame) {
|
||||
int pixelCount = frame.getWidth() * frame.getHeight();
|
||||
byte[] source = frame.getData().toByteArray();
|
||||
if (frame.getType() == CameraCommand.FrameData.FrameType.U8C1) {
|
||||
if (source.length < pixelCount) {
|
||||
throw new GlobalException("Depth image byte count is invalid");
|
||||
}
|
||||
return saveImage(ByteString.copyFrom(source, 0, pixelCount), frame.getWidth(), frame.getHeight(), true);
|
||||
}
|
||||
|
||||
double[] values = new double[pixelCount];
|
||||
ByteBuffer buffer = ByteBuffer.wrap(source).order(ByteOrder.LITTLE_ENDIAN);
|
||||
if (frame.getType() == CameraCommand.FrameData.FrameType.F32C1) {
|
||||
if (source.length < pixelCount * Float.BYTES) {
|
||||
throw new GlobalException("F32 depth image byte count is invalid");
|
||||
}
|
||||
for (int i = 0; i < pixelCount; i++) values[i] = buffer.getFloat();
|
||||
} else if (frame.getType() == CameraCommand.FrameData.FrameType.U16C1
|
||||
|| frame.getType() == CameraCommand.FrameData.FrameType.F16C1) {
|
||||
if (source.length < pixelCount * Short.BYTES) {
|
||||
throw new GlobalException("16-bit depth image byte count is invalid");
|
||||
}
|
||||
for (int i = 0; i < pixelCount; i++) values[i] = Short.toUnsignedInt(buffer.getShort());
|
||||
} else {
|
||||
throw new GlobalException("Unsupported depth frame type: " + frame.getType());
|
||||
}
|
||||
|
||||
double min = Double.POSITIVE_INFINITY;
|
||||
double max = Double.NEGATIVE_INFINITY;
|
||||
for (double value : values) {
|
||||
if (Double.isFinite(value) && value > 0) {
|
||||
min = Math.min(min, value);
|
||||
max = Math.max(max, value);
|
||||
}
|
||||
}
|
||||
byte[] grayscale = new byte[pixelCount];
|
||||
if (Double.isFinite(min) && max > min) {
|
||||
double scale = 255.0 / (max - min);
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
double value = values[i];
|
||||
grayscale[i] = !Double.isFinite(value) || value <= 0
|
||||
? 0 : (byte) Math.max(0, Math.min(255, Math.round((value - min) * scale)));
|
||||
}
|
||||
}
|
||||
return saveImage(ByteString.copyFrom(grayscale), frame.getWidth(), frame.getHeight(), true);
|
||||
}
|
||||
|
||||
private static final class CameraStreamWriteException extends RuntimeException {
|
||||
private CameraStreamWriteException(IOException cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,189 @@
|
||||
package com.cmvr.edge.client.service.impl;
|
||||
|
||||
import cmvr.api.MotorCommand;
|
||||
import cmvr.api.MotorServiceGrpc;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.edge.client.manage.GrpcBidiSessionRegistry;
|
||||
import com.cmvr.edge.client.manage.GrpcServiceManager;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorCyclicOpenVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorCyclicSetpointVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorEnabledVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorMotionVO;
|
||||
import com.cmvr.edge.client.model.motor.EdgeMotorTargetVO;
|
||||
import com.cmvr.edge.client.service.EdgeMotorService;
|
||||
import com.cmvr.edge.client.utils.EdgeCommonUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EdgeMotorServiceImpl implements EdgeMotorService {
|
||||
|
||||
private final GrpcServiceManager grpcServiceManager;
|
||||
private final GrpcBidiSessionRegistry<MotorCommand.CyclicPositionRequest,
|
||||
MotorCommand.CyclicControlResponse> positionStreams = new GrpcBidiSessionRegistry<>();
|
||||
private final GrpcBidiSessionRegistry<MotorCommand.CyclicVelocityRequest,
|
||||
MotorCommand.CyclicControlResponse> velocityStreams = new GrpcBidiSessionRegistry<>();
|
||||
private final ConcurrentMap<String, Boolean> streamTypes = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public MotorCommand.MotorCommandResponse setZero(EdgeMotorTargetVO request) {
|
||||
return blockingStub(request.getTerminalId()).setZero(MotorCommand.SetMotorZeroRequest.newBuilder()
|
||||
.setTarget(buildTarget(request)).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotorCommand.MotorCommandResponse moveToZero(EdgeMotorMotionVO request) {
|
||||
MotorCommand.MoveMotorToZeroRequest.Builder builder = MotorCommand.MoveMotorToZeroRequest.newBuilder()
|
||||
.setTarget(buildTarget(request)).setWait(buildWait(request));
|
||||
if (request.getMaxVelocityRadS() != null) builder.setMaxVelocityRadS(request.getMaxVelocityRadS());
|
||||
if (request.getAccelerationRadS2() != null) builder.setAccelerationRadS2(request.getAccelerationRadS2());
|
||||
return blockingStub(request.getTerminalId()).moveToZero(builder.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotorCommand.MotorCommandResponse profilePosition(EdgeMotorMotionVO request) {
|
||||
if (request.getTargetPositionRad() == null) {
|
||||
throw new GlobalException("targetPositionRad cannot be empty");
|
||||
}
|
||||
MotorCommand.ProfilePositionRequest.Builder builder = MotorCommand.ProfilePositionRequest.newBuilder()
|
||||
.setTarget(buildTarget(request))
|
||||
.setTargetPositionRad(request.getTargetPositionRad())
|
||||
.setWait(buildWait(request));
|
||||
if (request.getMaxVelocityRadS() != null) builder.setMaxVelocityRadS(request.getMaxVelocityRadS());
|
||||
if (request.getAccelerationRadS2() != null) builder.setAccelerationRadS2(request.getAccelerationRadS2());
|
||||
return blockingStub(request.getTerminalId()).profilePosition(builder.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotorCommand.MotorCommandResponse profileVelocity(EdgeMotorMotionVO request) {
|
||||
if (request.getTargetVelocityRadS() == null) {
|
||||
throw new GlobalException("targetVelocityRadS cannot be empty");
|
||||
}
|
||||
MotorCommand.ProfileVelocityRequest.Builder builder = MotorCommand.ProfileVelocityRequest.newBuilder()
|
||||
.setTarget(buildTarget(request))
|
||||
.setTargetVelocityRadS(request.getTargetVelocityRadS())
|
||||
.setWait(buildWait(request));
|
||||
if (request.getAccelerationRadS2() != null) builder.setAccelerationRadS2(request.getAccelerationRadS2());
|
||||
return blockingStub(request.getTerminalId()).profileVelocity(builder.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotorCommand.MotorCommandResponse emergencyStop(EdgeMotorTargetVO request) {
|
||||
return blockingStub(request.getTerminalId()).emergencyStop(MotorCommand.EmergencyStopRequest.newBuilder()
|
||||
.setTarget(buildTarget(request)).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotorCommand.GetMotorStatusResponse getStatus(EdgeMotorTargetVO request) {
|
||||
return blockingStub(request.getTerminalId()).getStatus(MotorCommand.GetMotorStatusRequest.newBuilder()
|
||||
.setTarget(buildTarget(request)).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotorCommand.MotorCommandResponse setEnabled(EdgeMotorEnabledVO request) {
|
||||
return blockingStub(request.getTerminalId()).setEnabled(MotorCommand.SetMotorEnabledRequest.newBuilder()
|
||||
.setTarget(buildTarget(request)).setEnabled(request.isEnabled()).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String openCyclicPosition(EdgeMotorCyclicOpenVO request) {
|
||||
MotorServiceGrpc.MotorServiceStub stub = asyncStub(request.getTerminalId());
|
||||
MotorCommand.CyclicPositionRequest open = MotorCommand.CyclicPositionRequest.newBuilder()
|
||||
.setOpen(buildOpen(request)).build();
|
||||
String sessionId = positionStreams.open(stub::streamCyclicPosition, open);
|
||||
streamTypes.put(sessionId, Boolean.TRUE);
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCyclicPosition(EdgeMotorCyclicSetpointVO request) {
|
||||
if (request.getTargetPositionRad() == null) {
|
||||
throw new GlobalException("targetPositionRad cannot be empty");
|
||||
}
|
||||
MotorCommand.CyclicPositionSetpoint.Builder setpoint = MotorCommand.CyclicPositionSetpoint.newBuilder()
|
||||
.setSequence(request.getSequence()).setTargetPositionRad(request.getTargetPositionRad());
|
||||
if (request.getTargetVelocityRadS() != null) {
|
||||
setpoint.setTargetVelocityRadS(request.getTargetVelocityRadS());
|
||||
}
|
||||
positionStreams.send(request.getSessionId(), MotorCommand.CyclicPositionRequest.newBuilder()
|
||||
.setSetpoint(setpoint).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String openCyclicVelocity(EdgeMotorCyclicOpenVO request) {
|
||||
MotorServiceGrpc.MotorServiceStub stub = asyncStub(request.getTerminalId());
|
||||
MotorCommand.CyclicVelocityRequest open = MotorCommand.CyclicVelocityRequest.newBuilder()
|
||||
.setOpen(buildOpen(request)).build();
|
||||
String sessionId = velocityStreams.open(stub::streamCyclicVelocity, open);
|
||||
streamTypes.put(sessionId, Boolean.FALSE);
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendCyclicVelocity(EdgeMotorCyclicSetpointVO request) {
|
||||
if (request.getTargetVelocityRadS() == null) {
|
||||
throw new GlobalException("targetVelocityRadS cannot be empty");
|
||||
}
|
||||
MotorCommand.CyclicVelocitySetpoint setpoint = MotorCommand.CyclicVelocitySetpoint.newBuilder()
|
||||
.setSequence(request.getSequence()).setTargetVelocityRadS(request.getTargetVelocityRadS()).build();
|
||||
velocityStreams.send(request.getSessionId(), MotorCommand.CyclicVelocityRequest.newBuilder()
|
||||
.setSetpoint(setpoint).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public MotorCommand.CyclicControlResponse getStreamStatus(String sessionId) {
|
||||
Boolean position = streamTypes.get(sessionId);
|
||||
if (position == null) throw new GlobalException("Unknown stream session: " + sessionId);
|
||||
return position ? positionStreams.getLatest(sessionId) : velocityStreams.getLatest(sessionId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeStream(String sessionId) {
|
||||
Boolean position = streamTypes.remove(sessionId);
|
||||
if (position == null) throw new GlobalException("Unknown stream session: " + sessionId);
|
||||
if (position) positionStreams.close(sessionId); else velocityStreams.close(sessionId);
|
||||
}
|
||||
|
||||
private MotorCommand.MotorTarget buildTarget(EdgeMotorTargetVO request) {
|
||||
MotorCommand.MotorTarget.Builder builder = MotorCommand.MotorTarget.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(request.getDeviceId()));
|
||||
if (request.getMotorId() != null) {
|
||||
if (request.getMotorId() < 0) throw new GlobalException("motorId cannot be negative");
|
||||
builder.setMotorId(request.getMotorId());
|
||||
} else if (request.getJointName() != null && !request.getJointName().trim().isEmpty()) {
|
||||
builder.setJointName(request.getJointName());
|
||||
} else {
|
||||
throw new GlobalException("Either motorId or jointName must be provided");
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private MotorCommand.MotorWaitOptions buildWait(EdgeMotorMotionVO request) {
|
||||
MotorCommand.MotorWaitOptions.Builder builder = MotorCommand.MotorWaitOptions.newBuilder();
|
||||
if (request.getTimeoutMs() != null) builder.setTimeoutMs(request.getTimeoutMs());
|
||||
if (request.getPollPeriodMs() != null) builder.setPollPeriodMs(request.getPollPeriodMs());
|
||||
if (request.getPositionToleranceRad() != null) builder.setPositionToleranceRad(request.getPositionToleranceRad());
|
||||
if (request.getVelocityToleranceRadS() != null) builder.setVelocityToleranceRadS(request.getVelocityToleranceRadS());
|
||||
if (request.getSettleSampleCount() != null) builder.setSettleSampleCount(request.getSettleSampleCount());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private MotorCommand.CyclicStreamOpen buildOpen(EdgeMotorCyclicOpenVO request) {
|
||||
MotorCommand.CyclicStreamOpen.Builder builder = MotorCommand.CyclicStreamOpen.newBuilder()
|
||||
.setTarget(buildTarget(request));
|
||||
if (request.getWatchdogTimeoutMs() != null) builder.setWatchdogTimeoutMs(request.getWatchdogTimeoutMs());
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
private MotorServiceGrpc.MotorServiceBlockingStub blockingStub(String terminalId) {
|
||||
return grpcServiceManager.getGrpcClient(terminalId, MotorServiceGrpc.MotorServiceBlockingStub.class);
|
||||
}
|
||||
|
||||
private MotorServiceGrpc.MotorServiceStub asyncStub(String terminalId) {
|
||||
return grpcServiceManager.getGrpcClient(terminalId, MotorServiceGrpc.MotorServiceStub.class);
|
||||
}
|
||||
}
|
||||
@ -1,18 +1,24 @@
|
||||
package com.cmvr.edge.client.service.impl;
|
||||
|
||||
import cmvr.api.Common;
|
||||
import cmvr.api.SystemCommand;
|
||||
import cmvr.api.SystemServiceGrpc;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.cmvr.device.domain.DeDeviceRegistration;
|
||||
import com.cmvr.edge.client.manage.GrpcServiceManager;
|
||||
import com.cmvr.edge.client.model.system.EdgeSystemJsonCommandVO;
|
||||
import com.cmvr.edge.client.model.system.EdgeSystemUpdateParamsVO;
|
||||
import com.cmvr.edge.client.service.EdgeSystemService;
|
||||
import com.cmvr.edge.client.utils.EdgeCommonUtil;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.google.protobuf.ByteString;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -29,6 +35,75 @@ public class EdgeSystemServiceImpl implements EdgeSystemService {
|
||||
|
||||
private final GrpcServiceManager grpcServiceManager;
|
||||
|
||||
@Override
|
||||
public SystemCommand.GetSystemInfoCommand.Feedback getSystemInfo(String terminalId) {
|
||||
SystemServiceGrpc.SystemServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
terminalId, SystemServiceGrpc.SystemServiceBlockingStub.class);
|
||||
return stub.getSystemInfo(SystemCommand.GetSystemInfoCommand.Request.newBuilder().build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Common.CommandHeader.Feedback updateParams(EdgeSystemUpdateParamsVO request) {
|
||||
SystemCommand.UpdateParamsCommand.Request.Builder requestBuilder =
|
||||
SystemCommand.UpdateParamsCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(request.getDeviceId()));
|
||||
if (request.getParams() != null) {
|
||||
for (EdgeSystemUpdateParamsVO.Param param : request.getParams()) {
|
||||
requestBuilder.addParams(buildParam(param));
|
||||
}
|
||||
}
|
||||
SystemServiceGrpc.SystemServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
request.getTerminalId(), SystemServiceGrpc.SystemServiceBlockingStub.class);
|
||||
return stub.updateParams(requestBuilder.build()).getHeader();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Common.JsonDeviceCommand.Feedback executeJsonCommand(EdgeSystemJsonCommandVO request) {
|
||||
Common.JsonDeviceCommand.Request grpcRequest = Common.JsonDeviceCommand.Request.newBuilder()
|
||||
.setHeader(EdgeCommonUtil.buildRequest(request.getDeviceId()))
|
||||
.setRequestJson(request.getRequestJson() == null ? "" : request.getRequestJson())
|
||||
.build();
|
||||
SystemServiceGrpc.SystemServiceBlockingStub stub = grpcServiceManager.getGrpcClient(
|
||||
request.getTerminalId(), SystemServiceGrpc.SystemServiceBlockingStub.class);
|
||||
return stub.executeJsonCommand(grpcRequest);
|
||||
}
|
||||
|
||||
private Common.ConfigParam buildParam(EdgeSystemUpdateParamsVO.Param param) {
|
||||
if (param == null || param.getName() == null || param.getName().trim().isEmpty()) {
|
||||
throw new GlobalException("Parameter name cannot be empty");
|
||||
}
|
||||
Common.ConfigParam.Builder builder = Common.ConfigParam.newBuilder().setParamName(param.getName());
|
||||
int valueCount = 0;
|
||||
if (param.getIntValue() != null) {
|
||||
builder.setIntValue(param.getIntValue());
|
||||
valueCount++;
|
||||
}
|
||||
if (param.getDoubleValue() != null) {
|
||||
builder.setDoubleValue(param.getDoubleValue());
|
||||
valueCount++;
|
||||
}
|
||||
if (param.getStringValue() != null) {
|
||||
builder.setStringValue(param.getStringValue());
|
||||
valueCount++;
|
||||
}
|
||||
if (param.getBoolValue() != null) {
|
||||
builder.setBoolValue(param.getBoolValue());
|
||||
valueCount++;
|
||||
}
|
||||
if (param.getBytesBase64() != null) {
|
||||
try {
|
||||
builder.setBytesValue(ByteString.copyFrom(Base64.getDecoder().decode(param.getBytesBase64())));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
throw new GlobalException("Invalid Base64 value for parameter " + param.getName());
|
||||
}
|
||||
valueCount++;
|
||||
}
|
||||
if (valueCount != 1) {
|
||||
throw new GlobalException("Parameter " + param.getName() + " must contain exactly one typed value");
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
||||
public List<DeDeviceRegistration> deviceList(String terminalId){
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.cmvr.edge.client.service.impl;
|
||||
import com.cmvr.edge.client.manage.GrpcStreamManager;
|
||||
import com.cmvr.edge.client.service.EdgeStreamService;
|
||||
import com.cmvr.framework.websocket.service.GrpcClientService;
|
||||
import com.cmvr.framework.websocket.manager.ChannelSubscriptionManager;
|
||||
import io.grpc.Status;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import org.slf4j.Logger;
|
||||
@ -12,6 +13,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* grpc客户端服务实现类
|
||||
@ -26,10 +28,14 @@ public class GrpcClientServiceImpl implements GrpcClientService {
|
||||
* 所有流式服务
|
||||
*/
|
||||
private final Map<String, EdgeStreamService> serviceMap;
|
||||
private final ChannelSubscriptionManager channelSubscriptionManager;
|
||||
private final Map<String, Object> streamLocks = new ConcurrentHashMap<>();
|
||||
|
||||
@Autowired
|
||||
public GrpcClientServiceImpl(Map<String, EdgeStreamService> serviceMap) {
|
||||
public GrpcClientServiceImpl(Map<String, EdgeStreamService> serviceMap,
|
||||
ChannelSubscriptionManager channelSubscriptionManager) {
|
||||
this.serviceMap = serviceMap;
|
||||
this.channelSubscriptionManager = channelSubscriptionManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,25 +49,31 @@ public class GrpcClientServiceImpl implements GrpcClientService {
|
||||
|
||||
// 构造流键
|
||||
String key = terminalId + deviceId + service + method;
|
||||
String channel = service + "/" + method + "/" + terminalId + "/" + deviceId;
|
||||
Object streamLock = streamLocks.computeIfAbsent(key, ignored -> new Object());
|
||||
|
||||
if (isStart) {
|
||||
// 通过反射调用指定方法
|
||||
Method streamMethod = serviceInstance.getClass().getMethod(method, String.class, String.class);
|
||||
StreamObserver<?> streamObserver = (StreamObserver<?>) streamMethod.invoke(serviceInstance, terminalId, deviceId);
|
||||
if (streamObserver != null) {
|
||||
GrpcStreamManager.addStream(key, streamObserver);
|
||||
}
|
||||
} else {
|
||||
if (!GrpcStreamManager.containsKey(key)) {
|
||||
return;
|
||||
}
|
||||
// 移除并关闭流
|
||||
StreamObserver<?> streamObserver = GrpcStreamManager.removeStream(key);
|
||||
try {
|
||||
streamObserver.onError(Status.CANCELLED.withDescription("流需要关闭").asException());
|
||||
log.info("流关闭: {}", key);
|
||||
} catch (Exception e) {
|
||||
log.info("流结束");
|
||||
synchronized (streamLock) {
|
||||
if (isStart) {
|
||||
if (GrpcStreamManager.containsKey(key)) {
|
||||
return;
|
||||
}
|
||||
Method streamMethod = serviceInstance.getClass().getMethod(method, String.class, String.class);
|
||||
StreamObserver<?> streamObserver = (StreamObserver<?>) streamMethod.invoke(serviceInstance, terminalId, deviceId);
|
||||
if (streamObserver != null) {
|
||||
GrpcStreamManager.addStream(key, streamObserver);
|
||||
}
|
||||
} else {
|
||||
// 旧连接的异步取消到达时,如果已有新订阅者,则继续复用当前流。
|
||||
if (channelSubscriptionManager.hasSubscribers(channel) || !GrpcStreamManager.containsKey(key)) {
|
||||
return;
|
||||
}
|
||||
StreamObserver<?> streamObserver = GrpcStreamManager.removeStream(key);
|
||||
try {
|
||||
streamObserver.onError(Status.CANCELLED.withDescription("流需要关闭").asException());
|
||||
log.info("流关闭: {}", key);
|
||||
} catch (Exception e) {
|
||||
log.info("流结束");
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -0,0 +1,593 @@
|
||||
package com.cmvr.edge.client.utils;
|
||||
|
||||
import org.bytedeco.ffmpeg.global.avcodec;
|
||||
import org.bytedeco.javacv.FFmpegFrameGrabber;
|
||||
import org.bytedeco.javacv.FFmpegFrameRecorder;
|
||||
import org.bytedeco.javacv.Frame;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Deque;
|
||||
import java.util.Locale;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
/**
|
||||
* 将一条连续 H.265 裸码流转换为浏览器 MediaSource 可追加的 H.264 fragmented MP4。
|
||||
*/
|
||||
public final class H265Fmp4Transcoder implements AutoCloseable {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(H265Fmp4Transcoder.class);
|
||||
public static final String MIME_TYPE = "video/mp4; codecs=\"avc1.42C01E\"";
|
||||
private static final int MAX_QUEUED_BYTES = 512 * 1024;
|
||||
|
||||
private final Consumer<Throwable> errorConsumer;
|
||||
private final String streamName;
|
||||
private final int configuredFrameRate;
|
||||
private final LiveEncodedVideoInputStream inputStream;
|
||||
private final MediaChunkOutputStream outputStream;
|
||||
private final AtomicBoolean closed = new AtomicBoolean(false);
|
||||
private final Thread worker;
|
||||
|
||||
private volatile FFmpegFrameGrabber grabber;
|
||||
private volatile FFmpegFrameRecorder recorder;
|
||||
|
||||
public H265Fmp4Transcoder(String streamName,
|
||||
int configuredFrameRate,
|
||||
Consumer<byte[]> chunkConsumer,
|
||||
Consumer<Throwable> errorConsumer) throws IOException {
|
||||
this.errorConsumer = errorConsumer;
|
||||
this.streamName = streamName;
|
||||
this.configuredFrameRate = configuredFrameRate;
|
||||
int maxQueuedFrames = Math.max(4, Math.min(20,
|
||||
(int) Math.ceil((configuredFrameRate > 0 ? configuredFrameRate : 25) * 0.35D)));
|
||||
this.inputStream = new LiveEncodedVideoInputStream(streamName, maxQueuedFrames, MAX_QUEUED_BYTES);
|
||||
this.outputStream = new MediaChunkOutputStream(chunkConsumer);
|
||||
this.worker = new Thread(this::transcode, "camera-fmp4-" + streamName);
|
||||
this.worker.setDaemon(true);
|
||||
}
|
||||
|
||||
public void start() {
|
||||
worker.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* gRPC按顺序写入编码帧;管道满时自然背压,防止无限堆积导致延迟持续增长。
|
||||
*/
|
||||
public void write(byte[] encodedFrame, boolean keyFrame, String codec) throws IOException {
|
||||
if (encodedFrame == null || encodedFrame.length == 0 || closed.get()) {
|
||||
return;
|
||||
}
|
||||
inputStream.offer(encodedFrame, keyFrame, codec);
|
||||
}
|
||||
|
||||
private void transcode() {
|
||||
try {
|
||||
InputCodec inputCodec = inputStream.awaitInputCodec();
|
||||
grabber = new FFmpegFrameGrabber(inputStream, 0);
|
||||
grabber.setFormat(inputCodec.ffmpegFormat);
|
||||
grabber.setOption("fflags", "nobuffer");
|
||||
grabber.setOption("flags", "low_delay");
|
||||
grabber.setOption("probesize", "32768");
|
||||
// The codec and sequence headers are known before startup, so probing can stay disabled for live input.
|
||||
grabber.start(false);
|
||||
inputStream.markDecoderInitialized();
|
||||
|
||||
Frame frame = grabber.grabImage();
|
||||
if (frame == null) {
|
||||
throw new IllegalStateException("H.265码流未产生可解码图像");
|
||||
}
|
||||
int width = frame.imageWidth > 0 ? frame.imageWidth : grabber.getImageWidth();
|
||||
int height = frame.imageHeight > 0 ? frame.imageHeight : grabber.getImageHeight();
|
||||
if (width <= 0 || height <= 0) {
|
||||
throw new IllegalStateException("无法从H.265码流读取图像尺寸");
|
||||
}
|
||||
log.info("摄像头流{}识别到首帧: {}x{}", streamName, width, height);
|
||||
|
||||
double sourceFrameRate = configuredFrameRate;
|
||||
if (!Double.isFinite(sourceFrameRate) || sourceFrameRate <= 0) {
|
||||
sourceFrameRate = grabber.getFrameRate();
|
||||
}
|
||||
if (!Double.isFinite(sourceFrameRate) || sourceFrameRate <= 0) {
|
||||
sourceFrameRate = 25D;
|
||||
}
|
||||
sourceFrameRate = Math.max(5D, Math.min(sourceFrameRate, 60D));
|
||||
double outputFrameRate = Math.min(sourceFrameRate, 25D);
|
||||
int gopSize = Math.max(1, (int) Math.round(outputFrameRate * 0.4D));
|
||||
long sourceFrameDurationMicros = Math.max(1L, Math.round(1_000_000D / sourceFrameRate));
|
||||
long outputFrameDurationMicros = Math.max(1L, Math.round(1_000_000D / outputFrameRate));
|
||||
log.info("Camera stream {} uses {} source fps, {} output fps and a {} frame GOP",
|
||||
streamName, sourceFrameRate, outputFrameRate, gopSize);
|
||||
|
||||
recorder = new FFmpegFrameRecorder(outputStream, width, height, 0);
|
||||
recorder.setFormat("mp4");
|
||||
recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
|
||||
recorder.setFrameRate(outputFrameRate);
|
||||
recorder.setGopSize(gopSize);
|
||||
recorder.setVideoBitrate(4_000_000);
|
||||
recorder.setVideoOption("preset", "ultrafast");
|
||||
recorder.setVideoOption("tune", "zerolatency");
|
||||
recorder.setVideoOption("bf", "0");
|
||||
recorder.setOption("movflags", "frag_keyframe+empty_moov+default_base_moof+omit_tfhd_offset");
|
||||
recorder.setOption("frag_duration", "100000");
|
||||
recorder.setOption("flush_packets", "1");
|
||||
recorder.start();
|
||||
outputStream.publishAvailable();
|
||||
|
||||
long sourceFrameIndex = 0L;
|
||||
long nextOutputTimestampMicros = 0L;
|
||||
do {
|
||||
long sourceTimestampMicros = sourceFrameIndex * sourceFrameDurationMicros;
|
||||
if (sourceTimestampMicros + sourceFrameDurationMicros / 2 >= nextOutputTimestampMicros) {
|
||||
recorder.setTimestamp(nextOutputTimestampMicros);
|
||||
recorder.record(frame);
|
||||
nextOutputTimestampMicros += outputFrameDurationMicros;
|
||||
outputStream.publishAvailable();
|
||||
}
|
||||
sourceFrameIndex++;
|
||||
} while (!closed.get() && (frame = grabber.grabImage()) != null);
|
||||
} catch (Throwable throwable) {
|
||||
if (!closed.get()) {
|
||||
errorConsumer.accept(throwable);
|
||||
}
|
||||
} finally {
|
||||
releaseNativeResources();
|
||||
try {
|
||||
outputStream.publishAvailable();
|
||||
} catch (RuntimeException ignored) {
|
||||
}
|
||||
inputStream.close();
|
||||
closed.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
if (!closed.compareAndSet(false, true)) {
|
||||
return;
|
||||
}
|
||||
inputStream.close();
|
||||
worker.interrupt();
|
||||
}
|
||||
|
||||
private void releaseNativeResources() {
|
||||
FFmpegFrameRecorder currentRecorder = recorder;
|
||||
recorder = null;
|
||||
if (currentRecorder != null) {
|
||||
try {
|
||||
currentRecorder.stop();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
try {
|
||||
currentRecorder.release();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
FFmpegFrameGrabber currentGrabber = grabber;
|
||||
grabber = null;
|
||||
if (currentGrabber != null) {
|
||||
try {
|
||||
currentGrabber.stop();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
try {
|
||||
currentGrabber.release();
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum InputCodec {
|
||||
H264("h264", "H.264"),
|
||||
H265("hevc", "H.265");
|
||||
|
||||
private final String ffmpegFormat;
|
||||
private final String displayName;
|
||||
|
||||
InputCodec(String ffmpegFormat, String displayName) {
|
||||
this.ffmpegFormat = ffmpegFormat;
|
||||
this.displayName = displayName;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class LiveEncodedVideoInputStream extends InputStream {
|
||||
private final String streamName;
|
||||
private final int maxQueuedFrames;
|
||||
private final int maxQueuedBytes;
|
||||
private final Deque<EncodedFrame> queue = new ArrayDeque<>();
|
||||
private byte[] currentFrame;
|
||||
private int currentOffset;
|
||||
private int queuedBytes;
|
||||
private boolean droppingUntilKeyFrame;
|
||||
private boolean closed;
|
||||
private long droppedFrames;
|
||||
private long lastDropLogNanos;
|
||||
private InputCodec inputCodec;
|
||||
private boolean sequenceHeaderSeen;
|
||||
private boolean decoderStarted;
|
||||
private boolean decoderInitialized;
|
||||
private boolean h264SpsSeen;
|
||||
private boolean h264PpsSeen;
|
||||
private boolean framingNormalizationLogged;
|
||||
|
||||
private LiveEncodedVideoInputStream(String streamName, int maxQueuedFrames, int maxQueuedBytes) {
|
||||
this.streamName = streamName;
|
||||
this.maxQueuedFrames = maxQueuedFrames;
|
||||
this.maxQueuedBytes = maxQueuedBytes;
|
||||
}
|
||||
|
||||
private synchronized void offer(byte[] data, boolean keyFrame, String codecHint) throws IOException {
|
||||
if (closed) {
|
||||
return;
|
||||
}
|
||||
|
||||
byte[] normalizedData = normalizeToAnnexB(data, codecHint);
|
||||
if (normalizedData != data && !framingNormalizationLogged) {
|
||||
framingNormalizationLogged = true;
|
||||
log.info("Camera stream {} normalized {} packets to Annex-B framing", streamName, codecHint);
|
||||
}
|
||||
data = normalizedData;
|
||||
|
||||
InputCodec encodedFrameCodec = detectEncodedFrameCodec(data);
|
||||
InputCodec detectedCodec = encodedFrameCodec != null ? encodedFrameCodec : detectCodecHint(codecHint);
|
||||
if (detectedCodec != null) {
|
||||
if (inputCodec != null && inputCodec != detectedCodec) {
|
||||
throw new IOException("Camera stream codec changed from " + inputCodec.displayName
|
||||
+ " to " + detectedCodec.displayName + "; reconnect the stream");
|
||||
}
|
||||
if (inputCodec == null) {
|
||||
inputCodec = detectedCodec;
|
||||
log.info("Camera stream {} selected {} decoder (codec hint: {})",
|
||||
streamName, inputCodec.displayName,
|
||||
codecHint == null || codecHint.isBlank() ? "NAL detection" : codecHint);
|
||||
notifyAll();
|
||||
}
|
||||
}
|
||||
|
||||
boolean h264SpsFrame = inputCodec == InputCodec.H264 && containsNalType(data, InputCodec.H264, 7);
|
||||
boolean h264PpsFrame = inputCodec == InputCodec.H264 && containsNalType(data, InputCodec.H264, 8);
|
||||
boolean h265SpsFrame = inputCodec == InputCodec.H265 && containsNalType(data, InputCodec.H265, 33);
|
||||
boolean sequenceHeaderStart = h264SpsFrame || h265SpsFrame;
|
||||
if (sequenceHeaderStart && !decoderStarted) {
|
||||
int staleFrames = queue.size();
|
||||
queue.clear();
|
||||
queuedBytes = 0;
|
||||
droppingUntilKeyFrame = false;
|
||||
recordDrop(staleFrames);
|
||||
if (inputCodec == InputCodec.H264) {
|
||||
h264SpsSeen = false;
|
||||
h264PpsSeen = false;
|
||||
}
|
||||
}
|
||||
|
||||
boolean wasSequenceHeaderSeen = sequenceHeaderSeen;
|
||||
if (inputCodec == InputCodec.H264) {
|
||||
h264SpsSeen |= h264SpsFrame;
|
||||
h264PpsSeen |= h264PpsFrame;
|
||||
sequenceHeaderSeen = h264SpsSeen && h264PpsSeen;
|
||||
} else if (inputCodec == InputCodec.H265) {
|
||||
sequenceHeaderSeen |= h265SpsFrame;
|
||||
}
|
||||
if (!wasSequenceHeaderSeen && sequenceHeaderSeen) {
|
||||
log.info("Camera stream {} received the {} sequence header; decoder can start",
|
||||
streamName, inputCodec.displayName);
|
||||
}
|
||||
|
||||
if (droppingUntilKeyFrame) {
|
||||
if (!keyFrame) {
|
||||
recordDrop(1);
|
||||
return;
|
||||
}
|
||||
droppingUntilKeyFrame = false;
|
||||
}
|
||||
|
||||
boolean queueOverloaded = queue.size() >= maxQueuedFrames
|
||||
|| queuedBytes + data.length > maxQueuedBytes;
|
||||
boolean newerGopAvailable = decoderInitialized && keyFrame
|
||||
&& queue.size() >= Math.max(2, maxQueuedFrames / 2);
|
||||
if (queueOverloaded || newerGopAvailable) {
|
||||
int staleFrames = queue.size();
|
||||
queue.clear();
|
||||
queuedBytes = 0;
|
||||
recordDrop(staleFrames);
|
||||
if (!keyFrame) {
|
||||
droppingUntilKeyFrame = true;
|
||||
recordDrop(1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
queue.addLast(new EncodedFrame(data));
|
||||
queuedBytes += data.length;
|
||||
notifyAll();
|
||||
}
|
||||
|
||||
private synchronized InputCodec awaitInputCodec() throws IOException {
|
||||
while (!closed && (inputCodec == null || !sequenceHeaderSeen)) {
|
||||
try {
|
||||
wait();
|
||||
} catch (InterruptedException exception) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new IOException("Interrupted while waiting for camera codec", exception);
|
||||
}
|
||||
}
|
||||
if (inputCodec == null || !sequenceHeaderSeen) {
|
||||
throw new IOException("Camera stream closed before its H.264/H.265 sequence header was received");
|
||||
}
|
||||
decoderStarted = true;
|
||||
return inputCodec;
|
||||
}
|
||||
|
||||
private synchronized void markDecoderInitialized() {
|
||||
decoderInitialized = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int read() throws IOException {
|
||||
byte[] oneByte = new byte[1];
|
||||
int count = read(oneByte, 0, 1);
|
||||
return count < 0 ? -1 : oneByte[0] & 0xFF;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int read(byte[] target, int offset, int length) throws IOException {
|
||||
while (!closed && !ensureCurrentFrame()) {
|
||||
try {
|
||||
wait();
|
||||
} catch (InterruptedException exception) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new IOException("Interrupted while waiting for encoded video data", exception);
|
||||
}
|
||||
}
|
||||
if (!ensureCurrentFrame()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int count = Math.min(length, currentFrame.length - currentOffset);
|
||||
System.arraycopy(currentFrame, currentOffset, target, offset, count);
|
||||
currentOffset += count;
|
||||
if (currentOffset >= currentFrame.length) {
|
||||
currentFrame = null;
|
||||
currentOffset = 0;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized int available() {
|
||||
int currentBytes = currentFrame == null ? 0 : currentFrame.length - currentOffset;
|
||||
return currentBytes + queuedBytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void close() {
|
||||
closed = true;
|
||||
queue.clear();
|
||||
queuedBytes = 0;
|
||||
currentFrame = null;
|
||||
notifyAll();
|
||||
}
|
||||
|
||||
private boolean ensureCurrentFrame() {
|
||||
if (currentFrame != null && currentOffset < currentFrame.length) {
|
||||
return true;
|
||||
}
|
||||
EncodedFrame next = queue.pollFirst();
|
||||
if (next == null) {
|
||||
return false;
|
||||
}
|
||||
queuedBytes -= next.data.length;
|
||||
currentFrame = next.data;
|
||||
currentOffset = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void recordDrop(long count) {
|
||||
if (count <= 0) {
|
||||
return;
|
||||
}
|
||||
droppedFrames += count;
|
||||
long now = System.nanoTime();
|
||||
if (now - lastDropLogNanos >= 1_000_000_000L) {
|
||||
log.warn("Camera stream {} is behind; dropped {} stale encoded frames and will resume at the latest key frame",
|
||||
streamName, droppedFrames);
|
||||
droppedFrames = 0;
|
||||
lastDropLogNanos = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static byte[] normalizeToAnnexB(byte[] data, String codecHint) {
|
||||
if (hasAnnexBStartCode(data)) {
|
||||
return data;
|
||||
}
|
||||
|
||||
byte[] converted = convertLengthPrefixedToAnnexB(data);
|
||||
if (converted != null) {
|
||||
return converted;
|
||||
}
|
||||
|
||||
if (detectCodecHint(codecHint) != null) {
|
||||
byte[] prefixed = new byte[data.length + 4];
|
||||
prefixed[3] = 1;
|
||||
System.arraycopy(data, 0, prefixed, 4, data.length);
|
||||
return prefixed;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
private static boolean hasAnnexBStartCode(byte[] data) {
|
||||
int scanLimit = Math.min(data.length - 2, 8);
|
||||
for (int index = 0; index < scanLimit; index++) {
|
||||
if (startCodeLength(data, index) > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static byte[] convertLengthPrefixedToAnnexB(byte[] data) {
|
||||
if (data.length < 5) {
|
||||
return null;
|
||||
}
|
||||
int offset = 0;
|
||||
int nalCount = 0;
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream(data.length + 16);
|
||||
while (offset + 4 <= data.length) {
|
||||
long nalLength = ((long) (data[offset] & 0xFF) << 24)
|
||||
| ((long) (data[offset + 1] & 0xFF) << 16)
|
||||
| ((long) (data[offset + 2] & 0xFF) << 8)
|
||||
| (data[offset + 3] & 0xFFL);
|
||||
offset += 4;
|
||||
if (nalLength <= 0 || nalLength > data.length - offset) {
|
||||
return null;
|
||||
}
|
||||
output.write(0);
|
||||
output.write(0);
|
||||
output.write(0);
|
||||
output.write(1);
|
||||
output.write(data, offset, (int) nalLength);
|
||||
offset += (int) nalLength;
|
||||
nalCount++;
|
||||
}
|
||||
return offset == data.length && nalCount > 0 ? output.toByteArray() : null;
|
||||
}
|
||||
|
||||
private static InputCodec detectCodecHint(String codecHint) {
|
||||
if (codecHint != null && !codecHint.isBlank()) {
|
||||
String normalized = codecHint.trim().toLowerCase(Locale.ROOT);
|
||||
if (normalized.contains("h265") || normalized.contains("h.265")
|
||||
|| normalized.contains("hevc") || normalized.contains("hev1")
|
||||
|| normalized.contains("hvc1")) {
|
||||
return InputCodec.H265;
|
||||
}
|
||||
if (normalized.contains("h264") || normalized.contains("h.264")
|
||||
|| normalized.contains("avc") || normalized.contains("avc1")) {
|
||||
return InputCodec.H264;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static boolean containsNalType(byte[] data, InputCodec codec, int expectedType) {
|
||||
for (int index = 0; index + 3 < data.length; index++) {
|
||||
int startCodeLength = startCodeLength(data, index);
|
||||
if (startCodeLength > 0) {
|
||||
int nalType = nalType(codec, data[index + startCodeLength] & 0xFF);
|
||||
if (nalType == expectedType) {
|
||||
return true;
|
||||
}
|
||||
index += startCodeLength - 1;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private static int nalType(InputCodec codec, int header) {
|
||||
return codec == InputCodec.H264 ? header & 0x1F : (header >> 1) & 0x3F;
|
||||
}
|
||||
|
||||
private static InputCodec detectEncodedFrameCodec(byte[] data) {
|
||||
if (data == null || data.length == 0) {
|
||||
return null;
|
||||
}
|
||||
for (int index = 0; index + 3 < data.length; index++) {
|
||||
int startCodeLength = startCodeLength(data, index);
|
||||
if (startCodeLength > 0) {
|
||||
InputCodec codec = detectNalHeader(data[index + startCodeLength] & 0xFF);
|
||||
if (codec != null) {
|
||||
return codec;
|
||||
}
|
||||
index += startCodeLength - 1;
|
||||
}
|
||||
}
|
||||
|
||||
int offset = 0;
|
||||
while (offset + 5 <= data.length) {
|
||||
long nalLength = ((long) (data[offset] & 0xFF) << 24)
|
||||
| ((long) (data[offset + 1] & 0xFF) << 16)
|
||||
| ((long) (data[offset + 2] & 0xFF) << 8)
|
||||
| (data[offset + 3] & 0xFFL);
|
||||
if (nalLength <= 0 || nalLength > data.length - offset - 4L) {
|
||||
break;
|
||||
}
|
||||
InputCodec codec = detectNalHeader(data[offset + 4] & 0xFF);
|
||||
if (codec != null) {
|
||||
return codec;
|
||||
}
|
||||
offset += 4 + (int) nalLength;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static int startCodeLength(byte[] data, int index) {
|
||||
if (index + 2 < data.length && data[index] == 0 && data[index + 1] == 0) {
|
||||
if (data[index + 2] == 1) {
|
||||
return 3;
|
||||
}
|
||||
if (index + 3 < data.length && data[index + 2] == 0 && data[index + 3] == 1) {
|
||||
return 4;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
private static InputCodec detectNalHeader(int header) {
|
||||
int h264Type = header & 0x1F;
|
||||
if (h264Type == 7) {
|
||||
return InputCodec.H264;
|
||||
}
|
||||
int h265Type = (header >> 1) & 0x3F;
|
||||
if (h265Type == 33) {
|
||||
return InputCodec.H265;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static final class EncodedFrame {
|
||||
private final byte[] data;
|
||||
|
||||
private EncodedFrame(byte[] data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
private static final class MediaChunkOutputStream extends OutputStream {
|
||||
private final ByteArrayOutputStream buffer = new ByteArrayOutputStream(128 * 1024);
|
||||
private final Consumer<byte[]> consumer;
|
||||
|
||||
private MediaChunkOutputStream(Consumer<byte[]> consumer) {
|
||||
this.consumer = consumer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void write(int value) {
|
||||
buffer.write(value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void write(byte[] bytes, int offset, int length) {
|
||||
buffer.write(bytes, offset, length);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void flush() {
|
||||
publishAvailable();
|
||||
}
|
||||
|
||||
private synchronized void publishAvailable() {
|
||||
if (buffer.size() == 0) {
|
||||
return;
|
||||
}
|
||||
byte[] chunk = buffer.toByteArray();
|
||||
buffer.reset();
|
||||
consumer.accept(chunk);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib/README.md
Normal file
21
cmvr-iot-api/cmvr-iot-edge/cmvr-iot-grpc-lib/README.md
Normal file
@ -0,0 +1,21 @@
|
||||
# CMVR-ES Proto Contract
|
||||
|
||||
This module maintains a one-way mirror of protobuf definitions from the
|
||||
`xtkuang_dev` branch of the CMVR-ES repository.
|
||||
|
||||
During Maven's `initialize` phase, the build performs a shallow sparse clone
|
||||
of the upstream `protos/cmvr/api`, `protos/cmvr/msgs`, and
|
||||
`protos/cmvr/common` directories. These directories replace the local
|
||||
`src/main/proto/cmvr` mirror, and Java/gRPC sources are regenerated under
|
||||
`src/main/java/cmvr` so Maven and IDE compilation use the same files.
|
||||
|
||||
The build machine must have `git` installed and read access to the CMVR-ES
|
||||
SSH repository. The upstream repository and ref can be overridden when
|
||||
needed:
|
||||
|
||||
```shell
|
||||
mvn -Dcmvr.es.repository=<git-url> -Dcmvr.es.proto.ref=<branch-or-tag> compile
|
||||
```
|
||||
|
||||
Do not edit local proto or generated Java files. The next Maven build replaces
|
||||
them with the current upstream definitions.
|
||||
@ -10,6 +10,12 @@
|
||||
</parent>
|
||||
|
||||
<artifactId>cmvr-iot-grpc-lib</artifactId>
|
||||
|
||||
<properties>
|
||||
<cmvr.es.repository>ssh://git@192.168.28.10:10022/SmartBench/cmvr-es.git</cmvr.es.repository>
|
||||
<cmvr.es.proto.ref>xtkuang_dev</cmvr.es.proto.ref>
|
||||
<cmvr.es.checkout.dir>${project.build.directory}/cmvr-es</cmvr.es.checkout.dir>
|
||||
</properties>
|
||||
<description> cmvr-iot gRPC 公共 proto 生成库</description>
|
||||
|
||||
<dependencies>
|
||||
@ -52,6 +58,64 @@
|
||||
</extension>
|
||||
</extensions>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-antrun-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>fetch-cmvr-es-protos</id>
|
||||
<phase>initialize</phase>
|
||||
<configuration>
|
||||
<target>
|
||||
<delete dir="${cmvr.es.checkout.dir}" quiet="true"/>
|
||||
<mkdir dir="${project.build.directory}"/>
|
||||
<exec executable="git" failonerror="true">
|
||||
<arg value="clone"/>
|
||||
<arg value="--depth"/>
|
||||
<arg value="1"/>
|
||||
<arg value="--filter=blob:none"/>
|
||||
<arg value="--sparse"/>
|
||||
<arg value="--single-branch"/>
|
||||
<arg value="--branch"/>
|
||||
<arg value="${cmvr.es.proto.ref}"/>
|
||||
<arg value="${cmvr.es.repository}"/>
|
||||
<arg value="${cmvr.es.checkout.dir}"/>
|
||||
</exec>
|
||||
<exec executable="git" failonerror="true">
|
||||
<arg value="-C"/>
|
||||
<arg value="${cmvr.es.checkout.dir}"/>
|
||||
<arg value="sparse-checkout"/>
|
||||
<arg value="set"/>
|
||||
<arg value="protos/cmvr/api"/>
|
||||
<arg value="protos/cmvr/msgs"/>
|
||||
<arg value="protos/cmvr/common"/>
|
||||
</exec>
|
||||
<exec executable="git" failonerror="true">
|
||||
<arg value="-C"/>
|
||||
<arg value="${cmvr.es.checkout.dir}"/>
|
||||
<arg value="rev-parse"/>
|
||||
<arg value="HEAD"/>
|
||||
</exec>
|
||||
<delete dir="${basedir}/src/main/proto/cmvr" quiet="true"/>
|
||||
<copy todir="${basedir}/src/main/proto/cmvr/api">
|
||||
<fileset dir="${cmvr.es.checkout.dir}/protos/cmvr/api" includes="**/*.proto"/>
|
||||
</copy>
|
||||
<copy todir="${basedir}/src/main/proto/cmvr/msgs">
|
||||
<fileset dir="${cmvr.es.checkout.dir}/protos/cmvr/msgs" includes="**/*.proto"/>
|
||||
</copy>
|
||||
<copy todir="${basedir}/src/main/proto/cmvr/common">
|
||||
<fileset dir="${cmvr.es.checkout.dir}/protos/cmvr/common" includes="**/*.proto"/>
|
||||
</copy>
|
||||
<delete dir="${basedir}/src/main/java/cmvr" quiet="true"/>
|
||||
</target>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.xolstice.maven.plugins</groupId>
|
||||
<artifactId>protobuf-maven-plugin</artifactId>
|
||||
@ -60,10 +124,14 @@
|
||||
<protocArtifact>com.google.protobuf:protoc:3.21.7:exe:${os.detected.classifier}</protocArtifact>
|
||||
<pluginId>grpc-java</pluginId>
|
||||
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.52.0:exe:${os.detected.classifier}</pluginArtifact>
|
||||
<!-- 输出目录 -->
|
||||
<protoSourceRoot>${basedir}/src/main/proto</protoSourceRoot>
|
||||
<outputDirectory>${basedir}/src/main/java</outputDirectory>
|
||||
<!-- 每次执行命令时不清空之前生成的代码(追加的方式) -->
|
||||
<clearOutputDirectory>false</clearOutputDirectory>
|
||||
<includes>
|
||||
<include>cmvr/api/*.proto</include>
|
||||
<include>cmvr/msgs/*.proto</include>
|
||||
<include>cmvr/common/*.proto</include>
|
||||
</includes>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -263,6 +263,37 @@ public final class CameraServiceGrpc {
|
||||
return getStopRecordingMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.CameraCommand.ControlPtzCommand.Request,
|
||||
cmvr.api.CameraCommand.ControlPtzCommand.Feedback> getControlPtzMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "ControlPtz",
|
||||
requestType = cmvr.api.CameraCommand.ControlPtzCommand.Request.class,
|
||||
responseType = cmvr.api.CameraCommand.ControlPtzCommand.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.CameraCommand.ControlPtzCommand.Request,
|
||||
cmvr.api.CameraCommand.ControlPtzCommand.Feedback> getControlPtzMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.CameraCommand.ControlPtzCommand.Request, cmvr.api.CameraCommand.ControlPtzCommand.Feedback> getControlPtzMethod;
|
||||
if ((getControlPtzMethod = CameraServiceGrpc.getControlPtzMethod) == null) {
|
||||
synchronized (CameraServiceGrpc.class) {
|
||||
if ((getControlPtzMethod = CameraServiceGrpc.getControlPtzMethod) == null) {
|
||||
CameraServiceGrpc.getControlPtzMethod = getControlPtzMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.CameraCommand.ControlPtzCommand.Request, cmvr.api.CameraCommand.ControlPtzCommand.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ControlPtz"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.CameraCommand.ControlPtzCommand.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.CameraCommand.ControlPtzCommand.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new CameraServiceMethodDescriptorSupplier("ControlPtz"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getControlPtzMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.CameraCommand.GetRGBImageStreamCommand.Request,
|
||||
cmvr.api.CameraCommand.GetRGBImageStreamCommand.Feedback> getGetRGBImageStreamMethod;
|
||||
|
||||
@ -460,6 +491,13 @@ public final class CameraServiceGrpc {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getStopRecordingMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void controlPtz(cmvr.api.CameraCommand.ControlPtzCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.CameraCommand.ControlPtzCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getControlPtzMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<cmvr.api.CameraCommand.GetRGBImageStreamCommand.Request> getRGBImageStream(
|
||||
@ -539,6 +577,13 @@ public final class CameraServiceGrpc {
|
||||
cmvr.api.CameraCommand.StopCameraRecordingCommand.Request,
|
||||
cmvr.api.CameraCommand.StopCameraRecordingCommand.Feedback>(
|
||||
this, METHODID_STOP_RECORDING)))
|
||||
.addMethod(
|
||||
getControlPtzMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.CameraCommand.ControlPtzCommand.Request,
|
||||
cmvr.api.CameraCommand.ControlPtzCommand.Feedback>(
|
||||
this, METHODID_CONTROL_PTZ)))
|
||||
.addMethod(
|
||||
getGetRGBImageStreamMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
|
||||
@ -642,6 +687,14 @@ public final class CameraServiceGrpc {
|
||||
getChannel().newCall(getStopRecordingMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void controlPtz(cmvr.api.CameraCommand.ControlPtzCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.CameraCommand.ControlPtzCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getControlPtzMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<cmvr.api.CameraCommand.GetRGBImageStreamCommand.Request> getRGBImageStream(
|
||||
@ -736,6 +789,13 @@ public final class CameraServiceGrpc {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getStopRecordingMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.CameraCommand.ControlPtzCommand.Feedback controlPtz(cmvr.api.CameraCommand.ControlPtzCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getControlPtzMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -815,6 +875,14 @@ public final class CameraServiceGrpc {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getStopRecordingMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.CameraCommand.ControlPtzCommand.Feedback> controlPtz(
|
||||
cmvr.api.CameraCommand.ControlPtzCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getControlPtzMethod(), getCallOptions()), request);
|
||||
}
|
||||
}
|
||||
|
||||
private static final int METHODID_GET_STATUS = 0;
|
||||
@ -825,9 +893,10 @@ public final class CameraServiceGrpc {
|
||||
private static final int METHODID_GET_RGBDIMAGES = 5;
|
||||
private static final int METHODID_START_RECORDING = 6;
|
||||
private static final int METHODID_STOP_RECORDING = 7;
|
||||
private static final int METHODID_GET_RGBIMAGE_STREAM = 8;
|
||||
private static final int METHODID_GET_DEPTH_IMAGE_STREAM = 9;
|
||||
private static final int METHODID_GET_RGBDIMAGES_STREAM = 10;
|
||||
private static final int METHODID_CONTROL_PTZ = 8;
|
||||
private static final int METHODID_GET_RGBIMAGE_STREAM = 9;
|
||||
private static final int METHODID_GET_DEPTH_IMAGE_STREAM = 10;
|
||||
private static final int METHODID_GET_RGBDIMAGES_STREAM = 11;
|
||||
|
||||
private static final class MethodHandlers<Req, Resp> implements
|
||||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
||||
@ -878,6 +947,10 @@ public final class CameraServiceGrpc {
|
||||
serviceImpl.stopRecording((cmvr.api.CameraCommand.StopCameraRecordingCommand.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.CameraCommand.StopCameraRecordingCommand.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_CONTROL_PTZ:
|
||||
serviceImpl.controlPtz((cmvr.api.CameraCommand.ControlPtzCommand.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.CameraCommand.ControlPtzCommand.Feedback>) responseObserver);
|
||||
break;
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
@ -956,6 +1029,7 @@ public final class CameraServiceGrpc {
|
||||
.addMethod(getGetRGBDImagesMethod())
|
||||
.addMethod(getStartRecordingMethod())
|
||||
.addMethod(getStopRecordingMethod())
|
||||
.addMethod(getControlPtzMethod())
|
||||
.addMethod(getGetRGBImageStreamMethod())
|
||||
.addMethod(getGetDepthImageStreamMethod())
|
||||
.addMethod(getGetRGBDImagesStreamMethod())
|
||||
|
||||
@ -24,7 +24,7 @@ public final class CameraServiceOuterClass {
|
||||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\035cmvr/api/camera_service.proto\022\010cmvr.ap" +
|
||||
"i\032\035cmvr/api/camera_command.proto2\233\t\n\rCam" +
|
||||
"i\032\035cmvr/api/camera_command.proto2\366\t\n\rCam" +
|
||||
"eraService\022`\n\tGetStatus\022\'.cmvr.api.GetCa" +
|
||||
"meraStateCommand.Request\032(.cmvr.api.GetC" +
|
||||
"ameraStateCommand.Feedback\"\000\022\\\n\013StartCam" +
|
||||
@ -45,16 +45,18 @@ public final class CameraServiceOuterClass {
|
||||
"dingCommand.Feedback\"\000\022n\n\rStopRecording\022" +
|
||||
",.cmvr.api.StopCameraRecordingCommand.Re" +
|
||||
"quest\032-.cmvr.api.StopCameraRecordingComm" +
|
||||
"and.Feedback\"\000\022r\n\021GetRGBImageStream\022*.cm" +
|
||||
"vr.api.GetRGBImageStreamCommand.Request\032" +
|
||||
"+.cmvr.api.GetRGBImageStreamCommand.Feed" +
|
||||
"back\"\000(\0010\001\022x\n\023GetDepthImageStream\022,.cmvr" +
|
||||
".api.GetDepthImageStreamCommand.Request\032" +
|
||||
"-.cmvr.api.GetDepthImageStreamCommand.Fe" +
|
||||
"edback\"\000(\0010\001\022x\n\023GetRGBDImagesStream\022,.cm" +
|
||||
"vr.api.GetRGBDImagesStreamCommand.Reques" +
|
||||
"t\032-.cmvr.api.GetRGBDImagesStreamCommand." +
|
||||
"Feedback\"\000(\0010\001b\006proto3"
|
||||
"and.Feedback\"\000\022Y\n\nControlPtz\022#.cmvr.api." +
|
||||
"ControlPtzCommand.Request\032$.cmvr.api.Con" +
|
||||
"trolPtzCommand.Feedback\"\000\022r\n\021GetRGBImage" +
|
||||
"Stream\022*.cmvr.api.GetRGBImageStreamComma" +
|
||||
"nd.Request\032+.cmvr.api.GetRGBImageStreamC" +
|
||||
"ommand.Feedback\"\000(\0010\001\022x\n\023GetDepthImageSt" +
|
||||
"ream\022,.cmvr.api.GetDepthImageStreamComma" +
|
||||
"nd.Request\032-.cmvr.api.GetDepthImageStrea" +
|
||||
"mCommand.Feedback\"\000(\0010\001\022x\n\023GetRGBDImages" +
|
||||
"Stream\022,.cmvr.api.GetRGBDImagesStreamCom" +
|
||||
"mand.Request\032-.cmvr.api.GetRGBDImagesStr" +
|
||||
"eamCommand.Feedback\"\000(\0010\001b\006proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -596,8 +596,8 @@ public final class DexhandCommand {
|
||||
|
||||
}
|
||||
|
||||
public interface RH56DFTPDexHandOrBuilder extends
|
||||
// @@protoc_insertion_point(interface_extends:cmvr.api.RH56DFTPDexHand)
|
||||
public interface FreedomStateOrBuilder extends
|
||||
// @@protoc_insertion_point(interface_extends:cmvr.api.FreedomState)
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
@ -722,18 +722,18 @@ public final class DexhandCommand {
|
||||
getErrorMessageBytes(int index);
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code cmvr.api.RH56DFTPDexHand}
|
||||
* Protobuf type {@code cmvr.api.FreedomState}
|
||||
*/
|
||||
public static final class RH56DFTPDexHand extends
|
||||
public static final class FreedomState extends
|
||||
com.google.protobuf.GeneratedMessageV3 implements
|
||||
// @@protoc_insertion_point(message_implements:cmvr.api.RH56DFTPDexHand)
|
||||
RH56DFTPDexHandOrBuilder {
|
||||
// @@protoc_insertion_point(message_implements:cmvr.api.FreedomState)
|
||||
FreedomStateOrBuilder {
|
||||
private static final long serialVersionUID = 0L;
|
||||
// Use RH56DFTPDexHand.newBuilder() to construct.
|
||||
private RH56DFTPDexHand(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
|
||||
// Use FreedomState.newBuilder() to construct.
|
||||
private FreedomState(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
private RH56DFTPDexHand() {
|
||||
private FreedomState() {
|
||||
errorMessage_ = com.google.protobuf.LazyStringArrayList.EMPTY;
|
||||
}
|
||||
|
||||
@ -741,7 +741,7 @@ public final class DexhandCommand {
|
||||
@SuppressWarnings({"unused"})
|
||||
protected java.lang.Object newInstance(
|
||||
UnusedPrivateParameter unused) {
|
||||
return new RH56DFTPDexHand();
|
||||
return new FreedomState();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@ -751,15 +751,15 @@ public final class DexhandCommand {
|
||||
}
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return cmvr.api.DexhandCommand.internal_static_cmvr_api_RH56DFTPDexHand_descriptor;
|
||||
return cmvr.api.DexhandCommand.internal_static_cmvr_api_FreedomState_descriptor;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return cmvr.api.DexhandCommand.internal_static_cmvr_api_RH56DFTPDexHand_fieldAccessorTable
|
||||
return cmvr.api.DexhandCommand.internal_static_cmvr_api_FreedomState_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand.class, cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder.class);
|
||||
cmvr.api.DexhandCommand.FreedomState.class, cmvr.api.DexhandCommand.FreedomState.Builder.class);
|
||||
}
|
||||
|
||||
public static final int DOF_ID_FIELD_NUMBER = 1;
|
||||
@ -1033,10 +1033,10 @@ public final class DexhandCommand {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof cmvr.api.DexhandCommand.RH56DFTPDexHand)) {
|
||||
if (!(obj instanceof cmvr.api.DexhandCommand.FreedomState)) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand other = (cmvr.api.DexhandCommand.RH56DFTPDexHand) obj;
|
||||
cmvr.api.DexhandCommand.FreedomState other = (cmvr.api.DexhandCommand.FreedomState) obj;
|
||||
|
||||
if (getDofId()
|
||||
!= other.getDofId()) return false;
|
||||
@ -1092,69 +1092,69 @@ public final class DexhandCommand {
|
||||
return hash;
|
||||
}
|
||||
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseFrom(
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseFrom(
|
||||
java.nio.ByteBuffer data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseFrom(
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseFrom(
|
||||
java.nio.ByteBuffer data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseFrom(
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseFrom(
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseFrom(byte[] data)
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseFrom(
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseFrom(java.io.InputStream input)
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseFrom(
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseDelimitedFrom(java.io.InputStream input)
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseDelimitedWithIOException(PARSER, input);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseDelimitedFrom(
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseFrom(
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand parseFrom(
|
||||
public static cmvr.api.DexhandCommand.FreedomState parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
@ -1167,7 +1167,7 @@ public final class DexhandCommand {
|
||||
public static Builder newBuilder() {
|
||||
return DEFAULT_INSTANCE.toBuilder();
|
||||
}
|
||||
public static Builder newBuilder(cmvr.api.DexhandCommand.RH56DFTPDexHand prototype) {
|
||||
public static Builder newBuilder(cmvr.api.DexhandCommand.FreedomState prototype) {
|
||||
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
|
||||
}
|
||||
@java.lang.Override
|
||||
@ -1183,26 +1183,26 @@ public final class DexhandCommand {
|
||||
return builder;
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code cmvr.api.RH56DFTPDexHand}
|
||||
* Protobuf type {@code cmvr.api.FreedomState}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
|
||||
// @@protoc_insertion_point(builder_implements:cmvr.api.RH56DFTPDexHand)
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHandOrBuilder {
|
||||
// @@protoc_insertion_point(builder_implements:cmvr.api.FreedomState)
|
||||
cmvr.api.DexhandCommand.FreedomStateOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return cmvr.api.DexhandCommand.internal_static_cmvr_api_RH56DFTPDexHand_descriptor;
|
||||
return cmvr.api.DexhandCommand.internal_static_cmvr_api_FreedomState_descriptor;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return cmvr.api.DexhandCommand.internal_static_cmvr_api_RH56DFTPDexHand_fieldAccessorTable
|
||||
return cmvr.api.DexhandCommand.internal_static_cmvr_api_FreedomState_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand.class, cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder.class);
|
||||
cmvr.api.DexhandCommand.FreedomState.class, cmvr.api.DexhandCommand.FreedomState.Builder.class);
|
||||
}
|
||||
|
||||
// Construct using cmvr.api.DexhandCommand.RH56DFTPDexHand.newBuilder()
|
||||
// Construct using cmvr.api.DexhandCommand.FreedomState.newBuilder()
|
||||
private Builder() {
|
||||
|
||||
}
|
||||
@ -1239,17 +1239,17 @@ public final class DexhandCommand {
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return cmvr.api.DexhandCommand.internal_static_cmvr_api_RH56DFTPDexHand_descriptor;
|
||||
return cmvr.api.DexhandCommand.internal_static_cmvr_api_FreedomState_descriptor;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHand getDefaultInstanceForType() {
|
||||
return cmvr.api.DexhandCommand.RH56DFTPDexHand.getDefaultInstance();
|
||||
public cmvr.api.DexhandCommand.FreedomState getDefaultInstanceForType() {
|
||||
return cmvr.api.DexhandCommand.FreedomState.getDefaultInstance();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHand build() {
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand result = buildPartial();
|
||||
public cmvr.api.DexhandCommand.FreedomState build() {
|
||||
cmvr.api.DexhandCommand.FreedomState result = buildPartial();
|
||||
if (!result.isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
@ -1257,8 +1257,8 @@ public final class DexhandCommand {
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHand buildPartial() {
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand result = new cmvr.api.DexhandCommand.RH56DFTPDexHand(this);
|
||||
public cmvr.api.DexhandCommand.FreedomState buildPartial() {
|
||||
cmvr.api.DexhandCommand.FreedomState result = new cmvr.api.DexhandCommand.FreedomState(this);
|
||||
int from_bitField0_ = bitField0_;
|
||||
result.dofId_ = dofId_;
|
||||
result.angle_ = angle_;
|
||||
@ -1311,16 +1311,16 @@ public final class DexhandCommand {
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof cmvr.api.DexhandCommand.RH56DFTPDexHand) {
|
||||
return mergeFrom((cmvr.api.DexhandCommand.RH56DFTPDexHand)other);
|
||||
if (other instanceof cmvr.api.DexhandCommand.FreedomState) {
|
||||
return mergeFrom((cmvr.api.DexhandCommand.FreedomState)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(cmvr.api.DexhandCommand.RH56DFTPDexHand other) {
|
||||
if (other == cmvr.api.DexhandCommand.RH56DFTPDexHand.getDefaultInstance()) return this;
|
||||
public Builder mergeFrom(cmvr.api.DexhandCommand.FreedomState other) {
|
||||
if (other == cmvr.api.DexhandCommand.FreedomState.getDefaultInstance()) return this;
|
||||
if (other.getDofId() != 0) {
|
||||
setDofId(other.getDofId());
|
||||
}
|
||||
@ -1946,23 +1946,23 @@ public final class DexhandCommand {
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:cmvr.api.RH56DFTPDexHand)
|
||||
// @@protoc_insertion_point(builder_scope:cmvr.api.FreedomState)
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:cmvr.api.RH56DFTPDexHand)
|
||||
private static final cmvr.api.DexhandCommand.RH56DFTPDexHand DEFAULT_INSTANCE;
|
||||
// @@protoc_insertion_point(class_scope:cmvr.api.FreedomState)
|
||||
private static final cmvr.api.DexhandCommand.FreedomState DEFAULT_INSTANCE;
|
||||
static {
|
||||
DEFAULT_INSTANCE = new cmvr.api.DexhandCommand.RH56DFTPDexHand();
|
||||
DEFAULT_INSTANCE = new cmvr.api.DexhandCommand.FreedomState();
|
||||
}
|
||||
|
||||
public static cmvr.api.DexhandCommand.RH56DFTPDexHand getDefaultInstance() {
|
||||
public static cmvr.api.DexhandCommand.FreedomState getDefaultInstance() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Parser<RH56DFTPDexHand>
|
||||
PARSER = new com.google.protobuf.AbstractParser<RH56DFTPDexHand>() {
|
||||
private static final com.google.protobuf.Parser<FreedomState>
|
||||
PARSER = new com.google.protobuf.AbstractParser<FreedomState>() {
|
||||
@java.lang.Override
|
||||
public RH56DFTPDexHand parsePartialFrom(
|
||||
public FreedomState parsePartialFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
@ -1981,17 +1981,17 @@ public final class DexhandCommand {
|
||||
}
|
||||
};
|
||||
|
||||
public static com.google.protobuf.Parser<RH56DFTPDexHand> parser() {
|
||||
public static com.google.protobuf.Parser<FreedomState> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<RH56DFTPDexHand> getParserForType() {
|
||||
public com.google.protobuf.Parser<FreedomState> getParserForType() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHand getDefaultInstanceForType() {
|
||||
public cmvr.api.DexhandCommand.FreedomState getDefaultInstanceForType() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
@ -4577,24 +4577,24 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
java.util.List<cmvr.api.DexhandCommand.RH56DFTPDexHand>
|
||||
java.util.List<cmvr.api.DexhandCommand.FreedomState>
|
||||
getHandsList();
|
||||
/**
|
||||
* <pre>
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand getHands(int index);
|
||||
cmvr.api.DexhandCommand.FreedomState getHands(int index);
|
||||
/**
|
||||
* <pre>
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
int getHandsCount();
|
||||
/**
|
||||
@ -4602,18 +4602,18 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
java.util.List<? extends cmvr.api.DexhandCommand.RH56DFTPDexHandOrBuilder>
|
||||
java.util.List<? extends cmvr.api.DexhandCommand.FreedomStateOrBuilder>
|
||||
getHandsOrBuilderList();
|
||||
/**
|
||||
* <pre>
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHandOrBuilder getHandsOrBuilder(
|
||||
cmvr.api.DexhandCommand.FreedomStateOrBuilder getHandsOrBuilder(
|
||||
int index);
|
||||
}
|
||||
/**
|
||||
@ -4673,16 +4673,16 @@ public final class DexhandCommand {
|
||||
}
|
||||
|
||||
public static final int HANDS_FIELD_NUMBER = 2;
|
||||
private java.util.List<cmvr.api.DexhandCommand.RH56DFTPDexHand> hands_;
|
||||
private java.util.List<cmvr.api.DexhandCommand.FreedomState> hands_;
|
||||
/**
|
||||
* <pre>
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
public java.util.List<cmvr.api.DexhandCommand.RH56DFTPDexHand> getHandsList() {
|
||||
public java.util.List<cmvr.api.DexhandCommand.FreedomState> getHandsList() {
|
||||
return hands_;
|
||||
}
|
||||
/**
|
||||
@ -4690,10 +4690,10 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
public java.util.List<? extends cmvr.api.DexhandCommand.RH56DFTPDexHandOrBuilder>
|
||||
public java.util.List<? extends cmvr.api.DexhandCommand.FreedomStateOrBuilder>
|
||||
getHandsOrBuilderList() {
|
||||
return hands_;
|
||||
}
|
||||
@ -4702,7 +4702,7 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
public int getHandsCount() {
|
||||
@ -4713,10 +4713,10 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHand getHands(int index) {
|
||||
public cmvr.api.DexhandCommand.FreedomState getHands(int index) {
|
||||
return hands_.get(index);
|
||||
}
|
||||
/**
|
||||
@ -4724,10 +4724,10 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHandOrBuilder getHandsOrBuilder(
|
||||
public cmvr.api.DexhandCommand.FreedomStateOrBuilder getHandsOrBuilder(
|
||||
int index) {
|
||||
return hands_.get(index);
|
||||
}
|
||||
@ -5089,9 +5089,9 @@ public final class DexhandCommand {
|
||||
break;
|
||||
} // case 8
|
||||
case 18: {
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand m =
|
||||
cmvr.api.DexhandCommand.FreedomState m =
|
||||
input.readMessage(
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand.parser(),
|
||||
cmvr.api.DexhandCommand.FreedomState.parser(),
|
||||
extensionRegistry);
|
||||
if (handsBuilder_ == null) {
|
||||
ensureHandsIsMutable();
|
||||
@ -5161,26 +5161,26 @@ public final class DexhandCommand {
|
||||
return this;
|
||||
}
|
||||
|
||||
private java.util.List<cmvr.api.DexhandCommand.RH56DFTPDexHand> hands_ =
|
||||
private java.util.List<cmvr.api.DexhandCommand.FreedomState> hands_ =
|
||||
java.util.Collections.emptyList();
|
||||
private void ensureHandsIsMutable() {
|
||||
if (!((bitField0_ & 0x00000001) != 0)) {
|
||||
hands_ = new java.util.ArrayList<cmvr.api.DexhandCommand.RH56DFTPDexHand>(hands_);
|
||||
hands_ = new java.util.ArrayList<cmvr.api.DexhandCommand.FreedomState>(hands_);
|
||||
bitField0_ |= 0x00000001;
|
||||
}
|
||||
}
|
||||
|
||||
private com.google.protobuf.RepeatedFieldBuilderV3<
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand, cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder, cmvr.api.DexhandCommand.RH56DFTPDexHandOrBuilder> handsBuilder_;
|
||||
cmvr.api.DexhandCommand.FreedomState, cmvr.api.DexhandCommand.FreedomState.Builder, cmvr.api.DexhandCommand.FreedomStateOrBuilder> handsBuilder_;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public java.util.List<cmvr.api.DexhandCommand.RH56DFTPDexHand> getHandsList() {
|
||||
public java.util.List<cmvr.api.DexhandCommand.FreedomState> getHandsList() {
|
||||
if (handsBuilder_ == null) {
|
||||
return java.util.Collections.unmodifiableList(hands_);
|
||||
} else {
|
||||
@ -5192,7 +5192,7 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public int getHandsCount() {
|
||||
if (handsBuilder_ == null) {
|
||||
@ -5206,9 +5206,9 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHand getHands(int index) {
|
||||
public cmvr.api.DexhandCommand.FreedomState getHands(int index) {
|
||||
if (handsBuilder_ == null) {
|
||||
return hands_.get(index);
|
||||
} else {
|
||||
@ -5220,10 +5220,10 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public Builder setHands(
|
||||
int index, cmvr.api.DexhandCommand.RH56DFTPDexHand value) {
|
||||
int index, cmvr.api.DexhandCommand.FreedomState value) {
|
||||
if (handsBuilder_ == null) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
@ -5241,10 +5241,10 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public Builder setHands(
|
||||
int index, cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder builderForValue) {
|
||||
int index, cmvr.api.DexhandCommand.FreedomState.Builder builderForValue) {
|
||||
if (handsBuilder_ == null) {
|
||||
ensureHandsIsMutable();
|
||||
hands_.set(index, builderForValue.build());
|
||||
@ -5259,9 +5259,9 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public Builder addHands(cmvr.api.DexhandCommand.RH56DFTPDexHand value) {
|
||||
public Builder addHands(cmvr.api.DexhandCommand.FreedomState value) {
|
||||
if (handsBuilder_ == null) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
@ -5279,10 +5279,10 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public Builder addHands(
|
||||
int index, cmvr.api.DexhandCommand.RH56DFTPDexHand value) {
|
||||
int index, cmvr.api.DexhandCommand.FreedomState value) {
|
||||
if (handsBuilder_ == null) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
@ -5300,10 +5300,10 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public Builder addHands(
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder builderForValue) {
|
||||
cmvr.api.DexhandCommand.FreedomState.Builder builderForValue) {
|
||||
if (handsBuilder_ == null) {
|
||||
ensureHandsIsMutable();
|
||||
hands_.add(builderForValue.build());
|
||||
@ -5318,10 +5318,10 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public Builder addHands(
|
||||
int index, cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder builderForValue) {
|
||||
int index, cmvr.api.DexhandCommand.FreedomState.Builder builderForValue) {
|
||||
if (handsBuilder_ == null) {
|
||||
ensureHandsIsMutable();
|
||||
hands_.add(index, builderForValue.build());
|
||||
@ -5336,10 +5336,10 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public Builder addAllHands(
|
||||
java.lang.Iterable<? extends cmvr.api.DexhandCommand.RH56DFTPDexHand> values) {
|
||||
java.lang.Iterable<? extends cmvr.api.DexhandCommand.FreedomState> values) {
|
||||
if (handsBuilder_ == null) {
|
||||
ensureHandsIsMutable();
|
||||
com.google.protobuf.AbstractMessageLite.Builder.addAll(
|
||||
@ -5355,7 +5355,7 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public Builder clearHands() {
|
||||
if (handsBuilder_ == null) {
|
||||
@ -5372,7 +5372,7 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public Builder removeHands(int index) {
|
||||
if (handsBuilder_ == null) {
|
||||
@ -5389,9 +5389,9 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder getHandsBuilder(
|
||||
public cmvr.api.DexhandCommand.FreedomState.Builder getHandsBuilder(
|
||||
int index) {
|
||||
return getHandsFieldBuilder().getBuilder(index);
|
||||
}
|
||||
@ -5400,9 +5400,9 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHandOrBuilder getHandsOrBuilder(
|
||||
public cmvr.api.DexhandCommand.FreedomStateOrBuilder getHandsOrBuilder(
|
||||
int index) {
|
||||
if (handsBuilder_ == null) {
|
||||
return hands_.get(index); } else {
|
||||
@ -5414,9 +5414,9 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public java.util.List<? extends cmvr.api.DexhandCommand.RH56DFTPDexHandOrBuilder>
|
||||
public java.util.List<? extends cmvr.api.DexhandCommand.FreedomStateOrBuilder>
|
||||
getHandsOrBuilderList() {
|
||||
if (handsBuilder_ != null) {
|
||||
return handsBuilder_.getMessageOrBuilderList();
|
||||
@ -5429,41 +5429,41 @@ public final class DexhandCommand {
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder addHandsBuilder() {
|
||||
public cmvr.api.DexhandCommand.FreedomState.Builder addHandsBuilder() {
|
||||
return getHandsFieldBuilder().addBuilder(
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand.getDefaultInstance());
|
||||
cmvr.api.DexhandCommand.FreedomState.getDefaultInstance());
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder addHandsBuilder(
|
||||
public cmvr.api.DexhandCommand.FreedomState.Builder addHandsBuilder(
|
||||
int index) {
|
||||
return getHandsFieldBuilder().addBuilder(
|
||||
index, cmvr.api.DexhandCommand.RH56DFTPDexHand.getDefaultInstance());
|
||||
index, cmvr.api.DexhandCommand.FreedomState.getDefaultInstance());
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* 包含多个自由度状态
|
||||
* </pre>
|
||||
*
|
||||
* <code>repeated .cmvr.api.RH56DFTPDexHand hands = 2;</code>
|
||||
* <code>repeated .cmvr.api.FreedomState hands = 2;</code>
|
||||
*/
|
||||
public java.util.List<cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder>
|
||||
public java.util.List<cmvr.api.DexhandCommand.FreedomState.Builder>
|
||||
getHandsBuilderList() {
|
||||
return getHandsFieldBuilder().getBuilderList();
|
||||
}
|
||||
private com.google.protobuf.RepeatedFieldBuilderV3<
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand, cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder, cmvr.api.DexhandCommand.RH56DFTPDexHandOrBuilder>
|
||||
cmvr.api.DexhandCommand.FreedomState, cmvr.api.DexhandCommand.FreedomState.Builder, cmvr.api.DexhandCommand.FreedomStateOrBuilder>
|
||||
getHandsFieldBuilder() {
|
||||
if (handsBuilder_ == null) {
|
||||
handsBuilder_ = new com.google.protobuf.RepeatedFieldBuilderV3<
|
||||
cmvr.api.DexhandCommand.RH56DFTPDexHand, cmvr.api.DexhandCommand.RH56DFTPDexHand.Builder, cmvr.api.DexhandCommand.RH56DFTPDexHandOrBuilder>(
|
||||
cmvr.api.DexhandCommand.FreedomState, cmvr.api.DexhandCommand.FreedomState.Builder, cmvr.api.DexhandCommand.FreedomStateOrBuilder>(
|
||||
hands_,
|
||||
((bitField0_ & 0x00000001) != 0),
|
||||
getParentForChildren(),
|
||||
@ -21035,10 +21035,10 @@ public final class DexhandCommand {
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internal_static_cmvr_api_FreedomValue_fieldAccessorTable;
|
||||
private static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_cmvr_api_RH56DFTPDexHand_descriptor;
|
||||
internal_static_cmvr_api_FreedomState_descriptor;
|
||||
private static final
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internal_static_cmvr_api_RH56DFTPDexHand_fieldAccessorTable;
|
||||
internal_static_cmvr_api_FreedomState_fieldAccessorTable;
|
||||
private static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_cmvr_api_SensorData_descriptor;
|
||||
private static final
|
||||
@ -21185,61 +21185,61 @@ public final class DexhandCommand {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\036cmvr/api/dexhand_command.proto\022\010cmvr.a" +
|
||||
"pi\032\025cmvr/api/common.proto\")\n\014FreedomValu" +
|
||||
"e\022\n\n\002id\030\001 \001(\005\022\r\n\005value\030\002 \001(\002\"\254\001\n\017RH56DFT" +
|
||||
"PDexHand\022\016\n\006dof_id\030\001 \001(\005\022\r\n\005angle\030\002 \001(\005\022" +
|
||||
"\r\n\005speed\030\003 \001(\005\022\r\n\005force\030\004 \001(\005\022\020\n\010positio" +
|
||||
"n\030\005 \001(\005\022\017\n\007current\030\006 \001(\005\022\023\n\013temperature\030" +
|
||||
"\007 \001(\005\022\r\n\005error\030\010 \001(\005\022\025\n\rerror_message\030\t " +
|
||||
"\003(\t\"\220\003\n\nSensorData\0224\n\013finger_type\030\004 \001(\0162" +
|
||||
"\037.cmvr.api.SensorData.FingerType\0220\n\tpart" +
|
||||
"_type\030\005 \001(\0162\035.cmvr.api.SensorData.PartTy" +
|
||||
"pe\022\023\n\013sensor_name\030\006 \001(\t\022*\n\004data\030\001 \003(\0132\034." +
|
||||
"cmvr.api.SensorData.RowData\022\014\n\004rows\030\002 \001(" +
|
||||
"\005\022\014\n\004cols\030\003 \001(\005\032\035\n\007RowData\022\022\n\006values\030\001 \003" +
|
||||
"(\005B\002\020\001\"T\n\nFingerType\022\t\n\005PINKY\020\000\022\010\n\004RING\020" +
|
||||
"\001\022\021\n\rMIDDLE_FINGER\020\002\022\t\n\005INDEX\020\003\022\t\n\005THUMB" +
|
||||
"\020\004\022\010\n\004PALM\020\005\"H\n\010PartType\022\007\n\003TIP\020\000\022\n\n\006FIN" +
|
||||
"GER\020\001\022\007\n\003PAD\020\002\022\020\n\014THUMB_MIDDLE\020\003\022\014\n\010PALM" +
|
||||
"_PAD\020\004\"P\n\014DexHandState\022\026\n\016is_initialized" +
|
||||
"\030\001 \001(\010\022(\n\005hands\030\002 \003(\0132\031.cmvr.api.RH56DFT" +
|
||||
"PDexHand\"\271\001\n\026GetDexHandStateCommand\032:\n\007R" +
|
||||
"equest\022/\n\006header\030\001 \001(\0132\037.cmvr.api.Comman" +
|
||||
"dHeader.Request\032c\n\010Feedback\0220\n\006header\030\001 " +
|
||||
"\001(\0132 .cmvr.api.CommandHeader.Feedback\022%\n" +
|
||||
"\005state\030\002 \001(\0132\026.cmvr.api.DexHandState\"\276\001\n" +
|
||||
"\032SetDexHandPositionsCommand\032b\n\007Request\022/" +
|
||||
"\n\006header\030\001 \001(\0132\037.cmvr.api.CommandHeader." +
|
||||
"Request\022&\n\006values\030\002 \003(\0132\026.cmvr.api.Freed" +
|
||||
"omValue\032<\n\010Feedback\0220\n\006header\030\001 \001(\0132 .cm" +
|
||||
"vr.api.CommandHeader.Feedback\"\273\001\n\027SetDex" +
|
||||
"HandAnglesCommand\032b\n\007Request\022/\n\006header\030\001" +
|
||||
" \001(\0132\037.cmvr.api.CommandHeader.Request\022&\n" +
|
||||
"\006values\030\002 \003(\0132\026.cmvr.api.FreedomValue\032<\n" +
|
||||
"\010Feedback\0220\n\006header\030\001 \001(\0132 .cmvr.api.Com" +
|
||||
"mandHeader.Feedback\"\272\001\n\026SetDexHandForceC" +
|
||||
"ommand\032b\n\007Request\022/\n\006header\030\001 \001(\0132\037.cmvr" +
|
||||
".api.CommandHeader.Request\022&\n\006values\030\002 \003" +
|
||||
"(\0132\026.cmvr.api.FreedomValue\032<\n\010Feedback\0220" +
|
||||
"\n\006header\030\001 \001(\0132 .cmvr.api.CommandHeader." +
|
||||
"Feedback\"\272\001\n\026SetDexHandSpeedCommand\032b\n\007R" +
|
||||
"equest\022/\n\006header\030\001 \001(\0132\037.cmvr.api.Comman" +
|
||||
"dHeader.Request\022&\n\006values\030\002 \003(\0132\026.cmvr.a" +
|
||||
"pi.FreedomValue\032<\n\010Feedback\0220\n\006header\030\001 " +
|
||||
"\001(\0132 .cmvr.api.CommandHeader.Feedback\"\253\001" +
|
||||
"\n\032SetDexHandPresetActCommand\032O\n\007Request\022" +
|
||||
"/\n\006header\030\001 \001(\0132\037.cmvr.api.CommandHeader" +
|
||||
".Request\022\023\n\013presetActId\030\002 \001(\005\032<\n\010Feedbac" +
|
||||
"k\0220\n\006header\030\001 \001(\0132 .cmvr.api.CommandHead" +
|
||||
"er.Feedback\"\266\001\n\024GetSensorDataCommand\032:\n\007" +
|
||||
"Request\022/\n\006header\030\001 \001(\0132\037.cmvr.api.Comma" +
|
||||
"ndHeader.Request\032b\n\010Feedback\0220\n\006header\030\001" +
|
||||
" \001(\0132 .cmvr.api.CommandHeader.Feedback\022$" +
|
||||
"\n\006sensor\030\002 \003(\0132\024.cmvr.api.SensorData\"\274\001\n" +
|
||||
"\032GetSensorDataStreamCommand\032:\n\007Request\022/" +
|
||||
"\n\006header\030\001 \001(\0132\037.cmvr.api.CommandHeader." +
|
||||
"Request\032b\n\010Feedback\0220\n\006header\030\001 \001(\0132 .cm" +
|
||||
"vr.api.CommandHeader.Feedback\022$\n\006sensor\030" +
|
||||
"\002 \003(\0132\024.cmvr.api.SensorDatab\006proto3"
|
||||
"e\022\n\n\002id\030\001 \001(\005\022\r\n\005value\030\002 \001(\002\"\251\001\n\014Freedom" +
|
||||
"State\022\016\n\006dof_id\030\001 \001(\005\022\r\n\005angle\030\002 \001(\005\022\r\n\005" +
|
||||
"speed\030\003 \001(\005\022\r\n\005force\030\004 \001(\005\022\020\n\010position\030\005" +
|
||||
" \001(\005\022\017\n\007current\030\006 \001(\005\022\023\n\013temperature\030\007 \001" +
|
||||
"(\005\022\r\n\005error\030\010 \001(\005\022\025\n\rerror_message\030\t \003(\t" +
|
||||
"\"\220\003\n\nSensorData\0224\n\013finger_type\030\004 \001(\0162\037.c" +
|
||||
"mvr.api.SensorData.FingerType\0220\n\tpart_ty" +
|
||||
"pe\030\005 \001(\0162\035.cmvr.api.SensorData.PartType\022" +
|
||||
"\023\n\013sensor_name\030\006 \001(\t\022*\n\004data\030\001 \003(\0132\034.cmv" +
|
||||
"r.api.SensorData.RowData\022\014\n\004rows\030\002 \001(\005\022\014" +
|
||||
"\n\004cols\030\003 \001(\005\032\035\n\007RowData\022\022\n\006values\030\001 \003(\005B" +
|
||||
"\002\020\001\"T\n\nFingerType\022\t\n\005PINKY\020\000\022\010\n\004RING\020\001\022\021" +
|
||||
"\n\rMIDDLE_FINGER\020\002\022\t\n\005INDEX\020\003\022\t\n\005THUMB\020\004\022" +
|
||||
"\010\n\004PALM\020\005\"H\n\010PartType\022\007\n\003TIP\020\000\022\n\n\006FINGER" +
|
||||
"\020\001\022\007\n\003PAD\020\002\022\020\n\014THUMB_MIDDLE\020\003\022\014\n\010PALM_PA" +
|
||||
"D\020\004\"M\n\014DexHandState\022\026\n\016is_initialized\030\001 " +
|
||||
"\001(\010\022%\n\005hands\030\002 \003(\0132\026.cmvr.api.FreedomSta" +
|
||||
"te\"\271\001\n\026GetDexHandStateCommand\032:\n\007Request" +
|
||||
"\022/\n\006header\030\001 \001(\0132\037.cmvr.api.CommandHeade" +
|
||||
"r.Request\032c\n\010Feedback\0220\n\006header\030\001 \001(\0132 ." +
|
||||
"cmvr.api.CommandHeader.Feedback\022%\n\005state" +
|
||||
"\030\002 \001(\0132\026.cmvr.api.DexHandState\"\276\001\n\032SetDe" +
|
||||
"xHandPositionsCommand\032b\n\007Request\022/\n\006head" +
|
||||
"er\030\001 \001(\0132\037.cmvr.api.CommandHeader.Reques" +
|
||||
"t\022&\n\006values\030\002 \003(\0132\026.cmvr.api.FreedomValu" +
|
||||
"e\032<\n\010Feedback\0220\n\006header\030\001 \001(\0132 .cmvr.api" +
|
||||
".CommandHeader.Feedback\"\273\001\n\027SetDexHandAn" +
|
||||
"glesCommand\032b\n\007Request\022/\n\006header\030\001 \001(\0132\037" +
|
||||
".cmvr.api.CommandHeader.Request\022&\n\006value" +
|
||||
"s\030\002 \003(\0132\026.cmvr.api.FreedomValue\032<\n\010Feedb" +
|
||||
"ack\0220\n\006header\030\001 \001(\0132 .cmvr.api.CommandHe" +
|
||||
"ader.Feedback\"\272\001\n\026SetDexHandForceCommand" +
|
||||
"\032b\n\007Request\022/\n\006header\030\001 \001(\0132\037.cmvr.api.C" +
|
||||
"ommandHeader.Request\022&\n\006values\030\002 \003(\0132\026.c" +
|
||||
"mvr.api.FreedomValue\032<\n\010Feedback\0220\n\006head" +
|
||||
"er\030\001 \001(\0132 .cmvr.api.CommandHeader.Feedba" +
|
||||
"ck\"\272\001\n\026SetDexHandSpeedCommand\032b\n\007Request" +
|
||||
"\022/\n\006header\030\001 \001(\0132\037.cmvr.api.CommandHeade" +
|
||||
"r.Request\022&\n\006values\030\002 \003(\0132\026.cmvr.api.Fre" +
|
||||
"edomValue\032<\n\010Feedback\0220\n\006header\030\001 \001(\0132 ." +
|
||||
"cmvr.api.CommandHeader.Feedback\"\253\001\n\032SetD" +
|
||||
"exHandPresetActCommand\032O\n\007Request\022/\n\006hea" +
|
||||
"der\030\001 \001(\0132\037.cmvr.api.CommandHeader.Reque" +
|
||||
"st\022\023\n\013presetActId\030\002 \001(\005\032<\n\010Feedback\0220\n\006h" +
|
||||
"eader\030\001 \001(\0132 .cmvr.api.CommandHeader.Fee" +
|
||||
"dback\"\266\001\n\024GetSensorDataCommand\032:\n\007Reques" +
|
||||
"t\022/\n\006header\030\001 \001(\0132\037.cmvr.api.CommandHead" +
|
||||
"er.Request\032b\n\010Feedback\0220\n\006header\030\001 \001(\0132 " +
|
||||
".cmvr.api.CommandHeader.Feedback\022$\n\006sens" +
|
||||
"or\030\002 \003(\0132\024.cmvr.api.SensorData\"\274\001\n\032GetSe" +
|
||||
"nsorDataStreamCommand\032:\n\007Request\022/\n\006head" +
|
||||
"er\030\001 \001(\0132\037.cmvr.api.CommandHeader.Reques" +
|
||||
"t\032b\n\010Feedback\0220\n\006header\030\001 \001(\0132 .cmvr.api" +
|
||||
".CommandHeader.Feedback\022$\n\006sensor\030\002 \003(\0132" +
|
||||
"\024.cmvr.api.SensorDatab\006proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
@ -21252,11 +21252,11 @@ public final class DexhandCommand {
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
|
||||
internal_static_cmvr_api_FreedomValue_descriptor,
|
||||
new java.lang.String[] { "Id", "Value", });
|
||||
internal_static_cmvr_api_RH56DFTPDexHand_descriptor =
|
||||
internal_static_cmvr_api_FreedomState_descriptor =
|
||||
getDescriptor().getMessageTypes().get(1);
|
||||
internal_static_cmvr_api_RH56DFTPDexHand_fieldAccessorTable = new
|
||||
internal_static_cmvr_api_FreedomState_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
|
||||
internal_static_cmvr_api_RH56DFTPDexHand_descriptor,
|
||||
internal_static_cmvr_api_FreedomState_descriptor,
|
||||
new java.lang.String[] { "DofId", "Angle", "Speed", "Force", "Position", "Current", "Temperature", "Error", "ErrorMessage", });
|
||||
internal_static_cmvr_api_SensorData_descriptor =
|
||||
getDescriptor().getMessageTypes().get(2);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,836 @@
|
||||
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/motor_service.proto")
|
||||
@io.grpc.stub.annotations.GrpcGenerated
|
||||
public final class MotorServiceGrpc {
|
||||
|
||||
private MotorServiceGrpc() {}
|
||||
|
||||
public static final String SERVICE_NAME = "cmvr.api.MotorService";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.MotorCommand.SetMotorZeroRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getSetZeroMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "setZero",
|
||||
requestType = cmvr.api.MotorCommand.SetMotorZeroRequest.class,
|
||||
responseType = cmvr.api.MotorCommand.MotorCommandResponse.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.MotorCommand.SetMotorZeroRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getSetZeroMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.MotorCommand.SetMotorZeroRequest, cmvr.api.MotorCommand.MotorCommandResponse> getSetZeroMethod;
|
||||
if ((getSetZeroMethod = MotorServiceGrpc.getSetZeroMethod) == null) {
|
||||
synchronized (MotorServiceGrpc.class) {
|
||||
if ((getSetZeroMethod = MotorServiceGrpc.getSetZeroMethod) == null) {
|
||||
MotorServiceGrpc.getSetZeroMethod = getSetZeroMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.MotorCommand.SetMotorZeroRequest, cmvr.api.MotorCommand.MotorCommandResponse>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "setZero"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.SetMotorZeroRequest.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.MotorCommandResponse.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new MotorServiceMethodDescriptorSupplier("setZero"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getSetZeroMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.MotorCommand.MoveMotorToZeroRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getMoveToZeroMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "moveToZero",
|
||||
requestType = cmvr.api.MotorCommand.MoveMotorToZeroRequest.class,
|
||||
responseType = cmvr.api.MotorCommand.MotorCommandResponse.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.MotorCommand.MoveMotorToZeroRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getMoveToZeroMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.MotorCommand.MoveMotorToZeroRequest, cmvr.api.MotorCommand.MotorCommandResponse> getMoveToZeroMethod;
|
||||
if ((getMoveToZeroMethod = MotorServiceGrpc.getMoveToZeroMethod) == null) {
|
||||
synchronized (MotorServiceGrpc.class) {
|
||||
if ((getMoveToZeroMethod = MotorServiceGrpc.getMoveToZeroMethod) == null) {
|
||||
MotorServiceGrpc.getMoveToZeroMethod = getMoveToZeroMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.MotorCommand.MoveMotorToZeroRequest, cmvr.api.MotorCommand.MotorCommandResponse>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "moveToZero"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.MoveMotorToZeroRequest.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.MotorCommandResponse.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new MotorServiceMethodDescriptorSupplier("moveToZero"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getMoveToZeroMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.MotorCommand.ProfilePositionRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getProfilePositionMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "profilePosition",
|
||||
requestType = cmvr.api.MotorCommand.ProfilePositionRequest.class,
|
||||
responseType = cmvr.api.MotorCommand.MotorCommandResponse.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.MotorCommand.ProfilePositionRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getProfilePositionMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.MotorCommand.ProfilePositionRequest, cmvr.api.MotorCommand.MotorCommandResponse> getProfilePositionMethod;
|
||||
if ((getProfilePositionMethod = MotorServiceGrpc.getProfilePositionMethod) == null) {
|
||||
synchronized (MotorServiceGrpc.class) {
|
||||
if ((getProfilePositionMethod = MotorServiceGrpc.getProfilePositionMethod) == null) {
|
||||
MotorServiceGrpc.getProfilePositionMethod = getProfilePositionMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.MotorCommand.ProfilePositionRequest, cmvr.api.MotorCommand.MotorCommandResponse>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "profilePosition"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.ProfilePositionRequest.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.MotorCommandResponse.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new MotorServiceMethodDescriptorSupplier("profilePosition"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getProfilePositionMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.MotorCommand.ProfileVelocityRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getProfileVelocityMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "profileVelocity",
|
||||
requestType = cmvr.api.MotorCommand.ProfileVelocityRequest.class,
|
||||
responseType = cmvr.api.MotorCommand.MotorCommandResponse.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.MotorCommand.ProfileVelocityRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getProfileVelocityMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.MotorCommand.ProfileVelocityRequest, cmvr.api.MotorCommand.MotorCommandResponse> getProfileVelocityMethod;
|
||||
if ((getProfileVelocityMethod = MotorServiceGrpc.getProfileVelocityMethod) == null) {
|
||||
synchronized (MotorServiceGrpc.class) {
|
||||
if ((getProfileVelocityMethod = MotorServiceGrpc.getProfileVelocityMethod) == null) {
|
||||
MotorServiceGrpc.getProfileVelocityMethod = getProfileVelocityMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.MotorCommand.ProfileVelocityRequest, cmvr.api.MotorCommand.MotorCommandResponse>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "profileVelocity"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.ProfileVelocityRequest.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.MotorCommandResponse.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new MotorServiceMethodDescriptorSupplier("profileVelocity"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getProfileVelocityMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.MotorCommand.CyclicPositionRequest,
|
||||
cmvr.api.MotorCommand.CyclicControlResponse> getStreamCyclicPositionMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "streamCyclicPosition",
|
||||
requestType = cmvr.api.MotorCommand.CyclicPositionRequest.class,
|
||||
responseType = cmvr.api.MotorCommand.CyclicControlResponse.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.MotorCommand.CyclicPositionRequest,
|
||||
cmvr.api.MotorCommand.CyclicControlResponse> getStreamCyclicPositionMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.MotorCommand.CyclicPositionRequest, cmvr.api.MotorCommand.CyclicControlResponse> getStreamCyclicPositionMethod;
|
||||
if ((getStreamCyclicPositionMethod = MotorServiceGrpc.getStreamCyclicPositionMethod) == null) {
|
||||
synchronized (MotorServiceGrpc.class) {
|
||||
if ((getStreamCyclicPositionMethod = MotorServiceGrpc.getStreamCyclicPositionMethod) == null) {
|
||||
MotorServiceGrpc.getStreamCyclicPositionMethod = getStreamCyclicPositionMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.MotorCommand.CyclicPositionRequest, cmvr.api.MotorCommand.CyclicControlResponse>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "streamCyclicPosition"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.CyclicPositionRequest.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.CyclicControlResponse.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new MotorServiceMethodDescriptorSupplier("streamCyclicPosition"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getStreamCyclicPositionMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.MotorCommand.CyclicVelocityRequest,
|
||||
cmvr.api.MotorCommand.CyclicControlResponse> getStreamCyclicVelocityMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "streamCyclicVelocity",
|
||||
requestType = cmvr.api.MotorCommand.CyclicVelocityRequest.class,
|
||||
responseType = cmvr.api.MotorCommand.CyclicControlResponse.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.MotorCommand.CyclicVelocityRequest,
|
||||
cmvr.api.MotorCommand.CyclicControlResponse> getStreamCyclicVelocityMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.MotorCommand.CyclicVelocityRequest, cmvr.api.MotorCommand.CyclicControlResponse> getStreamCyclicVelocityMethod;
|
||||
if ((getStreamCyclicVelocityMethod = MotorServiceGrpc.getStreamCyclicVelocityMethod) == null) {
|
||||
synchronized (MotorServiceGrpc.class) {
|
||||
if ((getStreamCyclicVelocityMethod = MotorServiceGrpc.getStreamCyclicVelocityMethod) == null) {
|
||||
MotorServiceGrpc.getStreamCyclicVelocityMethod = getStreamCyclicVelocityMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.MotorCommand.CyclicVelocityRequest, cmvr.api.MotorCommand.CyclicControlResponse>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "streamCyclicVelocity"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.CyclicVelocityRequest.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.CyclicControlResponse.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new MotorServiceMethodDescriptorSupplier("streamCyclicVelocity"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getStreamCyclicVelocityMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.MotorCommand.EmergencyStopRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getEmergencyStopMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "emergencyStop",
|
||||
requestType = cmvr.api.MotorCommand.EmergencyStopRequest.class,
|
||||
responseType = cmvr.api.MotorCommand.MotorCommandResponse.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.MotorCommand.EmergencyStopRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getEmergencyStopMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.MotorCommand.EmergencyStopRequest, cmvr.api.MotorCommand.MotorCommandResponse> getEmergencyStopMethod;
|
||||
if ((getEmergencyStopMethod = MotorServiceGrpc.getEmergencyStopMethod) == null) {
|
||||
synchronized (MotorServiceGrpc.class) {
|
||||
if ((getEmergencyStopMethod = MotorServiceGrpc.getEmergencyStopMethod) == null) {
|
||||
MotorServiceGrpc.getEmergencyStopMethod = getEmergencyStopMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.MotorCommand.EmergencyStopRequest, cmvr.api.MotorCommand.MotorCommandResponse>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "emergencyStop"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.EmergencyStopRequest.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.MotorCommandResponse.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new MotorServiceMethodDescriptorSupplier("emergencyStop"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getEmergencyStopMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.MotorCommand.GetMotorStatusRequest,
|
||||
cmvr.api.MotorCommand.GetMotorStatusResponse> getGetStatusMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "getStatus",
|
||||
requestType = cmvr.api.MotorCommand.GetMotorStatusRequest.class,
|
||||
responseType = cmvr.api.MotorCommand.GetMotorStatusResponse.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.MotorCommand.GetMotorStatusRequest,
|
||||
cmvr.api.MotorCommand.GetMotorStatusResponse> getGetStatusMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.MotorCommand.GetMotorStatusRequest, cmvr.api.MotorCommand.GetMotorStatusResponse> getGetStatusMethod;
|
||||
if ((getGetStatusMethod = MotorServiceGrpc.getGetStatusMethod) == null) {
|
||||
synchronized (MotorServiceGrpc.class) {
|
||||
if ((getGetStatusMethod = MotorServiceGrpc.getGetStatusMethod) == null) {
|
||||
MotorServiceGrpc.getGetStatusMethod = getGetStatusMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.MotorCommand.GetMotorStatusRequest, cmvr.api.MotorCommand.GetMotorStatusResponse>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "getStatus"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.GetMotorStatusRequest.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.GetMotorStatusResponse.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new MotorServiceMethodDescriptorSupplier("getStatus"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getGetStatusMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.MotorCommand.SetMotorEnabledRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getSetEnabledMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "setEnabled",
|
||||
requestType = cmvr.api.MotorCommand.SetMotorEnabledRequest.class,
|
||||
responseType = cmvr.api.MotorCommand.MotorCommandResponse.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.MotorCommand.SetMotorEnabledRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse> getSetEnabledMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.MotorCommand.SetMotorEnabledRequest, cmvr.api.MotorCommand.MotorCommandResponse> getSetEnabledMethod;
|
||||
if ((getSetEnabledMethod = MotorServiceGrpc.getSetEnabledMethod) == null) {
|
||||
synchronized (MotorServiceGrpc.class) {
|
||||
if ((getSetEnabledMethod = MotorServiceGrpc.getSetEnabledMethod) == null) {
|
||||
MotorServiceGrpc.getSetEnabledMethod = getSetEnabledMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.MotorCommand.SetMotorEnabledRequest, cmvr.api.MotorCommand.MotorCommandResponse>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "setEnabled"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.SetMotorEnabledRequest.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.MotorCommand.MotorCommandResponse.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new MotorServiceMethodDescriptorSupplier("setEnabled"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getSetEnabledMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new async stub that supports all call types for the service
|
||||
*/
|
||||
public static MotorServiceStub newStub(io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<MotorServiceStub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<MotorServiceStub>() {
|
||||
@java.lang.Override
|
||||
public MotorServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MotorServiceStub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return MotorServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
public static MotorServiceBlockingStub newBlockingStub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<MotorServiceBlockingStub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<MotorServiceBlockingStub>() {
|
||||
@java.lang.Override
|
||||
public MotorServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MotorServiceBlockingStub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return MotorServiceBlockingStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ListenableFuture-style stub that supports unary calls on the service
|
||||
*/
|
||||
public static MotorServiceFutureStub newFutureStub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<MotorServiceFutureStub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<MotorServiceFutureStub>() {
|
||||
@java.lang.Override
|
||||
public MotorServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MotorServiceFutureStub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return MotorServiceFutureStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static abstract class MotorServiceImplBase implements io.grpc.BindableService {
|
||||
|
||||
/**
|
||||
*/
|
||||
public void setZero(cmvr.api.MotorCommand.SetMotorZeroRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSetZeroMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void moveToZero(cmvr.api.MotorCommand.MoveMotorToZeroRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getMoveToZeroMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void profilePosition(cmvr.api.MotorCommand.ProfilePositionRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getProfilePositionMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void profileVelocity(cmvr.api.MotorCommand.ProfileVelocityRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getProfileVelocityMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.CyclicPositionRequest> streamCyclicPosition(
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.CyclicControlResponse> responseObserver) {
|
||||
return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getStreamCyclicPositionMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.CyclicVelocityRequest> streamCyclicVelocity(
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.CyclicControlResponse> responseObserver) {
|
||||
return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getStreamCyclicVelocityMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void emergencyStop(cmvr.api.MotorCommand.EmergencyStopRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getEmergencyStopMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void getStatus(cmvr.api.MotorCommand.GetMotorStatusRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.GetMotorStatusResponse> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGetStatusMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void setEnabled(cmvr.api.MotorCommand.SetMotorEnabledRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getSetEnabledMethod(), responseObserver);
|
||||
}
|
||||
|
||||
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
||||
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
||||
.addMethod(
|
||||
getSetZeroMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.MotorCommand.SetMotorZeroRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse>(
|
||||
this, METHODID_SET_ZERO)))
|
||||
.addMethod(
|
||||
getMoveToZeroMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.MotorCommand.MoveMotorToZeroRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse>(
|
||||
this, METHODID_MOVE_TO_ZERO)))
|
||||
.addMethod(
|
||||
getProfilePositionMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.MotorCommand.ProfilePositionRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse>(
|
||||
this, METHODID_PROFILE_POSITION)))
|
||||
.addMethod(
|
||||
getProfileVelocityMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.MotorCommand.ProfileVelocityRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse>(
|
||||
this, METHODID_PROFILE_VELOCITY)))
|
||||
.addMethod(
|
||||
getStreamCyclicPositionMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.MotorCommand.CyclicPositionRequest,
|
||||
cmvr.api.MotorCommand.CyclicControlResponse>(
|
||||
this, METHODID_STREAM_CYCLIC_POSITION)))
|
||||
.addMethod(
|
||||
getStreamCyclicVelocityMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.MotorCommand.CyclicVelocityRequest,
|
||||
cmvr.api.MotorCommand.CyclicControlResponse>(
|
||||
this, METHODID_STREAM_CYCLIC_VELOCITY)))
|
||||
.addMethod(
|
||||
getEmergencyStopMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.MotorCommand.EmergencyStopRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse>(
|
||||
this, METHODID_EMERGENCY_STOP)))
|
||||
.addMethod(
|
||||
getGetStatusMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.MotorCommand.GetMotorStatusRequest,
|
||||
cmvr.api.MotorCommand.GetMotorStatusResponse>(
|
||||
this, METHODID_GET_STATUS)))
|
||||
.addMethod(
|
||||
getSetEnabledMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.MotorCommand.SetMotorEnabledRequest,
|
||||
cmvr.api.MotorCommand.MotorCommandResponse>(
|
||||
this, METHODID_SET_ENABLED)))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static final class MotorServiceStub extends io.grpc.stub.AbstractAsyncStub<MotorServiceStub> {
|
||||
private MotorServiceStub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected MotorServiceStub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MotorServiceStub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void setZero(cmvr.api.MotorCommand.SetMotorZeroRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getSetZeroMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void moveToZero(cmvr.api.MotorCommand.MoveMotorToZeroRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getMoveToZeroMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void profilePosition(cmvr.api.MotorCommand.ProfilePositionRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getProfilePositionMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void profileVelocity(cmvr.api.MotorCommand.ProfileVelocityRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getProfileVelocityMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.CyclicPositionRequest> streamCyclicPosition(
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.CyclicControlResponse> responseObserver) {
|
||||
return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
|
||||
getChannel().newCall(getStreamCyclicPositionMethod(), getCallOptions()), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.CyclicVelocityRequest> streamCyclicVelocity(
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.CyclicControlResponse> responseObserver) {
|
||||
return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
|
||||
getChannel().newCall(getStreamCyclicVelocityMethod(), getCallOptions()), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void emergencyStop(cmvr.api.MotorCommand.EmergencyStopRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getEmergencyStopMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void getStatus(cmvr.api.MotorCommand.GetMotorStatusRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.GetMotorStatusResponse> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getGetStatusMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void setEnabled(cmvr.api.MotorCommand.SetMotorEnabledRequest request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getSetEnabledMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static final class MotorServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<MotorServiceBlockingStub> {
|
||||
private MotorServiceBlockingStub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected MotorServiceBlockingStub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MotorServiceBlockingStub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.MotorCommand.MotorCommandResponse setZero(cmvr.api.MotorCommand.SetMotorZeroRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSetZeroMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.MotorCommand.MotorCommandResponse moveToZero(cmvr.api.MotorCommand.MoveMotorToZeroRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getMoveToZeroMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.MotorCommand.MotorCommandResponse profilePosition(cmvr.api.MotorCommand.ProfilePositionRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getProfilePositionMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.MotorCommand.MotorCommandResponse profileVelocity(cmvr.api.MotorCommand.ProfileVelocityRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getProfileVelocityMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.MotorCommand.MotorCommandResponse emergencyStop(cmvr.api.MotorCommand.EmergencyStopRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getEmergencyStopMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.MotorCommand.GetMotorStatusResponse getStatus(cmvr.api.MotorCommand.GetMotorStatusRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getGetStatusMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.MotorCommand.MotorCommandResponse setEnabled(cmvr.api.MotorCommand.SetMotorEnabledRequest request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getSetEnabledMethod(), getCallOptions(), request);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public static final class MotorServiceFutureStub extends io.grpc.stub.AbstractFutureStub<MotorServiceFutureStub> {
|
||||
private MotorServiceFutureStub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected MotorServiceFutureStub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new MotorServiceFutureStub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.MotorCommand.MotorCommandResponse> setZero(
|
||||
cmvr.api.MotorCommand.SetMotorZeroRequest request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getSetZeroMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.MotorCommand.MotorCommandResponse> moveToZero(
|
||||
cmvr.api.MotorCommand.MoveMotorToZeroRequest request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getMoveToZeroMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.MotorCommand.MotorCommandResponse> profilePosition(
|
||||
cmvr.api.MotorCommand.ProfilePositionRequest request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getProfilePositionMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.MotorCommand.MotorCommandResponse> profileVelocity(
|
||||
cmvr.api.MotorCommand.ProfileVelocityRequest request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getProfileVelocityMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.MotorCommand.MotorCommandResponse> emergencyStop(
|
||||
cmvr.api.MotorCommand.EmergencyStopRequest request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getEmergencyStopMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.MotorCommand.GetMotorStatusResponse> getStatus(
|
||||
cmvr.api.MotorCommand.GetMotorStatusRequest request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getGetStatusMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.MotorCommand.MotorCommandResponse> setEnabled(
|
||||
cmvr.api.MotorCommand.SetMotorEnabledRequest request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getSetEnabledMethod(), getCallOptions()), request);
|
||||
}
|
||||
}
|
||||
|
||||
private static final int METHODID_SET_ZERO = 0;
|
||||
private static final int METHODID_MOVE_TO_ZERO = 1;
|
||||
private static final int METHODID_PROFILE_POSITION = 2;
|
||||
private static final int METHODID_PROFILE_VELOCITY = 3;
|
||||
private static final int METHODID_EMERGENCY_STOP = 4;
|
||||
private static final int METHODID_GET_STATUS = 5;
|
||||
private static final int METHODID_SET_ENABLED = 6;
|
||||
private static final int METHODID_STREAM_CYCLIC_POSITION = 7;
|
||||
private static final int METHODID_STREAM_CYCLIC_VELOCITY = 8;
|
||||
|
||||
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 MotorServiceImplBase serviceImpl;
|
||||
private final int methodId;
|
||||
|
||||
MethodHandlers(MotorServiceImplBase 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_SET_ZERO:
|
||||
serviceImpl.setZero((cmvr.api.MotorCommand.SetMotorZeroRequest) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse>) responseObserver);
|
||||
break;
|
||||
case METHODID_MOVE_TO_ZERO:
|
||||
serviceImpl.moveToZero((cmvr.api.MotorCommand.MoveMotorToZeroRequest) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse>) responseObserver);
|
||||
break;
|
||||
case METHODID_PROFILE_POSITION:
|
||||
serviceImpl.profilePosition((cmvr.api.MotorCommand.ProfilePositionRequest) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse>) responseObserver);
|
||||
break;
|
||||
case METHODID_PROFILE_VELOCITY:
|
||||
serviceImpl.profileVelocity((cmvr.api.MotorCommand.ProfileVelocityRequest) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse>) responseObserver);
|
||||
break;
|
||||
case METHODID_EMERGENCY_STOP:
|
||||
serviceImpl.emergencyStop((cmvr.api.MotorCommand.EmergencyStopRequest) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse>) responseObserver);
|
||||
break;
|
||||
case METHODID_GET_STATUS:
|
||||
serviceImpl.getStatus((cmvr.api.MotorCommand.GetMotorStatusRequest) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.GetMotorStatusResponse>) responseObserver);
|
||||
break;
|
||||
case METHODID_SET_ENABLED:
|
||||
serviceImpl.setEnabled((cmvr.api.MotorCommand.SetMotorEnabledRequest) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.MotorCommandResponse>) 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) {
|
||||
case METHODID_STREAM_CYCLIC_POSITION:
|
||||
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamCyclicPosition(
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.CyclicControlResponse>) responseObserver);
|
||||
case METHODID_STREAM_CYCLIC_VELOCITY:
|
||||
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.streamCyclicVelocity(
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.MotorCommand.CyclicControlResponse>) responseObserver);
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static abstract class MotorServiceBaseDescriptorSupplier
|
||||
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
|
||||
MotorServiceBaseDescriptorSupplier() {}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
|
||||
return cmvr.api.MotorServiceOuterClass.getDescriptor();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
|
||||
return getFileDescriptor().findServiceByName("MotorService");
|
||||
}
|
||||
}
|
||||
|
||||
private static final class MotorServiceFileDescriptorSupplier
|
||||
extends MotorServiceBaseDescriptorSupplier {
|
||||
MotorServiceFileDescriptorSupplier() {}
|
||||
}
|
||||
|
||||
private static final class MotorServiceMethodDescriptorSupplier
|
||||
extends MotorServiceBaseDescriptorSupplier
|
||||
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
|
||||
private final String methodName;
|
||||
|
||||
MotorServiceMethodDescriptorSupplier(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 (MotorServiceGrpc.class) {
|
||||
result = serviceDescriptor;
|
||||
if (result == null) {
|
||||
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
|
||||
.setSchemaDescriptor(new MotorServiceFileDescriptorSupplier())
|
||||
.addMethod(getSetZeroMethod())
|
||||
.addMethod(getMoveToZeroMethod())
|
||||
.addMethod(getProfilePositionMethod())
|
||||
.addMethod(getProfileVelocityMethod())
|
||||
.addMethod(getStreamCyclicPositionMethod())
|
||||
.addMethod(getStreamCyclicVelocityMethod())
|
||||
.addMethod(getEmergencyStopMethod())
|
||||
.addMethod(getGetStatusMethod())
|
||||
.addMethod(getSetEnabledMethod())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: cmvr/api/motor_service.proto
|
||||
|
||||
package cmvr.api;
|
||||
|
||||
public final class MotorServiceOuterClass {
|
||||
private MotorServiceOuterClass() {}
|
||||
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\034cmvr/api/motor_service.proto\022\010cmvr.api" +
|
||||
"\032\034cmvr/api/motor_command.proto2\377\005\n\014Motor" +
|
||||
"Service\022H\n\007setZero\022\035.cmvr.api.SetMotorZe" +
|
||||
"roRequest\032\036.cmvr.api.MotorCommandRespons" +
|
||||
"e\022N\n\nmoveToZero\022 .cmvr.api.MoveMotorToZe" +
|
||||
"roRequest\032\036.cmvr.api.MotorCommandRespons" +
|
||||
"e\022S\n\017profilePosition\022 .cmvr.api.ProfileP" +
|
||||
"ositionRequest\032\036.cmvr.api.MotorCommandRe" +
|
||||
"sponse\022S\n\017profileVelocity\022 .cmvr.api.Pro" +
|
||||
"fileVelocityRequest\032\036.cmvr.api.MotorComm" +
|
||||
"andResponse\022\\\n\024streamCyclicPosition\022\037.cm" +
|
||||
"vr.api.CyclicPositionRequest\032\037.cmvr.api." +
|
||||
"CyclicControlResponse(\0010\001\022\\\n\024streamCycli" +
|
||||
"cVelocity\022\037.cmvr.api.CyclicVelocityReque" +
|
||||
"st\032\037.cmvr.api.CyclicControlResponse(\0010\001\022" +
|
||||
"O\n\remergencyStop\022\036.cmvr.api.EmergencySto" +
|
||||
"pRequest\032\036.cmvr.api.MotorCommandResponse" +
|
||||
"\022N\n\tgetStatus\022\037.cmvr.api.GetMotorStatusR" +
|
||||
"equest\032 .cmvr.api.GetMotorStatusResponse" +
|
||||
"\022N\n\nsetEnabled\022 .cmvr.api.SetMotorEnable" +
|
||||
"dRequest\032\036.cmvr.api.MotorCommandResponse" +
|
||||
"b\006proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||
cmvr.api.MotorCommand.getDescriptor(),
|
||||
});
|
||||
cmvr.api.MotorCommand.getDescriptor();
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
||||
@ -108,6 +108,37 @@ public final class SystemServiceGrpc {
|
||||
return getUpdateParamsMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.Common.JsonDeviceCommand.Request,
|
||||
cmvr.api.Common.JsonDeviceCommand.Feedback> getExecuteJsonCommandMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "ExecuteJsonCommand",
|
||||
requestType = cmvr.api.Common.JsonDeviceCommand.Request.class,
|
||||
responseType = cmvr.api.Common.JsonDeviceCommand.Feedback.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.Common.JsonDeviceCommand.Request,
|
||||
cmvr.api.Common.JsonDeviceCommand.Feedback> getExecuteJsonCommandMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.Common.JsonDeviceCommand.Request, cmvr.api.Common.JsonDeviceCommand.Feedback> getExecuteJsonCommandMethod;
|
||||
if ((getExecuteJsonCommandMethod = SystemServiceGrpc.getExecuteJsonCommandMethod) == null) {
|
||||
synchronized (SystemServiceGrpc.class) {
|
||||
if ((getExecuteJsonCommandMethod = SystemServiceGrpc.getExecuteJsonCommandMethod) == null) {
|
||||
SystemServiceGrpc.getExecuteJsonCommandMethod = getExecuteJsonCommandMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.Common.JsonDeviceCommand.Request, cmvr.api.Common.JsonDeviceCommand.Feedback>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "ExecuteJsonCommand"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.Common.JsonDeviceCommand.Request.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.Common.JsonDeviceCommand.Feedback.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new SystemServiceMethodDescriptorSupplier("ExecuteJsonCommand"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getExecuteJsonCommandMethod;
|
||||
}
|
||||
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.SystemCommand.StopAllCommand.Request,
|
||||
cmvr.api.SystemCommand.StopAllCommand.Feedback> getStopAllMethod;
|
||||
|
||||
@ -208,6 +239,13 @@ public final class SystemServiceGrpc {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUpdateParamsMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void executeJsonCommand(cmvr.api.Common.JsonDeviceCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.Common.JsonDeviceCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getExecuteJsonCommandMethod(), responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void stopAll(cmvr.api.SystemCommand.StopAllCommand.Request request,
|
||||
@ -238,6 +276,13 @@ public final class SystemServiceGrpc {
|
||||
cmvr.api.SystemCommand.UpdateParamsCommand.Request,
|
||||
cmvr.api.SystemCommand.UpdateParamsCommand.Feedback>(
|
||||
this, METHODID_UPDATE_PARAMS)))
|
||||
.addMethod(
|
||||
getExecuteJsonCommandMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.Common.JsonDeviceCommand.Request,
|
||||
cmvr.api.Common.JsonDeviceCommand.Feedback>(
|
||||
this, METHODID_EXECUTE_JSON_COMMAND)))
|
||||
.addMethod(
|
||||
getStopAllMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncUnaryCall(
|
||||
@ -287,6 +332,14 @@ public final class SystemServiceGrpc {
|
||||
getChannel().newCall(getUpdateParamsMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void executeJsonCommand(cmvr.api.Common.JsonDeviceCommand.Request request,
|
||||
io.grpc.stub.StreamObserver<cmvr.api.Common.JsonDeviceCommand.Feedback> responseObserver) {
|
||||
io.grpc.stub.ClientCalls.asyncUnaryCall(
|
||||
getChannel().newCall(getExecuteJsonCommandMethod(), getCallOptions()), request, responseObserver);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public void stopAll(cmvr.api.SystemCommand.StopAllCommand.Request request,
|
||||
@ -331,6 +384,13 @@ public final class SystemServiceGrpc {
|
||||
getChannel(), getUpdateParamsMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.Common.JsonDeviceCommand.Feedback executeJsonCommand(cmvr.api.Common.JsonDeviceCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.blockingUnaryCall(
|
||||
getChannel(), getExecuteJsonCommandMethod(), getCallOptions(), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public cmvr.api.SystemCommand.StopAllCommand.Feedback stopAll(cmvr.api.SystemCommand.StopAllCommand.Request request) {
|
||||
@ -377,6 +437,14 @@ public final class SystemServiceGrpc {
|
||||
getChannel().newCall(getUpdateParamsMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.Common.JsonDeviceCommand.Feedback> executeJsonCommand(
|
||||
cmvr.api.Common.JsonDeviceCommand.Request request) {
|
||||
return io.grpc.stub.ClientCalls.futureUnaryCall(
|
||||
getChannel().newCall(getExecuteJsonCommandMethod(), getCallOptions()), request);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public com.google.common.util.concurrent.ListenableFuture<cmvr.api.SystemCommand.StopAllCommand.Feedback> stopAll(
|
||||
@ -389,7 +457,8 @@ public final class SystemServiceGrpc {
|
||||
private static final int METHODID_GET_SYSTEM_INFO = 0;
|
||||
private static final int METHODID_GET_SYSTEM_STATUS = 1;
|
||||
private static final int METHODID_UPDATE_PARAMS = 2;
|
||||
private static final int METHODID_STOP_ALL = 3;
|
||||
private static final int METHODID_EXECUTE_JSON_COMMAND = 3;
|
||||
private static final int METHODID_STOP_ALL = 4;
|
||||
|
||||
private static final class MethodHandlers<Req, Resp> implements
|
||||
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
|
||||
@ -420,6 +489,10 @@ public final class SystemServiceGrpc {
|
||||
serviceImpl.updateParams((cmvr.api.SystemCommand.UpdateParamsCommand.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.SystemCommand.UpdateParamsCommand.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_EXECUTE_JSON_COMMAND:
|
||||
serviceImpl.executeJsonCommand((cmvr.api.Common.JsonDeviceCommand.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.Common.JsonDeviceCommand.Feedback>) responseObserver);
|
||||
break;
|
||||
case METHODID_STOP_ALL:
|
||||
serviceImpl.stopAll((cmvr.api.SystemCommand.StopAllCommand.Request) request,
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.SystemCommand.StopAllCommand.Feedback>) responseObserver);
|
||||
@ -488,6 +561,7 @@ public final class SystemServiceGrpc {
|
||||
.addMethod(getGetSystemInfoMethod())
|
||||
.addMethod(getGetSystemStatusMethod())
|
||||
.addMethod(getUpdateParamsMethod())
|
||||
.addMethod(getExecuteJsonCommandMethod())
|
||||
.addMethod(getStopAllMethod())
|
||||
.build();
|
||||
}
|
||||
|
||||
@ -24,24 +24,29 @@ public final class SystemServiceOuterClass {
|
||||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\035cmvr/api/system_service.proto\022\010cmvr.ap" +
|
||||
"i\032\035cmvr/api/system_command.proto2\220\003\n\rSys" +
|
||||
"temService\022b\n\rGetSystemInfo\022&.cmvr.api.G" +
|
||||
"etSystemInfoCommand.Request\032\'.cmvr.api.G" +
|
||||
"etSystemInfoCommand.Feedback\"\000\022h\n\017GetSys" +
|
||||
"temStatus\022(.cmvr.api.GetSystemStatusComm" +
|
||||
"and.Request\032).cmvr.api.GetSystemStatusCo" +
|
||||
"mmand.Feedback\"\000\022_\n\014UpdateParams\022%.cmvr." +
|
||||
"api.UpdateParamsCommand.Request\032&.cmvr.a" +
|
||||
"pi.UpdateParamsCommand.Feedback\"\000\022P\n\007Sto" +
|
||||
"pAll\022 .cmvr.api.StopAllCommand.Request\032!" +
|
||||
".cmvr.api.StopAllCommand.Feedback\"\000b\006pro" +
|
||||
"to3"
|
||||
"i\032\025cmvr/api/common.proto\032\035cmvr/api/syste" +
|
||||
"m_command.proto2\363\003\n\rSystemService\022b\n\rGet" +
|
||||
"SystemInfo\022&.cmvr.api.GetSystemInfoComma" +
|
||||
"nd.Request\032\'.cmvr.api.GetSystemInfoComma" +
|
||||
"nd.Feedback\"\000\022h\n\017GetSystemStatus\022(.cmvr." +
|
||||
"api.GetSystemStatusCommand.Request\032).cmv" +
|
||||
"r.api.GetSystemStatusCommand.Feedback\"\000\022" +
|
||||
"_\n\014UpdateParams\022%.cmvr.api.UpdateParamsC" +
|
||||
"ommand.Request\032&.cmvr.api.UpdateParamsCo" +
|
||||
"mmand.Feedback\"\000\022a\n\022ExecuteJsonCommand\022#" +
|
||||
".cmvr.api.JsonDeviceCommand.Request\032$.cm" +
|
||||
"vr.api.JsonDeviceCommand.Feedback\"\000\022P\n\007S" +
|
||||
"topAll\022 .cmvr.api.StopAllCommand.Request" +
|
||||
"\032!.cmvr.api.StopAllCommand.Feedback\"\000b\006p" +
|
||||
"roto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||
cmvr.api.Common.getDescriptor(),
|
||||
cmvr.api.SystemCommand.getDescriptor(),
|
||||
});
|
||||
cmvr.api.Common.getDescriptor();
|
||||
cmvr.api.SystemCommand.getDescriptor();
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,280 @@
|
||||
package cmvr.api.armteleop.v1;
|
||||
|
||||
import static io.grpc.MethodDescriptor.generateFullMethodName;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Versioned, session-oriented protocol for wired arm teleoperation. Existing
|
||||
* unary ArmService RPCs intentionally remain unchanged.
|
||||
* </pre>
|
||||
*/
|
||||
@javax.annotation.Generated(
|
||||
value = "by gRPC proto compiler (version 1.52.0)",
|
||||
comments = "Source: cmvr/api/arm_teleop_v1.proto")
|
||||
@io.grpc.stub.annotations.GrpcGenerated
|
||||
public final class ArmTeleopServiceGrpc {
|
||||
|
||||
private ArmTeleopServiceGrpc() {}
|
||||
|
||||
public static final String SERVICE_NAME = "cmvr.api.armteleop.v1.ArmTeleopService";
|
||||
|
||||
// Static method descriptors that strictly reflect the proto.
|
||||
private static volatile io.grpc.MethodDescriptor<cmvr.api.armteleop.v1.ArmTeleopV1.ClientFrame,
|
||||
cmvr.api.armteleop.v1.ArmTeleopV1.ServerFrame> getTeleoperateMethod;
|
||||
|
||||
@io.grpc.stub.annotations.RpcMethod(
|
||||
fullMethodName = SERVICE_NAME + '/' + "Teleoperate",
|
||||
requestType = cmvr.api.armteleop.v1.ArmTeleopV1.ClientFrame.class,
|
||||
responseType = cmvr.api.armteleop.v1.ArmTeleopV1.ServerFrame.class,
|
||||
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
||||
public static io.grpc.MethodDescriptor<cmvr.api.armteleop.v1.ArmTeleopV1.ClientFrame,
|
||||
cmvr.api.armteleop.v1.ArmTeleopV1.ServerFrame> getTeleoperateMethod() {
|
||||
io.grpc.MethodDescriptor<cmvr.api.armteleop.v1.ArmTeleopV1.ClientFrame, cmvr.api.armteleop.v1.ArmTeleopV1.ServerFrame> getTeleoperateMethod;
|
||||
if ((getTeleoperateMethod = ArmTeleopServiceGrpc.getTeleoperateMethod) == null) {
|
||||
synchronized (ArmTeleopServiceGrpc.class) {
|
||||
if ((getTeleoperateMethod = ArmTeleopServiceGrpc.getTeleoperateMethod) == null) {
|
||||
ArmTeleopServiceGrpc.getTeleoperateMethod = getTeleoperateMethod =
|
||||
io.grpc.MethodDescriptor.<cmvr.api.armteleop.v1.ArmTeleopV1.ClientFrame, cmvr.api.armteleop.v1.ArmTeleopV1.ServerFrame>newBuilder()
|
||||
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
|
||||
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Teleoperate"))
|
||||
.setSampledToLocalTracing(true)
|
||||
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.armteleop.v1.ArmTeleopV1.ClientFrame.getDefaultInstance()))
|
||||
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
|
||||
cmvr.api.armteleop.v1.ArmTeleopV1.ServerFrame.getDefaultInstance()))
|
||||
.setSchemaDescriptor(new ArmTeleopServiceMethodDescriptorSupplier("Teleoperate"))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return getTeleoperateMethod;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new async stub that supports all call types for the service
|
||||
*/
|
||||
public static ArmTeleopServiceStub newStub(io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ArmTeleopServiceStub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ArmTeleopServiceStub>() {
|
||||
@java.lang.Override
|
||||
public ArmTeleopServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ArmTeleopServiceStub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ArmTeleopServiceStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
|
||||
*/
|
||||
public static ArmTeleopServiceBlockingStub newBlockingStub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ArmTeleopServiceBlockingStub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ArmTeleopServiceBlockingStub>() {
|
||||
@java.lang.Override
|
||||
public ArmTeleopServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ArmTeleopServiceBlockingStub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ArmTeleopServiceBlockingStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new ListenableFuture-style stub that supports unary calls on the service
|
||||
*/
|
||||
public static ArmTeleopServiceFutureStub newFutureStub(
|
||||
io.grpc.Channel channel) {
|
||||
io.grpc.stub.AbstractStub.StubFactory<ArmTeleopServiceFutureStub> factory =
|
||||
new io.grpc.stub.AbstractStub.StubFactory<ArmTeleopServiceFutureStub>() {
|
||||
@java.lang.Override
|
||||
public ArmTeleopServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ArmTeleopServiceFutureStub(channel, callOptions);
|
||||
}
|
||||
};
|
||||
return ArmTeleopServiceFutureStub.newStub(factory, channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Versioned, session-oriented protocol for wired arm teleoperation. Existing
|
||||
* unary ArmService RPCs intentionally remain unchanged.
|
||||
* </pre>
|
||||
*/
|
||||
public static abstract class ArmTeleopServiceImplBase implements io.grpc.BindableService {
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<cmvr.api.armteleop.v1.ArmTeleopV1.ClientFrame> teleoperate(
|
||||
io.grpc.stub.StreamObserver<cmvr.api.armteleop.v1.ArmTeleopV1.ServerFrame> responseObserver) {
|
||||
return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getTeleoperateMethod(), responseObserver);
|
||||
}
|
||||
|
||||
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
|
||||
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
|
||||
.addMethod(
|
||||
getTeleoperateMethod(),
|
||||
io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
|
||||
new MethodHandlers<
|
||||
cmvr.api.armteleop.v1.ArmTeleopV1.ClientFrame,
|
||||
cmvr.api.armteleop.v1.ArmTeleopV1.ServerFrame>(
|
||||
this, METHODID_TELEOPERATE)))
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Versioned, session-oriented protocol for wired arm teleoperation. Existing
|
||||
* unary ArmService RPCs intentionally remain unchanged.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ArmTeleopServiceStub extends io.grpc.stub.AbstractAsyncStub<ArmTeleopServiceStub> {
|
||||
private ArmTeleopServiceStub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ArmTeleopServiceStub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ArmTeleopServiceStub(channel, callOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
*/
|
||||
public io.grpc.stub.StreamObserver<cmvr.api.armteleop.v1.ArmTeleopV1.ClientFrame> teleoperate(
|
||||
io.grpc.stub.StreamObserver<cmvr.api.armteleop.v1.ArmTeleopV1.ServerFrame> responseObserver) {
|
||||
return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
|
||||
getChannel().newCall(getTeleoperateMethod(), getCallOptions()), responseObserver);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Versioned, session-oriented protocol for wired arm teleoperation. Existing
|
||||
* unary ArmService RPCs intentionally remain unchanged.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ArmTeleopServiceBlockingStub extends io.grpc.stub.AbstractBlockingStub<ArmTeleopServiceBlockingStub> {
|
||||
private ArmTeleopServiceBlockingStub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ArmTeleopServiceBlockingStub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ArmTeleopServiceBlockingStub(channel, callOptions);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* Versioned, session-oriented protocol for wired arm teleoperation. Existing
|
||||
* unary ArmService RPCs intentionally remain unchanged.
|
||||
* </pre>
|
||||
*/
|
||||
public static final class ArmTeleopServiceFutureStub extends io.grpc.stub.AbstractFutureStub<ArmTeleopServiceFutureStub> {
|
||||
private ArmTeleopServiceFutureStub(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
super(channel, callOptions);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected ArmTeleopServiceFutureStub build(
|
||||
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
|
||||
return new ArmTeleopServiceFutureStub(channel, callOptions);
|
||||
}
|
||||
}
|
||||
|
||||
private static final int METHODID_TELEOPERATE = 0;
|
||||
|
||||
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 ArmTeleopServiceImplBase serviceImpl;
|
||||
private final int methodId;
|
||||
|
||||
MethodHandlers(ArmTeleopServiceImplBase 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) {
|
||||
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) {
|
||||
case METHODID_TELEOPERATE:
|
||||
return (io.grpc.stub.StreamObserver<Req>) serviceImpl.teleoperate(
|
||||
(io.grpc.stub.StreamObserver<cmvr.api.armteleop.v1.ArmTeleopV1.ServerFrame>) responseObserver);
|
||||
default:
|
||||
throw new AssertionError();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static abstract class ArmTeleopServiceBaseDescriptorSupplier
|
||||
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
|
||||
ArmTeleopServiceBaseDescriptorSupplier() {}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
|
||||
return cmvr.api.armteleop.v1.ArmTeleopV1.getDescriptor();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
|
||||
return getFileDescriptor().findServiceByName("ArmTeleopService");
|
||||
}
|
||||
}
|
||||
|
||||
private static final class ArmTeleopServiceFileDescriptorSupplier
|
||||
extends ArmTeleopServiceBaseDescriptorSupplier {
|
||||
ArmTeleopServiceFileDescriptorSupplier() {}
|
||||
}
|
||||
|
||||
private static final class ArmTeleopServiceMethodDescriptorSupplier
|
||||
extends ArmTeleopServiceBaseDescriptorSupplier
|
||||
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
|
||||
private final String methodName;
|
||||
|
||||
ArmTeleopServiceMethodDescriptorSupplier(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 (ArmTeleopServiceGrpc.class) {
|
||||
result = serviceDescriptor;
|
||||
if (result == null) {
|
||||
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
|
||||
.setSchemaDescriptor(new ArmTeleopServiceFileDescriptorSupplier())
|
||||
.addMethod(getTeleoperateMethod())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,586 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: cmvr/msgs/cia402.proto
|
||||
|
||||
package cmvr.msgs;
|
||||
|
||||
public final class Cia402 {
|
||||
private Cia402() {}
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistryLite registry) {
|
||||
}
|
||||
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistry registry) {
|
||||
registerAllExtensions(
|
||||
(com.google.protobuf.ExtensionRegistryLite) registry);
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* CiA402 object dictionary indexes shared by CANopen and EtherCAT CoE drives.
|
||||
* </pre>
|
||||
*
|
||||
* Protobuf enum {@code cmvr.msgs.Cia402ObjectIndex}
|
||||
*/
|
||||
public enum Cia402ObjectIndex
|
||||
implements com.google.protobuf.ProtocolMessageEnum {
|
||||
/**
|
||||
* <code>CIA402_OBJECT_INDEX_ZERO = 0;</code>
|
||||
*/
|
||||
CIA402_OBJECT_INDEX_ZERO(0),
|
||||
/**
|
||||
* <code>CIA402_ERROR_CODE_603F = 24639;</code>
|
||||
*/
|
||||
CIA402_ERROR_CODE_603F(24639),
|
||||
/**
|
||||
* <code>CIA402_CONTROL_WORD_6040 = 24640;</code>
|
||||
*/
|
||||
CIA402_CONTROL_WORD_6040(24640),
|
||||
/**
|
||||
* <code>CIA402_STATUS_WORD_6041 = 24641;</code>
|
||||
*/
|
||||
CIA402_STATUS_WORD_6041(24641),
|
||||
/**
|
||||
* <code>CIA402_QUICK_STOP_OPTION_605A = 24666;</code>
|
||||
*/
|
||||
CIA402_QUICK_STOP_OPTION_605A(24666),
|
||||
/**
|
||||
* <code>CIA402_SHUTDOWN_OPTION_605B = 24667;</code>
|
||||
*/
|
||||
CIA402_SHUTDOWN_OPTION_605B(24667),
|
||||
/**
|
||||
* <code>CIA402_DISABLE_OPERATION_OPTION_605C = 24668;</code>
|
||||
*/
|
||||
CIA402_DISABLE_OPERATION_OPTION_605C(24668),
|
||||
/**
|
||||
* <code>CIA402_HALT_OPTION_605D = 24669;</code>
|
||||
*/
|
||||
CIA402_HALT_OPTION_605D(24669),
|
||||
/**
|
||||
* <code>CIA402_FAULT_REACTION_OPTION_605E = 24670;</code>
|
||||
*/
|
||||
CIA402_FAULT_REACTION_OPTION_605E(24670),
|
||||
/**
|
||||
* <code>CIA402_OPERATION_MODE_6060 = 24672;</code>
|
||||
*/
|
||||
CIA402_OPERATION_MODE_6060(24672),
|
||||
/**
|
||||
* <code>CIA402_MODE_DISPLAY_6061 = 24673;</code>
|
||||
*/
|
||||
CIA402_MODE_DISPLAY_6061(24673),
|
||||
/**
|
||||
* <code>CIA402_POSITION_DEMAND_VALUE_6062 = 24674;</code>
|
||||
*/
|
||||
CIA402_POSITION_DEMAND_VALUE_6062(24674),
|
||||
/**
|
||||
* <code>CIA402_ACTUAL_POSITION_6064 = 24676;</code>
|
||||
*/
|
||||
CIA402_ACTUAL_POSITION_6064(24676),
|
||||
/**
|
||||
* <code>CIA402_MAX_FOLLOWING_ERROR_6065 = 24677;</code>
|
||||
*/
|
||||
CIA402_MAX_FOLLOWING_ERROR_6065(24677),
|
||||
/**
|
||||
* <code>CIA402_POSITION_WINDOW_6067 = 24679;</code>
|
||||
*/
|
||||
CIA402_POSITION_WINDOW_6067(24679),
|
||||
/**
|
||||
* <code>CIA402_POSITION_WINDOW_TIME_6068 = 24680;</code>
|
||||
*/
|
||||
CIA402_POSITION_WINDOW_TIME_6068(24680),
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_DEMAND_VALUE_606B = 24683;</code>
|
||||
*/
|
||||
CIA402_VELOCITY_DEMAND_VALUE_606B(24683),
|
||||
/**
|
||||
* <code>CIA402_ACTUAL_VELOCITY_606C = 24684;</code>
|
||||
*/
|
||||
CIA402_ACTUAL_VELOCITY_606C(24684),
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_WINDOW_606D = 24685;</code>
|
||||
*/
|
||||
CIA402_VELOCITY_WINDOW_606D(24685),
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_WINDOW_TIME_606E = 24686;</code>
|
||||
*/
|
||||
CIA402_VELOCITY_WINDOW_TIME_606E(24686),
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_THRESHOLD_606F = 24687;</code>
|
||||
*/
|
||||
CIA402_VELOCITY_THRESHOLD_606F(24687),
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_THRESHOLD_TIME_6070 = 24688;</code>
|
||||
*/
|
||||
CIA402_VELOCITY_THRESHOLD_TIME_6070(24688),
|
||||
/**
|
||||
* <code>CIA402_TARGET_TORQUE_6071 = 24689;</code>
|
||||
*/
|
||||
CIA402_TARGET_TORQUE_6071(24689),
|
||||
/**
|
||||
* <code>CIA402_MAX_TORQUE_6072 = 24690;</code>
|
||||
*/
|
||||
CIA402_MAX_TORQUE_6072(24690),
|
||||
/**
|
||||
* <code>CIA402_TORQUE_DEMAND_VALUE_6074 = 24692;</code>
|
||||
*/
|
||||
CIA402_TORQUE_DEMAND_VALUE_6074(24692),
|
||||
/**
|
||||
* <code>CIA402_MOTOR_RATED_TORQUE_6076 = 24694;</code>
|
||||
*/
|
||||
CIA402_MOTOR_RATED_TORQUE_6076(24694),
|
||||
/**
|
||||
* <code>CIA402_ACTUAL_TORQUE_6077 = 24695;</code>
|
||||
*/
|
||||
CIA402_ACTUAL_TORQUE_6077(24695),
|
||||
/**
|
||||
* <code>CIA402_ACTUAL_CURRENT_6078 = 24696;</code>
|
||||
*/
|
||||
CIA402_ACTUAL_CURRENT_6078(24696),
|
||||
/**
|
||||
* <code>CIA402_DC_LINK_VOLTAGE_6079 = 24697;</code>
|
||||
*/
|
||||
CIA402_DC_LINK_VOLTAGE_6079(24697),
|
||||
/**
|
||||
* <code>CIA402_TARGET_POSITION_607A = 24698;</code>
|
||||
*/
|
||||
CIA402_TARGET_POSITION_607A(24698),
|
||||
/**
|
||||
* <code>CIA402_HOME_OFFSET_607C = 24700;</code>
|
||||
*/
|
||||
CIA402_HOME_OFFSET_607C(24700),
|
||||
/**
|
||||
* <code>CIA402_SOFTWARE_POSITION_LIMIT_607D = 24701;</code>
|
||||
*/
|
||||
CIA402_SOFTWARE_POSITION_LIMIT_607D(24701),
|
||||
/**
|
||||
* <code>CIA402_MAX_PROFILE_VELOCITY_607F = 24703;</code>
|
||||
*/
|
||||
CIA402_MAX_PROFILE_VELOCITY_607F(24703),
|
||||
/**
|
||||
* <code>CIA402_PROFILE_VELOCITY_6081 = 24705;</code>
|
||||
*/
|
||||
CIA402_PROFILE_VELOCITY_6081(24705),
|
||||
/**
|
||||
* <code>CIA402_PROFILE_ACCELERATION_6083 = 24707;</code>
|
||||
*/
|
||||
CIA402_PROFILE_ACCELERATION_6083(24707),
|
||||
/**
|
||||
* <code>CIA402_PROFILE_DECELERATION_6084 = 24708;</code>
|
||||
*/
|
||||
CIA402_PROFILE_DECELERATION_6084(24708),
|
||||
/**
|
||||
* <code>CIA402_QUICK_STOP_DECELERATION_6085 = 24709;</code>
|
||||
*/
|
||||
CIA402_QUICK_STOP_DECELERATION_6085(24709),
|
||||
/**
|
||||
* <code>CIA402_TORQUE_SLOPE_6087 = 24711;</code>
|
||||
*/
|
||||
CIA402_TORQUE_SLOPE_6087(24711),
|
||||
/**
|
||||
* <code>CIA402_GEAR_RATIO_6091 = 24721;</code>
|
||||
*/
|
||||
CIA402_GEAR_RATIO_6091(24721),
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_OFFSET_60B1 = 24753;</code>
|
||||
*/
|
||||
CIA402_VELOCITY_OFFSET_60B1(24753),
|
||||
/**
|
||||
* <code>CIA402_TORQUE_OFFSET_60B2 = 24754;</code>
|
||||
*/
|
||||
CIA402_TORQUE_OFFSET_60B2(24754),
|
||||
/**
|
||||
* <code>CIA402_INTERPOLATION_DATA_RECORD_60C1 = 24769;</code>
|
||||
*/
|
||||
CIA402_INTERPOLATION_DATA_RECORD_60C1(24769),
|
||||
/**
|
||||
* <code>CIA402_INTERPOLATION_TIME_PERIOD_60C2 = 24770;</code>
|
||||
*/
|
||||
CIA402_INTERPOLATION_TIME_PERIOD_60C2(24770),
|
||||
/**
|
||||
* <code>CIA402_FOLLOWING_ERROR_ACTUAL_VALUE_60F4 = 24820;</code>
|
||||
*/
|
||||
CIA402_FOLLOWING_ERROR_ACTUAL_VALUE_60F4(24820),
|
||||
/**
|
||||
* <code>CIA402_TARGET_VELOCITY_60FF = 24831;</code>
|
||||
*/
|
||||
CIA402_TARGET_VELOCITY_60FF(24831),
|
||||
/**
|
||||
* <code>CIA402_SUPPORTED_DRIVE_MODES_6502 = 25858;</code>
|
||||
*/
|
||||
CIA402_SUPPORTED_DRIVE_MODES_6502(25858),
|
||||
UNRECOGNIZED(-1),
|
||||
;
|
||||
|
||||
/**
|
||||
* <code>CIA402_OBJECT_INDEX_ZERO = 0;</code>
|
||||
*/
|
||||
public static final int CIA402_OBJECT_INDEX_ZERO_VALUE = 0;
|
||||
/**
|
||||
* <code>CIA402_ERROR_CODE_603F = 24639;</code>
|
||||
*/
|
||||
public static final int CIA402_ERROR_CODE_603F_VALUE = 24639;
|
||||
/**
|
||||
* <code>CIA402_CONTROL_WORD_6040 = 24640;</code>
|
||||
*/
|
||||
public static final int CIA402_CONTROL_WORD_6040_VALUE = 24640;
|
||||
/**
|
||||
* <code>CIA402_STATUS_WORD_6041 = 24641;</code>
|
||||
*/
|
||||
public static final int CIA402_STATUS_WORD_6041_VALUE = 24641;
|
||||
/**
|
||||
* <code>CIA402_QUICK_STOP_OPTION_605A = 24666;</code>
|
||||
*/
|
||||
public static final int CIA402_QUICK_STOP_OPTION_605A_VALUE = 24666;
|
||||
/**
|
||||
* <code>CIA402_SHUTDOWN_OPTION_605B = 24667;</code>
|
||||
*/
|
||||
public static final int CIA402_SHUTDOWN_OPTION_605B_VALUE = 24667;
|
||||
/**
|
||||
* <code>CIA402_DISABLE_OPERATION_OPTION_605C = 24668;</code>
|
||||
*/
|
||||
public static final int CIA402_DISABLE_OPERATION_OPTION_605C_VALUE = 24668;
|
||||
/**
|
||||
* <code>CIA402_HALT_OPTION_605D = 24669;</code>
|
||||
*/
|
||||
public static final int CIA402_HALT_OPTION_605D_VALUE = 24669;
|
||||
/**
|
||||
* <code>CIA402_FAULT_REACTION_OPTION_605E = 24670;</code>
|
||||
*/
|
||||
public static final int CIA402_FAULT_REACTION_OPTION_605E_VALUE = 24670;
|
||||
/**
|
||||
* <code>CIA402_OPERATION_MODE_6060 = 24672;</code>
|
||||
*/
|
||||
public static final int CIA402_OPERATION_MODE_6060_VALUE = 24672;
|
||||
/**
|
||||
* <code>CIA402_MODE_DISPLAY_6061 = 24673;</code>
|
||||
*/
|
||||
public static final int CIA402_MODE_DISPLAY_6061_VALUE = 24673;
|
||||
/**
|
||||
* <code>CIA402_POSITION_DEMAND_VALUE_6062 = 24674;</code>
|
||||
*/
|
||||
public static final int CIA402_POSITION_DEMAND_VALUE_6062_VALUE = 24674;
|
||||
/**
|
||||
* <code>CIA402_ACTUAL_POSITION_6064 = 24676;</code>
|
||||
*/
|
||||
public static final int CIA402_ACTUAL_POSITION_6064_VALUE = 24676;
|
||||
/**
|
||||
* <code>CIA402_MAX_FOLLOWING_ERROR_6065 = 24677;</code>
|
||||
*/
|
||||
public static final int CIA402_MAX_FOLLOWING_ERROR_6065_VALUE = 24677;
|
||||
/**
|
||||
* <code>CIA402_POSITION_WINDOW_6067 = 24679;</code>
|
||||
*/
|
||||
public static final int CIA402_POSITION_WINDOW_6067_VALUE = 24679;
|
||||
/**
|
||||
* <code>CIA402_POSITION_WINDOW_TIME_6068 = 24680;</code>
|
||||
*/
|
||||
public static final int CIA402_POSITION_WINDOW_TIME_6068_VALUE = 24680;
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_DEMAND_VALUE_606B = 24683;</code>
|
||||
*/
|
||||
public static final int CIA402_VELOCITY_DEMAND_VALUE_606B_VALUE = 24683;
|
||||
/**
|
||||
* <code>CIA402_ACTUAL_VELOCITY_606C = 24684;</code>
|
||||
*/
|
||||
public static final int CIA402_ACTUAL_VELOCITY_606C_VALUE = 24684;
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_WINDOW_606D = 24685;</code>
|
||||
*/
|
||||
public static final int CIA402_VELOCITY_WINDOW_606D_VALUE = 24685;
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_WINDOW_TIME_606E = 24686;</code>
|
||||
*/
|
||||
public static final int CIA402_VELOCITY_WINDOW_TIME_606E_VALUE = 24686;
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_THRESHOLD_606F = 24687;</code>
|
||||
*/
|
||||
public static final int CIA402_VELOCITY_THRESHOLD_606F_VALUE = 24687;
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_THRESHOLD_TIME_6070 = 24688;</code>
|
||||
*/
|
||||
public static final int CIA402_VELOCITY_THRESHOLD_TIME_6070_VALUE = 24688;
|
||||
/**
|
||||
* <code>CIA402_TARGET_TORQUE_6071 = 24689;</code>
|
||||
*/
|
||||
public static final int CIA402_TARGET_TORQUE_6071_VALUE = 24689;
|
||||
/**
|
||||
* <code>CIA402_MAX_TORQUE_6072 = 24690;</code>
|
||||
*/
|
||||
public static final int CIA402_MAX_TORQUE_6072_VALUE = 24690;
|
||||
/**
|
||||
* <code>CIA402_TORQUE_DEMAND_VALUE_6074 = 24692;</code>
|
||||
*/
|
||||
public static final int CIA402_TORQUE_DEMAND_VALUE_6074_VALUE = 24692;
|
||||
/**
|
||||
* <code>CIA402_MOTOR_RATED_TORQUE_6076 = 24694;</code>
|
||||
*/
|
||||
public static final int CIA402_MOTOR_RATED_TORQUE_6076_VALUE = 24694;
|
||||
/**
|
||||
* <code>CIA402_ACTUAL_TORQUE_6077 = 24695;</code>
|
||||
*/
|
||||
public static final int CIA402_ACTUAL_TORQUE_6077_VALUE = 24695;
|
||||
/**
|
||||
* <code>CIA402_ACTUAL_CURRENT_6078 = 24696;</code>
|
||||
*/
|
||||
public static final int CIA402_ACTUAL_CURRENT_6078_VALUE = 24696;
|
||||
/**
|
||||
* <code>CIA402_DC_LINK_VOLTAGE_6079 = 24697;</code>
|
||||
*/
|
||||
public static final int CIA402_DC_LINK_VOLTAGE_6079_VALUE = 24697;
|
||||
/**
|
||||
* <code>CIA402_TARGET_POSITION_607A = 24698;</code>
|
||||
*/
|
||||
public static final int CIA402_TARGET_POSITION_607A_VALUE = 24698;
|
||||
/**
|
||||
* <code>CIA402_HOME_OFFSET_607C = 24700;</code>
|
||||
*/
|
||||
public static final int CIA402_HOME_OFFSET_607C_VALUE = 24700;
|
||||
/**
|
||||
* <code>CIA402_SOFTWARE_POSITION_LIMIT_607D = 24701;</code>
|
||||
*/
|
||||
public static final int CIA402_SOFTWARE_POSITION_LIMIT_607D_VALUE = 24701;
|
||||
/**
|
||||
* <code>CIA402_MAX_PROFILE_VELOCITY_607F = 24703;</code>
|
||||
*/
|
||||
public static final int CIA402_MAX_PROFILE_VELOCITY_607F_VALUE = 24703;
|
||||
/**
|
||||
* <code>CIA402_PROFILE_VELOCITY_6081 = 24705;</code>
|
||||
*/
|
||||
public static final int CIA402_PROFILE_VELOCITY_6081_VALUE = 24705;
|
||||
/**
|
||||
* <code>CIA402_PROFILE_ACCELERATION_6083 = 24707;</code>
|
||||
*/
|
||||
public static final int CIA402_PROFILE_ACCELERATION_6083_VALUE = 24707;
|
||||
/**
|
||||
* <code>CIA402_PROFILE_DECELERATION_6084 = 24708;</code>
|
||||
*/
|
||||
public static final int CIA402_PROFILE_DECELERATION_6084_VALUE = 24708;
|
||||
/**
|
||||
* <code>CIA402_QUICK_STOP_DECELERATION_6085 = 24709;</code>
|
||||
*/
|
||||
public static final int CIA402_QUICK_STOP_DECELERATION_6085_VALUE = 24709;
|
||||
/**
|
||||
* <code>CIA402_TORQUE_SLOPE_6087 = 24711;</code>
|
||||
*/
|
||||
public static final int CIA402_TORQUE_SLOPE_6087_VALUE = 24711;
|
||||
/**
|
||||
* <code>CIA402_GEAR_RATIO_6091 = 24721;</code>
|
||||
*/
|
||||
public static final int CIA402_GEAR_RATIO_6091_VALUE = 24721;
|
||||
/**
|
||||
* <code>CIA402_VELOCITY_OFFSET_60B1 = 24753;</code>
|
||||
*/
|
||||
public static final int CIA402_VELOCITY_OFFSET_60B1_VALUE = 24753;
|
||||
/**
|
||||
* <code>CIA402_TORQUE_OFFSET_60B2 = 24754;</code>
|
||||
*/
|
||||
public static final int CIA402_TORQUE_OFFSET_60B2_VALUE = 24754;
|
||||
/**
|
||||
* <code>CIA402_INTERPOLATION_DATA_RECORD_60C1 = 24769;</code>
|
||||
*/
|
||||
public static final int CIA402_INTERPOLATION_DATA_RECORD_60C1_VALUE = 24769;
|
||||
/**
|
||||
* <code>CIA402_INTERPOLATION_TIME_PERIOD_60C2 = 24770;</code>
|
||||
*/
|
||||
public static final int CIA402_INTERPOLATION_TIME_PERIOD_60C2_VALUE = 24770;
|
||||
/**
|
||||
* <code>CIA402_FOLLOWING_ERROR_ACTUAL_VALUE_60F4 = 24820;</code>
|
||||
*/
|
||||
public static final int CIA402_FOLLOWING_ERROR_ACTUAL_VALUE_60F4_VALUE = 24820;
|
||||
/**
|
||||
* <code>CIA402_TARGET_VELOCITY_60FF = 24831;</code>
|
||||
*/
|
||||
public static final int CIA402_TARGET_VELOCITY_60FF_VALUE = 24831;
|
||||
/**
|
||||
* <code>CIA402_SUPPORTED_DRIVE_MODES_6502 = 25858;</code>
|
||||
*/
|
||||
public static final int CIA402_SUPPORTED_DRIVE_MODES_6502_VALUE = 25858;
|
||||
|
||||
|
||||
public final int getNumber() {
|
||||
if (this == UNRECOGNIZED) {
|
||||
throw new java.lang.IllegalArgumentException(
|
||||
"Can't get the number of an unknown enum value.");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The numeric wire value of the corresponding enum entry.
|
||||
* @return The enum associated with the given numeric wire value.
|
||||
* @deprecated Use {@link #forNumber(int)} instead.
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public static Cia402ObjectIndex valueOf(int value) {
|
||||
return forNumber(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The numeric wire value of the corresponding enum entry.
|
||||
* @return The enum associated with the given numeric wire value.
|
||||
*/
|
||||
public static Cia402ObjectIndex forNumber(int value) {
|
||||
switch (value) {
|
||||
case 0: return CIA402_OBJECT_INDEX_ZERO;
|
||||
case 24639: return CIA402_ERROR_CODE_603F;
|
||||
case 24640: return CIA402_CONTROL_WORD_6040;
|
||||
case 24641: return CIA402_STATUS_WORD_6041;
|
||||
case 24666: return CIA402_QUICK_STOP_OPTION_605A;
|
||||
case 24667: return CIA402_SHUTDOWN_OPTION_605B;
|
||||
case 24668: return CIA402_DISABLE_OPERATION_OPTION_605C;
|
||||
case 24669: return CIA402_HALT_OPTION_605D;
|
||||
case 24670: return CIA402_FAULT_REACTION_OPTION_605E;
|
||||
case 24672: return CIA402_OPERATION_MODE_6060;
|
||||
case 24673: return CIA402_MODE_DISPLAY_6061;
|
||||
case 24674: return CIA402_POSITION_DEMAND_VALUE_6062;
|
||||
case 24676: return CIA402_ACTUAL_POSITION_6064;
|
||||
case 24677: return CIA402_MAX_FOLLOWING_ERROR_6065;
|
||||
case 24679: return CIA402_POSITION_WINDOW_6067;
|
||||
case 24680: return CIA402_POSITION_WINDOW_TIME_6068;
|
||||
case 24683: return CIA402_VELOCITY_DEMAND_VALUE_606B;
|
||||
case 24684: return CIA402_ACTUAL_VELOCITY_606C;
|
||||
case 24685: return CIA402_VELOCITY_WINDOW_606D;
|
||||
case 24686: return CIA402_VELOCITY_WINDOW_TIME_606E;
|
||||
case 24687: return CIA402_VELOCITY_THRESHOLD_606F;
|
||||
case 24688: return CIA402_VELOCITY_THRESHOLD_TIME_6070;
|
||||
case 24689: return CIA402_TARGET_TORQUE_6071;
|
||||
case 24690: return CIA402_MAX_TORQUE_6072;
|
||||
case 24692: return CIA402_TORQUE_DEMAND_VALUE_6074;
|
||||
case 24694: return CIA402_MOTOR_RATED_TORQUE_6076;
|
||||
case 24695: return CIA402_ACTUAL_TORQUE_6077;
|
||||
case 24696: return CIA402_ACTUAL_CURRENT_6078;
|
||||
case 24697: return CIA402_DC_LINK_VOLTAGE_6079;
|
||||
case 24698: return CIA402_TARGET_POSITION_607A;
|
||||
case 24700: return CIA402_HOME_OFFSET_607C;
|
||||
case 24701: return CIA402_SOFTWARE_POSITION_LIMIT_607D;
|
||||
case 24703: return CIA402_MAX_PROFILE_VELOCITY_607F;
|
||||
case 24705: return CIA402_PROFILE_VELOCITY_6081;
|
||||
case 24707: return CIA402_PROFILE_ACCELERATION_6083;
|
||||
case 24708: return CIA402_PROFILE_DECELERATION_6084;
|
||||
case 24709: return CIA402_QUICK_STOP_DECELERATION_6085;
|
||||
case 24711: return CIA402_TORQUE_SLOPE_6087;
|
||||
case 24721: return CIA402_GEAR_RATIO_6091;
|
||||
case 24753: return CIA402_VELOCITY_OFFSET_60B1;
|
||||
case 24754: return CIA402_TORQUE_OFFSET_60B2;
|
||||
case 24769: return CIA402_INTERPOLATION_DATA_RECORD_60C1;
|
||||
case 24770: return CIA402_INTERPOLATION_TIME_PERIOD_60C2;
|
||||
case 24820: return CIA402_FOLLOWING_ERROR_ACTUAL_VALUE_60F4;
|
||||
case 24831: return CIA402_TARGET_VELOCITY_60FF;
|
||||
case 25858: return CIA402_SUPPORTED_DRIVE_MODES_6502;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static com.google.protobuf.Internal.EnumLiteMap<Cia402ObjectIndex>
|
||||
internalGetValueMap() {
|
||||
return internalValueMap;
|
||||
}
|
||||
private static final com.google.protobuf.Internal.EnumLiteMap<
|
||||
Cia402ObjectIndex> internalValueMap =
|
||||
new com.google.protobuf.Internal.EnumLiteMap<Cia402ObjectIndex>() {
|
||||
public Cia402ObjectIndex findValueByNumber(int number) {
|
||||
return Cia402ObjectIndex.forNumber(number);
|
||||
}
|
||||
};
|
||||
|
||||
public final com.google.protobuf.Descriptors.EnumValueDescriptor
|
||||
getValueDescriptor() {
|
||||
if (this == UNRECOGNIZED) {
|
||||
throw new java.lang.IllegalStateException(
|
||||
"Can't get the descriptor of an unrecognized enum value.");
|
||||
}
|
||||
return getDescriptor().getValues().get(ordinal());
|
||||
}
|
||||
public final com.google.protobuf.Descriptors.EnumDescriptor
|
||||
getDescriptorForType() {
|
||||
return getDescriptor();
|
||||
}
|
||||
public static final com.google.protobuf.Descriptors.EnumDescriptor
|
||||
getDescriptor() {
|
||||
return cmvr.msgs.Cia402.getDescriptor().getEnumTypes().get(0);
|
||||
}
|
||||
|
||||
private static final Cia402ObjectIndex[] VALUES = values();
|
||||
|
||||
public static Cia402ObjectIndex valueOf(
|
||||
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
|
||||
if (desc.getType() != getDescriptor()) {
|
||||
throw new java.lang.IllegalArgumentException(
|
||||
"EnumValueDescriptor is not for this type.");
|
||||
}
|
||||
if (desc.getIndex() == -1) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
return VALUES[desc.getIndex()];
|
||||
}
|
||||
|
||||
private final int value;
|
||||
|
||||
private Cia402ObjectIndex(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(enum_scope:cmvr.msgs.Cia402ObjectIndex)
|
||||
}
|
||||
|
||||
|
||||
public static com.google.protobuf.Descriptors.FileDescriptor
|
||||
getDescriptor() {
|
||||
return descriptor;
|
||||
}
|
||||
private static com.google.protobuf.Descriptors.FileDescriptor
|
||||
descriptor;
|
||||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\026cmvr/msgs/cia402.proto\022\tcmvr.msgs*\260\r\n\021" +
|
||||
"Cia402ObjectIndex\022\034\n\030CIA402_OBJECT_INDEX" +
|
||||
"_ZERO\020\000\022\034\n\026CIA402_ERROR_CODE_603F\020\277\300\001\022\036\n" +
|
||||
"\030CIA402_CONTROL_WORD_6040\020\300\300\001\022\035\n\027CIA402_" +
|
||||
"STATUS_WORD_6041\020\301\300\001\022#\n\035CIA402_QUICK_STO" +
|
||||
"P_OPTION_605A\020\332\300\001\022!\n\033CIA402_SHUTDOWN_OPT" +
|
||||
"ION_605B\020\333\300\001\022*\n$CIA402_DISABLE_OPERATION" +
|
||||
"_OPTION_605C\020\334\300\001\022\035\n\027CIA402_HALT_OPTION_6" +
|
||||
"05D\020\335\300\001\022\'\n!CIA402_FAULT_REACTION_OPTION_" +
|
||||
"605E\020\336\300\001\022 \n\032CIA402_OPERATION_MODE_6060\020\340" +
|
||||
"\300\001\022\036\n\030CIA402_MODE_DISPLAY_6061\020\341\300\001\022\'\n!CI" +
|
||||
"A402_POSITION_DEMAND_VALUE_6062\020\342\300\001\022!\n\033C" +
|
||||
"IA402_ACTUAL_POSITION_6064\020\344\300\001\022%\n\037CIA402" +
|
||||
"_MAX_FOLLOWING_ERROR_6065\020\345\300\001\022!\n\033CIA402_" +
|
||||
"POSITION_WINDOW_6067\020\347\300\001\022&\n CIA402_POSIT" +
|
||||
"ION_WINDOW_TIME_6068\020\350\300\001\022\'\n!CIA402_VELOC" +
|
||||
"ITY_DEMAND_VALUE_606B\020\353\300\001\022!\n\033CIA402_ACTU" +
|
||||
"AL_VELOCITY_606C\020\354\300\001\022!\n\033CIA402_VELOCITY_" +
|
||||
"WINDOW_606D\020\355\300\001\022&\n CIA402_VELOCITY_WINDO" +
|
||||
"W_TIME_606E\020\356\300\001\022$\n\036CIA402_VELOCITY_THRES" +
|
||||
"HOLD_606F\020\357\300\001\022)\n#CIA402_VELOCITY_THRESHO" +
|
||||
"LD_TIME_6070\020\360\300\001\022\037\n\031CIA402_TARGET_TORQUE" +
|
||||
"_6071\020\361\300\001\022\034\n\026CIA402_MAX_TORQUE_6072\020\362\300\001\022" +
|
||||
"%\n\037CIA402_TORQUE_DEMAND_VALUE_6074\020\364\300\001\022$" +
|
||||
"\n\036CIA402_MOTOR_RATED_TORQUE_6076\020\366\300\001\022\037\n\031" +
|
||||
"CIA402_ACTUAL_TORQUE_6077\020\367\300\001\022 \n\032CIA402_" +
|
||||
"ACTUAL_CURRENT_6078\020\370\300\001\022!\n\033CIA402_DC_LIN" +
|
||||
"K_VOLTAGE_6079\020\371\300\001\022!\n\033CIA402_TARGET_POSI" +
|
||||
"TION_607A\020\372\300\001\022\035\n\027CIA402_HOME_OFFSET_607C" +
|
||||
"\020\374\300\001\022)\n#CIA402_SOFTWARE_POSITION_LIMIT_6" +
|
||||
"07D\020\375\300\001\022&\n CIA402_MAX_PROFILE_VELOCITY_6" +
|
||||
"07F\020\377\300\001\022\"\n\034CIA402_PROFILE_VELOCITY_6081\020" +
|
||||
"\201\301\001\022&\n CIA402_PROFILE_ACCELERATION_6083\020" +
|
||||
"\203\301\001\022&\n CIA402_PROFILE_DECELERATION_6084\020" +
|
||||
"\204\301\001\022)\n#CIA402_QUICK_STOP_DECELERATION_60" +
|
||||
"85\020\205\301\001\022\036\n\030CIA402_TORQUE_SLOPE_6087\020\207\301\001\022\034" +
|
||||
"\n\026CIA402_GEAR_RATIO_6091\020\221\301\001\022!\n\033CIA402_V" +
|
||||
"ELOCITY_OFFSET_60B1\020\261\301\001\022\037\n\031CIA402_TORQUE" +
|
||||
"_OFFSET_60B2\020\262\301\001\022+\n%CIA402_INTERPOLATION" +
|
||||
"_DATA_RECORD_60C1\020\301\301\001\022+\n%CIA402_INTERPOL" +
|
||||
"ATION_TIME_PERIOD_60C2\020\302\301\001\022.\n(CIA402_FOL" +
|
||||
"LOWING_ERROR_ACTUAL_VALUE_60F4\020\364\301\001\022!\n\033CI" +
|
||||
"A402_TARGET_VELOCITY_60FF\020\377\301\001\022\'\n!CIA402_" +
|
||||
"SUPPORTED_DRIVE_MODES_6502\020\202\312\001b\006proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||
});
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
||||
@ -0,0 +1,909 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: cmvr/msgs/error_code.proto
|
||||
|
||||
package cmvr.msgs;
|
||||
|
||||
public final class ErrorCodeOuterClass {
|
||||
private ErrorCodeOuterClass() {}
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistryLite registry) {
|
||||
}
|
||||
|
||||
public static void registerAllExtensions(
|
||||
com.google.protobuf.ExtensionRegistry registry) {
|
||||
registerAllExtensions(
|
||||
(com.google.protobuf.ExtensionRegistryLite) registry);
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* Error codes enum for API's categorized by modules.
|
||||
* </pre>
|
||||
*
|
||||
* Protobuf enum {@code cmvr.msgs.ErrorCode}
|
||||
*/
|
||||
public enum ErrorCode
|
||||
implements com.google.protobuf.ProtocolMessageEnum {
|
||||
/**
|
||||
* <pre>
|
||||
* No error, returns on success.
|
||||
* </pre>
|
||||
*
|
||||
* <code>OK = 0;</code>
|
||||
*/
|
||||
OK(0),
|
||||
/**
|
||||
* <pre>
|
||||
* Canbus module error codes start from here.
|
||||
* </pre>
|
||||
*
|
||||
* <code>CANBUS_ERROR = 2000;</code>
|
||||
*/
|
||||
CANBUS_ERROR(2000),
|
||||
/**
|
||||
* <code>CAN_CLIENT_ERROR_BASE = 2100;</code>
|
||||
*/
|
||||
CAN_CLIENT_ERROR_BASE(2100),
|
||||
/**
|
||||
* <code>CAN_CLIENT_ERROR_OPEN_DEVICE_FAILED = 2101;</code>
|
||||
*/
|
||||
CAN_CLIENT_ERROR_OPEN_DEVICE_FAILED(2101),
|
||||
/**
|
||||
* <code>CAN_CLIENT_ERROR_FRAME_NUM = 2102;</code>
|
||||
*/
|
||||
CAN_CLIENT_ERROR_FRAME_NUM(2102),
|
||||
/**
|
||||
* <code>CAN_CLIENT_ERROR_SEND_FAILED = 2103;</code>
|
||||
*/
|
||||
CAN_CLIENT_ERROR_SEND_FAILED(2103),
|
||||
/**
|
||||
* <code>CAN_CLIENT_ERROR_RECV_FAILED = 2104;</code>
|
||||
*/
|
||||
CAN_CLIENT_ERROR_RECV_FAILED(2104),
|
||||
/**
|
||||
* <pre>
|
||||
* motor
|
||||
* </pre>
|
||||
*
|
||||
* <code>MOTOR_ERROR = 3000;</code>
|
||||
*/
|
||||
MOTOR_ERROR(3000),
|
||||
/**
|
||||
* <code>MOTOR_ERROR_SET_ZERO = 3001;</code>
|
||||
*/
|
||||
MOTOR_ERROR_SET_ZERO(3001),
|
||||
UNRECOGNIZED(-1),
|
||||
;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* No error, returns on success.
|
||||
* </pre>
|
||||
*
|
||||
* <code>OK = 0;</code>
|
||||
*/
|
||||
public static final int OK_VALUE = 0;
|
||||
/**
|
||||
* <pre>
|
||||
* Canbus module error codes start from here.
|
||||
* </pre>
|
||||
*
|
||||
* <code>CANBUS_ERROR = 2000;</code>
|
||||
*/
|
||||
public static final int CANBUS_ERROR_VALUE = 2000;
|
||||
/**
|
||||
* <code>CAN_CLIENT_ERROR_BASE = 2100;</code>
|
||||
*/
|
||||
public static final int CAN_CLIENT_ERROR_BASE_VALUE = 2100;
|
||||
/**
|
||||
* <code>CAN_CLIENT_ERROR_OPEN_DEVICE_FAILED = 2101;</code>
|
||||
*/
|
||||
public static final int CAN_CLIENT_ERROR_OPEN_DEVICE_FAILED_VALUE = 2101;
|
||||
/**
|
||||
* <code>CAN_CLIENT_ERROR_FRAME_NUM = 2102;</code>
|
||||
*/
|
||||
public static final int CAN_CLIENT_ERROR_FRAME_NUM_VALUE = 2102;
|
||||
/**
|
||||
* <code>CAN_CLIENT_ERROR_SEND_FAILED = 2103;</code>
|
||||
*/
|
||||
public static final int CAN_CLIENT_ERROR_SEND_FAILED_VALUE = 2103;
|
||||
/**
|
||||
* <code>CAN_CLIENT_ERROR_RECV_FAILED = 2104;</code>
|
||||
*/
|
||||
public static final int CAN_CLIENT_ERROR_RECV_FAILED_VALUE = 2104;
|
||||
/**
|
||||
* <pre>
|
||||
* motor
|
||||
* </pre>
|
||||
*
|
||||
* <code>MOTOR_ERROR = 3000;</code>
|
||||
*/
|
||||
public static final int MOTOR_ERROR_VALUE = 3000;
|
||||
/**
|
||||
* <code>MOTOR_ERROR_SET_ZERO = 3001;</code>
|
||||
*/
|
||||
public static final int MOTOR_ERROR_SET_ZERO_VALUE = 3001;
|
||||
|
||||
|
||||
public final int getNumber() {
|
||||
if (this == UNRECOGNIZED) {
|
||||
throw new java.lang.IllegalArgumentException(
|
||||
"Can't get the number of an unknown enum value.");
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The numeric wire value of the corresponding enum entry.
|
||||
* @return The enum associated with the given numeric wire value.
|
||||
* @deprecated Use {@link #forNumber(int)} instead.
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public static ErrorCode valueOf(int value) {
|
||||
return forNumber(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param value The numeric wire value of the corresponding enum entry.
|
||||
* @return The enum associated with the given numeric wire value.
|
||||
*/
|
||||
public static ErrorCode forNumber(int value) {
|
||||
switch (value) {
|
||||
case 0: return OK;
|
||||
case 2000: return CANBUS_ERROR;
|
||||
case 2100: return CAN_CLIENT_ERROR_BASE;
|
||||
case 2101: return CAN_CLIENT_ERROR_OPEN_DEVICE_FAILED;
|
||||
case 2102: return CAN_CLIENT_ERROR_FRAME_NUM;
|
||||
case 2103: return CAN_CLIENT_ERROR_SEND_FAILED;
|
||||
case 2104: return CAN_CLIENT_ERROR_RECV_FAILED;
|
||||
case 3000: return MOTOR_ERROR;
|
||||
case 3001: return MOTOR_ERROR_SET_ZERO;
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static com.google.protobuf.Internal.EnumLiteMap<ErrorCode>
|
||||
internalGetValueMap() {
|
||||
return internalValueMap;
|
||||
}
|
||||
private static final com.google.protobuf.Internal.EnumLiteMap<
|
||||
ErrorCode> internalValueMap =
|
||||
new com.google.protobuf.Internal.EnumLiteMap<ErrorCode>() {
|
||||
public ErrorCode findValueByNumber(int number) {
|
||||
return ErrorCode.forNumber(number);
|
||||
}
|
||||
};
|
||||
|
||||
public final com.google.protobuf.Descriptors.EnumValueDescriptor
|
||||
getValueDescriptor() {
|
||||
if (this == UNRECOGNIZED) {
|
||||
throw new java.lang.IllegalStateException(
|
||||
"Can't get the descriptor of an unrecognized enum value.");
|
||||
}
|
||||
return getDescriptor().getValues().get(ordinal());
|
||||
}
|
||||
public final com.google.protobuf.Descriptors.EnumDescriptor
|
||||
getDescriptorForType() {
|
||||
return getDescriptor();
|
||||
}
|
||||
public static final com.google.protobuf.Descriptors.EnumDescriptor
|
||||
getDescriptor() {
|
||||
return cmvr.msgs.ErrorCodeOuterClass.getDescriptor().getEnumTypes().get(0);
|
||||
}
|
||||
|
||||
private static final ErrorCode[] VALUES = values();
|
||||
|
||||
public static ErrorCode valueOf(
|
||||
com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
|
||||
if (desc.getType() != getDescriptor()) {
|
||||
throw new java.lang.IllegalArgumentException(
|
||||
"EnumValueDescriptor is not for this type.");
|
||||
}
|
||||
if (desc.getIndex() == -1) {
|
||||
return UNRECOGNIZED;
|
||||
}
|
||||
return VALUES[desc.getIndex()];
|
||||
}
|
||||
|
||||
private final int value;
|
||||
|
||||
private ErrorCode(int value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(enum_scope:cmvr.msgs.ErrorCode)
|
||||
}
|
||||
|
||||
public interface StatusPbOrBuilder extends
|
||||
// @@protoc_insertion_point(interface_extends:cmvr.msgs.StatusPb)
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <code>.cmvr.msgs.ErrorCode error_code = 1;</code>
|
||||
* @return The enum numeric value on the wire for errorCode.
|
||||
*/
|
||||
int getErrorCodeValue();
|
||||
/**
|
||||
* <code>.cmvr.msgs.ErrorCode error_code = 1;</code>
|
||||
* @return The errorCode.
|
||||
*/
|
||||
cmvr.msgs.ErrorCodeOuterClass.ErrorCode getErrorCode();
|
||||
|
||||
/**
|
||||
* <code>string msg = 2;</code>
|
||||
* @return The msg.
|
||||
*/
|
||||
java.lang.String getMsg();
|
||||
/**
|
||||
* <code>string msg = 2;</code>
|
||||
* @return The bytes for msg.
|
||||
*/
|
||||
com.google.protobuf.ByteString
|
||||
getMsgBytes();
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code cmvr.msgs.StatusPb}
|
||||
*/
|
||||
public static final class StatusPb extends
|
||||
com.google.protobuf.GeneratedMessageV3 implements
|
||||
// @@protoc_insertion_point(message_implements:cmvr.msgs.StatusPb)
|
||||
StatusPbOrBuilder {
|
||||
private static final long serialVersionUID = 0L;
|
||||
// Use StatusPb.newBuilder() to construct.
|
||||
private StatusPb(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
private StatusPb() {
|
||||
errorCode_ = 0;
|
||||
msg_ = "";
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@SuppressWarnings({"unused"})
|
||||
protected java.lang.Object newInstance(
|
||||
UnusedPrivateParameter unused) {
|
||||
return new StatusPb();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final com.google.protobuf.UnknownFieldSet
|
||||
getUnknownFields() {
|
||||
return this.unknownFields;
|
||||
}
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return cmvr.msgs.ErrorCodeOuterClass.internal_static_cmvr_msgs_StatusPb_descriptor;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return cmvr.msgs.ErrorCodeOuterClass.internal_static_cmvr_msgs_StatusPb_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
cmvr.msgs.ErrorCodeOuterClass.StatusPb.class, cmvr.msgs.ErrorCodeOuterClass.StatusPb.Builder.class);
|
||||
}
|
||||
|
||||
public static final int ERROR_CODE_FIELD_NUMBER = 1;
|
||||
private int errorCode_;
|
||||
/**
|
||||
* <code>.cmvr.msgs.ErrorCode error_code = 1;</code>
|
||||
* @return The enum numeric value on the wire for errorCode.
|
||||
*/
|
||||
@java.lang.Override public int getErrorCodeValue() {
|
||||
return errorCode_;
|
||||
}
|
||||
/**
|
||||
* <code>.cmvr.msgs.ErrorCode error_code = 1;</code>
|
||||
* @return The errorCode.
|
||||
*/
|
||||
@java.lang.Override public cmvr.msgs.ErrorCodeOuterClass.ErrorCode getErrorCode() {
|
||||
@SuppressWarnings("deprecation")
|
||||
cmvr.msgs.ErrorCodeOuterClass.ErrorCode result = cmvr.msgs.ErrorCodeOuterClass.ErrorCode.valueOf(errorCode_);
|
||||
return result == null ? cmvr.msgs.ErrorCodeOuterClass.ErrorCode.UNRECOGNIZED : result;
|
||||
}
|
||||
|
||||
public static final int MSG_FIELD_NUMBER = 2;
|
||||
private volatile java.lang.Object msg_;
|
||||
/**
|
||||
* <code>string msg = 2;</code>
|
||||
* @return The msg.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public java.lang.String getMsg() {
|
||||
java.lang.Object ref = msg_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
return (java.lang.String) ref;
|
||||
} else {
|
||||
com.google.protobuf.ByteString bs =
|
||||
(com.google.protobuf.ByteString) ref;
|
||||
java.lang.String s = bs.toStringUtf8();
|
||||
msg_ = s;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>string msg = 2;</code>
|
||||
* @return The bytes for msg.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.ByteString
|
||||
getMsgBytes() {
|
||||
java.lang.Object ref = msg_;
|
||||
if (ref instanceof java.lang.String) {
|
||||
com.google.protobuf.ByteString b =
|
||||
com.google.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
msg_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (com.google.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
|
||||
private byte memoizedIsInitialized = -1;
|
||||
@java.lang.Override
|
||||
public final boolean isInitialized() {
|
||||
byte isInitialized = memoizedIsInitialized;
|
||||
if (isInitialized == 1) return true;
|
||||
if (isInitialized == 0) return false;
|
||||
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
if (errorCode_ != cmvr.msgs.ErrorCodeOuterClass.ErrorCode.OK.getNumber()) {
|
||||
output.writeEnum(1, errorCode_);
|
||||
}
|
||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(msg_)) {
|
||||
com.google.protobuf.GeneratedMessageV3.writeString(output, 2, msg_);
|
||||
}
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
if (errorCode_ != cmvr.msgs.ErrorCodeOuterClass.ErrorCode.OK.getNumber()) {
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeEnumSize(1, errorCode_);
|
||||
}
|
||||
if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(msg_)) {
|
||||
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, msg_);
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public boolean equals(final java.lang.Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof cmvr.msgs.ErrorCodeOuterClass.StatusPb)) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
cmvr.msgs.ErrorCodeOuterClass.StatusPb other = (cmvr.msgs.ErrorCodeOuterClass.StatusPb) obj;
|
||||
|
||||
if (errorCode_ != other.errorCode_) return false;
|
||||
if (!getMsg()
|
||||
.equals(other.getMsg())) return false;
|
||||
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public int hashCode() {
|
||||
if (memoizedHashCode != 0) {
|
||||
return memoizedHashCode;
|
||||
}
|
||||
int hash = 41;
|
||||
hash = (19 * hash) + getDescriptor().hashCode();
|
||||
hash = (37 * hash) + ERROR_CODE_FIELD_NUMBER;
|
||||
hash = (53 * hash) + errorCode_;
|
||||
hash = (37 * hash) + MSG_FIELD_NUMBER;
|
||||
hash = (53 * hash) + getMsg().hashCode();
|
||||
hash = (29 * hash) + getUnknownFields().hashCode();
|
||||
memoizedHashCode = hash;
|
||||
return hash;
|
||||
}
|
||||
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseFrom(
|
||||
java.nio.ByteBuffer data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseFrom(
|
||||
java.nio.ByteBuffer data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseDelimitedWithIOException(PARSER, input);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder() {
|
||||
return DEFAULT_INSTANCE.toBuilder();
|
||||
}
|
||||
public static Builder newBuilder(cmvr.msgs.ErrorCodeOuterClass.StatusPb prototype) {
|
||||
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder toBuilder() {
|
||||
return this == DEFAULT_INSTANCE
|
||||
? new Builder() : new Builder().mergeFrom(this);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected Builder newBuilderForType(
|
||||
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
|
||||
Builder builder = new Builder(parent);
|
||||
return builder;
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code cmvr.msgs.StatusPb}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
|
||||
// @@protoc_insertion_point(builder_implements:cmvr.msgs.StatusPb)
|
||||
cmvr.msgs.ErrorCodeOuterClass.StatusPbOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return cmvr.msgs.ErrorCodeOuterClass.internal_static_cmvr_msgs_StatusPb_descriptor;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return cmvr.msgs.ErrorCodeOuterClass.internal_static_cmvr_msgs_StatusPb_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
cmvr.msgs.ErrorCodeOuterClass.StatusPb.class, cmvr.msgs.ErrorCodeOuterClass.StatusPb.Builder.class);
|
||||
}
|
||||
|
||||
// Construct using cmvr.msgs.ErrorCodeOuterClass.StatusPb.newBuilder()
|
||||
private Builder() {
|
||||
|
||||
}
|
||||
|
||||
private Builder(
|
||||
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
|
||||
super(parent);
|
||||
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder clear() {
|
||||
super.clear();
|
||||
errorCode_ = 0;
|
||||
|
||||
msg_ = "";
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return cmvr.msgs.ErrorCodeOuterClass.internal_static_cmvr_msgs_StatusPb_descriptor;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.msgs.ErrorCodeOuterClass.StatusPb getDefaultInstanceForType() {
|
||||
return cmvr.msgs.ErrorCodeOuterClass.StatusPb.getDefaultInstance();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.msgs.ErrorCodeOuterClass.StatusPb build() {
|
||||
cmvr.msgs.ErrorCodeOuterClass.StatusPb result = buildPartial();
|
||||
if (!result.isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.msgs.ErrorCodeOuterClass.StatusPb buildPartial() {
|
||||
cmvr.msgs.ErrorCodeOuterClass.StatusPb result = new cmvr.msgs.ErrorCodeOuterClass.StatusPb(this);
|
||||
result.errorCode_ = errorCode_;
|
||||
result.msg_ = msg_;
|
||||
onBuilt();
|
||||
return result;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public Builder clone() {
|
||||
return super.clone();
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder setField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||
java.lang.Object value) {
|
||||
return super.setField(field, value);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder clearField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field) {
|
||||
return super.clearField(field);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder clearOneof(
|
||||
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
|
||||
return super.clearOneof(oneof);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder setRepeatedField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||
int index, java.lang.Object value) {
|
||||
return super.setRepeatedField(field, index, value);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder addRepeatedField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||
java.lang.Object value) {
|
||||
return super.addRepeatedField(field, value);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof cmvr.msgs.ErrorCodeOuterClass.StatusPb) {
|
||||
return mergeFrom((cmvr.msgs.ErrorCodeOuterClass.StatusPb)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(cmvr.msgs.ErrorCodeOuterClass.StatusPb other) {
|
||||
if (other == cmvr.msgs.ErrorCodeOuterClass.StatusPb.getDefaultInstance()) return this;
|
||||
if (other.errorCode_ != 0) {
|
||||
setErrorCodeValue(other.getErrorCodeValue());
|
||||
}
|
||||
if (!other.getMsg().isEmpty()) {
|
||||
msg_ = other.msg_;
|
||||
onChanged();
|
||||
}
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final boolean isInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
if (extensionRegistry == null) {
|
||||
throw new java.lang.NullPointerException();
|
||||
}
|
||||
try {
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
int tag = input.readTag();
|
||||
switch (tag) {
|
||||
case 0:
|
||||
done = true;
|
||||
break;
|
||||
case 8: {
|
||||
errorCode_ = input.readEnum();
|
||||
|
||||
break;
|
||||
} // case 8
|
||||
case 18: {
|
||||
msg_ = input.readStringRequireUtf8();
|
||||
|
||||
break;
|
||||
} // case 18
|
||||
default: {
|
||||
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
|
||||
done = true; // was an endgroup tag
|
||||
}
|
||||
break;
|
||||
} // default:
|
||||
} // switch (tag)
|
||||
} // while (!done)
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
throw e.unwrapIOException();
|
||||
} finally {
|
||||
onChanged();
|
||||
} // finally
|
||||
return this;
|
||||
}
|
||||
|
||||
private int errorCode_ = 0;
|
||||
/**
|
||||
* <code>.cmvr.msgs.ErrorCode error_code = 1;</code>
|
||||
* @return The enum numeric value on the wire for errorCode.
|
||||
*/
|
||||
@java.lang.Override public int getErrorCodeValue() {
|
||||
return errorCode_;
|
||||
}
|
||||
/**
|
||||
* <code>.cmvr.msgs.ErrorCode error_code = 1;</code>
|
||||
* @param value The enum numeric value on the wire for errorCode to set.
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder setErrorCodeValue(int value) {
|
||||
|
||||
errorCode_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>.cmvr.msgs.ErrorCode error_code = 1;</code>
|
||||
* @return The errorCode.
|
||||
*/
|
||||
@java.lang.Override
|
||||
public cmvr.msgs.ErrorCodeOuterClass.ErrorCode getErrorCode() {
|
||||
@SuppressWarnings("deprecation")
|
||||
cmvr.msgs.ErrorCodeOuterClass.ErrorCode result = cmvr.msgs.ErrorCodeOuterClass.ErrorCode.valueOf(errorCode_);
|
||||
return result == null ? cmvr.msgs.ErrorCodeOuterClass.ErrorCode.UNRECOGNIZED : result;
|
||||
}
|
||||
/**
|
||||
* <code>.cmvr.msgs.ErrorCode error_code = 1;</code>
|
||||
* @param value The errorCode to set.
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder setErrorCode(cmvr.msgs.ErrorCodeOuterClass.ErrorCode value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
errorCode_ = value.getNumber();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>.cmvr.msgs.ErrorCode error_code = 1;</code>
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder clearErrorCode() {
|
||||
|
||||
errorCode_ = 0;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
private java.lang.Object msg_ = "";
|
||||
/**
|
||||
* <code>string msg = 2;</code>
|
||||
* @return The msg.
|
||||
*/
|
||||
public java.lang.String getMsg() {
|
||||
java.lang.Object ref = msg_;
|
||||
if (!(ref instanceof java.lang.String)) {
|
||||
com.google.protobuf.ByteString bs =
|
||||
(com.google.protobuf.ByteString) ref;
|
||||
java.lang.String s = bs.toStringUtf8();
|
||||
msg_ = s;
|
||||
return s;
|
||||
} else {
|
||||
return (java.lang.String) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>string msg = 2;</code>
|
||||
* @return The bytes for msg.
|
||||
*/
|
||||
public com.google.protobuf.ByteString
|
||||
getMsgBytes() {
|
||||
java.lang.Object ref = msg_;
|
||||
if (ref instanceof String) {
|
||||
com.google.protobuf.ByteString b =
|
||||
com.google.protobuf.ByteString.copyFromUtf8(
|
||||
(java.lang.String) ref);
|
||||
msg_ = b;
|
||||
return b;
|
||||
} else {
|
||||
return (com.google.protobuf.ByteString) ref;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* <code>string msg = 2;</code>
|
||||
* @param value The msg to set.
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder setMsg(
|
||||
java.lang.String value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
|
||||
msg_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>string msg = 2;</code>
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder clearMsg() {
|
||||
|
||||
msg_ = getDefaultInstance().getMsg();
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <code>string msg = 2;</code>
|
||||
* @param value The bytes for msg to set.
|
||||
* @return This builder for chaining.
|
||||
*/
|
||||
public Builder setMsgBytes(
|
||||
com.google.protobuf.ByteString value) {
|
||||
if (value == null) {
|
||||
throw new NullPointerException();
|
||||
}
|
||||
checkByteStringIsUtf8(value);
|
||||
|
||||
msg_ = value;
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
@java.lang.Override
|
||||
public final Builder setUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return super.setUnknownFields(unknownFields);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final Builder mergeUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return super.mergeUnknownFields(unknownFields);
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:cmvr.msgs.StatusPb)
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:cmvr.msgs.StatusPb)
|
||||
private static final cmvr.msgs.ErrorCodeOuterClass.StatusPb DEFAULT_INSTANCE;
|
||||
static {
|
||||
DEFAULT_INSTANCE = new cmvr.msgs.ErrorCodeOuterClass.StatusPb();
|
||||
}
|
||||
|
||||
public static cmvr.msgs.ErrorCodeOuterClass.StatusPb getDefaultInstance() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Parser<StatusPb>
|
||||
PARSER = new com.google.protobuf.AbstractParser<StatusPb>() {
|
||||
@java.lang.Override
|
||||
public StatusPb parsePartialFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
Builder builder = newBuilder();
|
||||
try {
|
||||
builder.mergeFrom(input, extensionRegistry);
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
throw e.setUnfinishedMessage(builder.buildPartial());
|
||||
} catch (com.google.protobuf.UninitializedMessageException e) {
|
||||
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
|
||||
} catch (java.io.IOException e) {
|
||||
throw new com.google.protobuf.InvalidProtocolBufferException(e)
|
||||
.setUnfinishedMessage(builder.buildPartial());
|
||||
}
|
||||
return builder.buildPartial();
|
||||
}
|
||||
};
|
||||
|
||||
public static com.google.protobuf.Parser<StatusPb> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<StatusPb> getParserForType() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.msgs.ErrorCodeOuterClass.StatusPb getDefaultInstanceForType() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_cmvr_msgs_StatusPb_descriptor;
|
||||
private static final
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internal_static_cmvr_msgs_StatusPb_fieldAccessorTable;
|
||||
|
||||
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/msgs/error_code.proto\022\tcmvr.msgs\"" +
|
||||
"A\n\010StatusPb\022(\n\nerror_code\030\001 \001(\0162\024.cmvr.m" +
|
||||
"sgs.ErrorCode\022\013\n\003msg\030\002 \001(\t*\200\002\n\tErrorCode" +
|
||||
"\022\006\n\002OK\020\000\022\021\n\014CANBUS_ERROR\020\320\017\022\032\n\025CAN_CLIEN" +
|
||||
"T_ERROR_BASE\020\264\020\022(\n#CAN_CLIENT_ERROR_OPEN" +
|
||||
"_DEVICE_FAILED\020\265\020\022\037\n\032CAN_CLIENT_ERROR_FR" +
|
||||
"AME_NUM\020\266\020\022!\n\034CAN_CLIENT_ERROR_SEND_FAIL" +
|
||||
"ED\020\267\020\022!\n\034CAN_CLIENT_ERROR_RECV_FAILED\020\270\020" +
|
||||
"\022\020\n\013MOTOR_ERROR\020\270\027\022\031\n\024MOTOR_ERROR_SET_ZE" +
|
||||
"RO\020\271\027b\006proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||
});
|
||||
internal_static_cmvr_msgs_StatusPb_descriptor =
|
||||
getDescriptor().getMessageTypes().get(0);
|
||||
internal_static_cmvr_msgs_StatusPb_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
|
||||
internal_static_cmvr_msgs_StatusPb_descriptor,
|
||||
new java.lang.String[] { "ErrorCode", "Msg", });
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,847 @@
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: cmvr/msgs/robot_detail.proto
|
||||
|
||||
package cmvr.msgs;
|
||||
|
||||
public final class RobotDetailOuterClass {
|
||||
private RobotDetailOuterClass() {}
|
||||
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 interface RobotDetailOrBuilder extends
|
||||
// @@protoc_insertion_point(interface_extends:cmvr.msgs.RobotDetail)
|
||||
com.google.protobuf.MessageOrBuilder {
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
int getMotorsCount();
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
boolean containsMotors(
|
||||
int key);
|
||||
/**
|
||||
* Use {@link #getMotorsMap()} instead.
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus>
|
||||
getMotors();
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus>
|
||||
getMotorsMap();
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
|
||||
/* nullable */
|
||||
cmvr.msgs.Motor.MotorStatus getMotorsOrDefault(
|
||||
int key,
|
||||
/* nullable */
|
||||
cmvr.msgs.Motor.MotorStatus defaultValue);
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
|
||||
cmvr.msgs.Motor.MotorStatus getMotorsOrThrow(
|
||||
int key);
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code cmvr.msgs.RobotDetail}
|
||||
*/
|
||||
public static final class RobotDetail extends
|
||||
com.google.protobuf.GeneratedMessageV3 implements
|
||||
// @@protoc_insertion_point(message_implements:cmvr.msgs.RobotDetail)
|
||||
RobotDetailOrBuilder {
|
||||
private static final long serialVersionUID = 0L;
|
||||
// Use RobotDetail.newBuilder() to construct.
|
||||
private RobotDetail(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) {
|
||||
super(builder);
|
||||
}
|
||||
private RobotDetail() {
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
@SuppressWarnings({"unused"})
|
||||
protected java.lang.Object newInstance(
|
||||
UnusedPrivateParameter unused) {
|
||||
return new RobotDetail();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final com.google.protobuf.UnknownFieldSet
|
||||
getUnknownFields() {
|
||||
return this.unknownFields;
|
||||
}
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return cmvr.msgs.RobotDetailOuterClass.internal_static_cmvr_msgs_RobotDetail_descriptor;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
@java.lang.Override
|
||||
protected com.google.protobuf.MapField internalGetMapField(
|
||||
int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return internalGetMotors();
|
||||
default:
|
||||
throw new RuntimeException(
|
||||
"Invalid map field number: " + number);
|
||||
}
|
||||
}
|
||||
@java.lang.Override
|
||||
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return cmvr.msgs.RobotDetailOuterClass.internal_static_cmvr_msgs_RobotDetail_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
cmvr.msgs.RobotDetailOuterClass.RobotDetail.class, cmvr.msgs.RobotDetailOuterClass.RobotDetail.Builder.class);
|
||||
}
|
||||
|
||||
public static final int MOTORS_FIELD_NUMBER = 1;
|
||||
private static final class MotorsDefaultEntryHolder {
|
||||
static final com.google.protobuf.MapEntry<
|
||||
java.lang.Integer, cmvr.msgs.Motor.MotorStatus> defaultEntry =
|
||||
com.google.protobuf.MapEntry
|
||||
.<java.lang.Integer, cmvr.msgs.Motor.MotorStatus>newDefaultInstance(
|
||||
cmvr.msgs.RobotDetailOuterClass.internal_static_cmvr_msgs_RobotDetail_MotorsEntry_descriptor,
|
||||
com.google.protobuf.WireFormat.FieldType.UINT32,
|
||||
0,
|
||||
com.google.protobuf.WireFormat.FieldType.MESSAGE,
|
||||
cmvr.msgs.Motor.MotorStatus.getDefaultInstance());
|
||||
}
|
||||
private com.google.protobuf.MapField<
|
||||
java.lang.Integer, cmvr.msgs.Motor.MotorStatus> motors_;
|
||||
private com.google.protobuf.MapField<java.lang.Integer, cmvr.msgs.Motor.MotorStatus>
|
||||
internalGetMotors() {
|
||||
if (motors_ == null) {
|
||||
return com.google.protobuf.MapField.emptyMapField(
|
||||
MotorsDefaultEntryHolder.defaultEntry);
|
||||
}
|
||||
return motors_;
|
||||
}
|
||||
|
||||
public int getMotorsCount() {
|
||||
return internalGetMotors().getMap().size();
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
|
||||
@java.lang.Override
|
||||
public boolean containsMotors(
|
||||
int key) {
|
||||
|
||||
return internalGetMotors().getMap().containsKey(key);
|
||||
}
|
||||
/**
|
||||
* Use {@link #getMotorsMap()} instead.
|
||||
*/
|
||||
@java.lang.Override
|
||||
@java.lang.Deprecated
|
||||
public java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus> getMotors() {
|
||||
return getMotorsMap();
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
|
||||
public java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus> getMotorsMap() {
|
||||
return internalGetMotors().getMap();
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
|
||||
public cmvr.msgs.Motor.MotorStatus getMotorsOrDefault(
|
||||
int key,
|
||||
cmvr.msgs.Motor.MotorStatus defaultValue) {
|
||||
|
||||
java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus> map =
|
||||
internalGetMotors().getMap();
|
||||
return map.containsKey(key) ? map.get(key) : defaultValue;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
|
||||
public cmvr.msgs.Motor.MotorStatus getMotorsOrThrow(
|
||||
int key) {
|
||||
|
||||
java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus> map =
|
||||
internalGetMotors().getMap();
|
||||
if (!map.containsKey(key)) {
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
}
|
||||
return map.get(key);
|
||||
}
|
||||
|
||||
private byte memoizedIsInitialized = -1;
|
||||
@java.lang.Override
|
||||
public final boolean isInitialized() {
|
||||
byte isInitialized = memoizedIsInitialized;
|
||||
if (isInitialized == 1) return true;
|
||||
if (isInitialized == 0) return false;
|
||||
|
||||
memoizedIsInitialized = 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public void writeTo(com.google.protobuf.CodedOutputStream output)
|
||||
throws java.io.IOException {
|
||||
com.google.protobuf.GeneratedMessageV3
|
||||
.serializeIntegerMapTo(
|
||||
output,
|
||||
internalGetMotors(),
|
||||
MotorsDefaultEntryHolder.defaultEntry,
|
||||
1);
|
||||
getUnknownFields().writeTo(output);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public int getSerializedSize() {
|
||||
int size = memoizedSize;
|
||||
if (size != -1) return size;
|
||||
|
||||
size = 0;
|
||||
for (java.util.Map.Entry<java.lang.Integer, cmvr.msgs.Motor.MotorStatus> entry
|
||||
: internalGetMotors().getMap().entrySet()) {
|
||||
com.google.protobuf.MapEntry<java.lang.Integer, cmvr.msgs.Motor.MotorStatus>
|
||||
motors__ = MotorsDefaultEntryHolder.defaultEntry.newBuilderForType()
|
||||
.setKey(entry.getKey())
|
||||
.setValue(entry.getValue())
|
||||
.build();
|
||||
size += com.google.protobuf.CodedOutputStream
|
||||
.computeMessageSize(1, motors__);
|
||||
}
|
||||
size += getUnknownFields().getSerializedSize();
|
||||
memoizedSize = size;
|
||||
return size;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public boolean equals(final java.lang.Object obj) {
|
||||
if (obj == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(obj instanceof cmvr.msgs.RobotDetailOuterClass.RobotDetail)) {
|
||||
return super.equals(obj);
|
||||
}
|
||||
cmvr.msgs.RobotDetailOuterClass.RobotDetail other = (cmvr.msgs.RobotDetailOuterClass.RobotDetail) obj;
|
||||
|
||||
if (!internalGetMotors().equals(
|
||||
other.internalGetMotors())) return false;
|
||||
if (!getUnknownFields().equals(other.getUnknownFields())) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public int hashCode() {
|
||||
if (memoizedHashCode != 0) {
|
||||
return memoizedHashCode;
|
||||
}
|
||||
int hash = 41;
|
||||
hash = (19 * hash) + getDescriptor().hashCode();
|
||||
if (!internalGetMotors().getMap().isEmpty()) {
|
||||
hash = (37 * hash) + MOTORS_FIELD_NUMBER;
|
||||
hash = (53 * hash) + internalGetMotors().hashCode();
|
||||
}
|
||||
hash = (29 * hash) + getUnknownFields().hashCode();
|
||||
memoizedHashCode = hash;
|
||||
return hash;
|
||||
}
|
||||
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseFrom(
|
||||
java.nio.ByteBuffer data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseFrom(
|
||||
java.nio.ByteBuffer data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseFrom(
|
||||
com.google.protobuf.ByteString data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseFrom(
|
||||
com.google.protobuf.ByteString data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseFrom(byte[] data)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseFrom(
|
||||
byte[] data,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
return PARSER.parseFrom(data, extensionRegistry);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseDelimitedFrom(java.io.InputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseDelimitedWithIOException(PARSER, input);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseDelimitedFrom(
|
||||
java.io.InputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseDelimitedWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseFrom(
|
||||
com.google.protobuf.CodedInputStream input)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input);
|
||||
}
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail parseFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
return com.google.protobuf.GeneratedMessageV3
|
||||
.parseWithIOException(PARSER, input, extensionRegistry);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public Builder newBuilderForType() { return newBuilder(); }
|
||||
public static Builder newBuilder() {
|
||||
return DEFAULT_INSTANCE.toBuilder();
|
||||
}
|
||||
public static Builder newBuilder(cmvr.msgs.RobotDetailOuterClass.RobotDetail prototype) {
|
||||
return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder toBuilder() {
|
||||
return this == DEFAULT_INSTANCE
|
||||
? new Builder() : new Builder().mergeFrom(this);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
protected Builder newBuilderForType(
|
||||
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
|
||||
Builder builder = new Builder(parent);
|
||||
return builder;
|
||||
}
|
||||
/**
|
||||
* Protobuf type {@code cmvr.msgs.RobotDetail}
|
||||
*/
|
||||
public static final class Builder extends
|
||||
com.google.protobuf.GeneratedMessageV3.Builder<Builder> implements
|
||||
// @@protoc_insertion_point(builder_implements:cmvr.msgs.RobotDetail)
|
||||
cmvr.msgs.RobotDetailOuterClass.RobotDetailOrBuilder {
|
||||
public static final com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptor() {
|
||||
return cmvr.msgs.RobotDetailOuterClass.internal_static_cmvr_msgs_RobotDetail_descriptor;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
protected com.google.protobuf.MapField internalGetMapField(
|
||||
int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return internalGetMotors();
|
||||
default:
|
||||
throw new RuntimeException(
|
||||
"Invalid map field number: " + number);
|
||||
}
|
||||
}
|
||||
@SuppressWarnings({"rawtypes"})
|
||||
protected com.google.protobuf.MapField internalGetMutableMapField(
|
||||
int number) {
|
||||
switch (number) {
|
||||
case 1:
|
||||
return internalGetMutableMotors();
|
||||
default:
|
||||
throw new RuntimeException(
|
||||
"Invalid map field number: " + number);
|
||||
}
|
||||
}
|
||||
@java.lang.Override
|
||||
protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internalGetFieldAccessorTable() {
|
||||
return cmvr.msgs.RobotDetailOuterClass.internal_static_cmvr_msgs_RobotDetail_fieldAccessorTable
|
||||
.ensureFieldAccessorsInitialized(
|
||||
cmvr.msgs.RobotDetailOuterClass.RobotDetail.class, cmvr.msgs.RobotDetailOuterClass.RobotDetail.Builder.class);
|
||||
}
|
||||
|
||||
// Construct using cmvr.msgs.RobotDetailOuterClass.RobotDetail.newBuilder()
|
||||
private Builder() {
|
||||
|
||||
}
|
||||
|
||||
private Builder(
|
||||
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
|
||||
super(parent);
|
||||
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder clear() {
|
||||
super.clear();
|
||||
internalGetMutableMotors().clear();
|
||||
return this;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Descriptors.Descriptor
|
||||
getDescriptorForType() {
|
||||
return cmvr.msgs.RobotDetailOuterClass.internal_static_cmvr_msgs_RobotDetail_descriptor;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.msgs.RobotDetailOuterClass.RobotDetail getDefaultInstanceForType() {
|
||||
return cmvr.msgs.RobotDetailOuterClass.RobotDetail.getDefaultInstance();
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.msgs.RobotDetailOuterClass.RobotDetail build() {
|
||||
cmvr.msgs.RobotDetailOuterClass.RobotDetail result = buildPartial();
|
||||
if (!result.isInitialized()) {
|
||||
throw newUninitializedMessageException(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.msgs.RobotDetailOuterClass.RobotDetail buildPartial() {
|
||||
cmvr.msgs.RobotDetailOuterClass.RobotDetail result = new cmvr.msgs.RobotDetailOuterClass.RobotDetail(this);
|
||||
int from_bitField0_ = bitField0_;
|
||||
result.motors_ = internalGetMotors();
|
||||
result.motors_.makeImmutable();
|
||||
onBuilt();
|
||||
return result;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public Builder clone() {
|
||||
return super.clone();
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder setField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||
java.lang.Object value) {
|
||||
return super.setField(field, value);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder clearField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field) {
|
||||
return super.clearField(field);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder clearOneof(
|
||||
com.google.protobuf.Descriptors.OneofDescriptor oneof) {
|
||||
return super.clearOneof(oneof);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder setRepeatedField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||
int index, java.lang.Object value) {
|
||||
return super.setRepeatedField(field, index, value);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder addRepeatedField(
|
||||
com.google.protobuf.Descriptors.FieldDescriptor field,
|
||||
java.lang.Object value) {
|
||||
return super.addRepeatedField(field, value);
|
||||
}
|
||||
@java.lang.Override
|
||||
public Builder mergeFrom(com.google.protobuf.Message other) {
|
||||
if (other instanceof cmvr.msgs.RobotDetailOuterClass.RobotDetail) {
|
||||
return mergeFrom((cmvr.msgs.RobotDetailOuterClass.RobotDetail)other);
|
||||
} else {
|
||||
super.mergeFrom(other);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
public Builder mergeFrom(cmvr.msgs.RobotDetailOuterClass.RobotDetail other) {
|
||||
if (other == cmvr.msgs.RobotDetailOuterClass.RobotDetail.getDefaultInstance()) return this;
|
||||
internalGetMutableMotors().mergeFrom(
|
||||
other.internalGetMotors());
|
||||
this.mergeUnknownFields(other.getUnknownFields());
|
||||
onChanged();
|
||||
return this;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final boolean isInitialized() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public Builder mergeFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws java.io.IOException {
|
||||
if (extensionRegistry == null) {
|
||||
throw new java.lang.NullPointerException();
|
||||
}
|
||||
try {
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
int tag = input.readTag();
|
||||
switch (tag) {
|
||||
case 0:
|
||||
done = true;
|
||||
break;
|
||||
case 10: {
|
||||
com.google.protobuf.MapEntry<java.lang.Integer, cmvr.msgs.Motor.MotorStatus>
|
||||
motors__ = input.readMessage(
|
||||
MotorsDefaultEntryHolder.defaultEntry.getParserForType(), extensionRegistry);
|
||||
internalGetMutableMotors().getMutableMap().put(
|
||||
motors__.getKey(), motors__.getValue());
|
||||
break;
|
||||
} // case 10
|
||||
default: {
|
||||
if (!super.parseUnknownField(input, extensionRegistry, tag)) {
|
||||
done = true; // was an endgroup tag
|
||||
}
|
||||
break;
|
||||
} // default:
|
||||
} // switch (tag)
|
||||
} // while (!done)
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
throw e.unwrapIOException();
|
||||
} finally {
|
||||
onChanged();
|
||||
} // finally
|
||||
return this;
|
||||
}
|
||||
private int bitField0_;
|
||||
|
||||
private com.google.protobuf.MapField<
|
||||
java.lang.Integer, cmvr.msgs.Motor.MotorStatus> motors_;
|
||||
private com.google.protobuf.MapField<java.lang.Integer, cmvr.msgs.Motor.MotorStatus>
|
||||
internalGetMotors() {
|
||||
if (motors_ == null) {
|
||||
return com.google.protobuf.MapField.emptyMapField(
|
||||
MotorsDefaultEntryHolder.defaultEntry);
|
||||
}
|
||||
return motors_;
|
||||
}
|
||||
private com.google.protobuf.MapField<java.lang.Integer, cmvr.msgs.Motor.MotorStatus>
|
||||
internalGetMutableMotors() {
|
||||
onChanged();;
|
||||
if (motors_ == null) {
|
||||
motors_ = com.google.protobuf.MapField.newMapField(
|
||||
MotorsDefaultEntryHolder.defaultEntry);
|
||||
}
|
||||
if (!motors_.isMutable()) {
|
||||
motors_ = motors_.copy();
|
||||
}
|
||||
return motors_;
|
||||
}
|
||||
|
||||
public int getMotorsCount() {
|
||||
return internalGetMotors().getMap().size();
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
|
||||
@java.lang.Override
|
||||
public boolean containsMotors(
|
||||
int key) {
|
||||
|
||||
return internalGetMotors().getMap().containsKey(key);
|
||||
}
|
||||
/**
|
||||
* Use {@link #getMotorsMap()} instead.
|
||||
*/
|
||||
@java.lang.Override
|
||||
@java.lang.Deprecated
|
||||
public java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus> getMotors() {
|
||||
return getMotorsMap();
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
|
||||
public java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus> getMotorsMap() {
|
||||
return internalGetMotors().getMap();
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
|
||||
public cmvr.msgs.Motor.MotorStatus getMotorsOrDefault(
|
||||
int key,
|
||||
cmvr.msgs.Motor.MotorStatus defaultValue) {
|
||||
|
||||
java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus> map =
|
||||
internalGetMotors().getMap();
|
||||
return map.containsKey(key) ? map.get(key) : defaultValue;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
@java.lang.Override
|
||||
|
||||
public cmvr.msgs.Motor.MotorStatus getMotorsOrThrow(
|
||||
int key) {
|
||||
|
||||
java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus> map =
|
||||
internalGetMotors().getMap();
|
||||
if (!map.containsKey(key)) {
|
||||
throw new java.lang.IllegalArgumentException();
|
||||
}
|
||||
return map.get(key);
|
||||
}
|
||||
|
||||
public Builder clearMotors() {
|
||||
internalGetMutableMotors().getMutableMap()
|
||||
.clear();
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
|
||||
public Builder removeMotors(
|
||||
int key) {
|
||||
|
||||
internalGetMutableMotors().getMutableMap()
|
||||
.remove(key);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* Use alternate mutation accessors instead.
|
||||
*/
|
||||
@java.lang.Deprecated
|
||||
public java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus>
|
||||
getMutableMotors() {
|
||||
return internalGetMutableMotors().getMutableMap();
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
public Builder putMotors(
|
||||
int key,
|
||||
cmvr.msgs.Motor.MotorStatus value) {
|
||||
|
||||
if (value == null) {
|
||||
throw new NullPointerException("map value");
|
||||
}
|
||||
|
||||
internalGetMutableMotors().getMutableMap()
|
||||
.put(key, value);
|
||||
return this;
|
||||
}
|
||||
/**
|
||||
* <pre>
|
||||
* key 电机 nodeid
|
||||
* </pre>
|
||||
*
|
||||
* <code>map<uint32, .cmvr.msgs.MotorStatus> motors = 1;</code>
|
||||
*/
|
||||
|
||||
public Builder putAllMotors(
|
||||
java.util.Map<java.lang.Integer, cmvr.msgs.Motor.MotorStatus> values) {
|
||||
internalGetMutableMotors().getMutableMap()
|
||||
.putAll(values);
|
||||
return this;
|
||||
}
|
||||
@java.lang.Override
|
||||
public final Builder setUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return super.setUnknownFields(unknownFields);
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public final Builder mergeUnknownFields(
|
||||
final com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||
return super.mergeUnknownFields(unknownFields);
|
||||
}
|
||||
|
||||
|
||||
// @@protoc_insertion_point(builder_scope:cmvr.msgs.RobotDetail)
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(class_scope:cmvr.msgs.RobotDetail)
|
||||
private static final cmvr.msgs.RobotDetailOuterClass.RobotDetail DEFAULT_INSTANCE;
|
||||
static {
|
||||
DEFAULT_INSTANCE = new cmvr.msgs.RobotDetailOuterClass.RobotDetail();
|
||||
}
|
||||
|
||||
public static cmvr.msgs.RobotDetailOuterClass.RobotDetail getDefaultInstance() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Parser<RobotDetail>
|
||||
PARSER = new com.google.protobuf.AbstractParser<RobotDetail>() {
|
||||
@java.lang.Override
|
||||
public RobotDetail parsePartialFrom(
|
||||
com.google.protobuf.CodedInputStream input,
|
||||
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
|
||||
throws com.google.protobuf.InvalidProtocolBufferException {
|
||||
Builder builder = newBuilder();
|
||||
try {
|
||||
builder.mergeFrom(input, extensionRegistry);
|
||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||
throw e.setUnfinishedMessage(builder.buildPartial());
|
||||
} catch (com.google.protobuf.UninitializedMessageException e) {
|
||||
throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
|
||||
} catch (java.io.IOException e) {
|
||||
throw new com.google.protobuf.InvalidProtocolBufferException(e)
|
||||
.setUnfinishedMessage(builder.buildPartial());
|
||||
}
|
||||
return builder.buildPartial();
|
||||
}
|
||||
};
|
||||
|
||||
public static com.google.protobuf.Parser<RobotDetail> parser() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public com.google.protobuf.Parser<RobotDetail> getParserForType() {
|
||||
return PARSER;
|
||||
}
|
||||
|
||||
@java.lang.Override
|
||||
public cmvr.msgs.RobotDetailOuterClass.RobotDetail getDefaultInstanceForType() {
|
||||
return DEFAULT_INSTANCE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_cmvr_msgs_RobotDetail_descriptor;
|
||||
private static final
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internal_static_cmvr_msgs_RobotDetail_fieldAccessorTable;
|
||||
private static final com.google.protobuf.Descriptors.Descriptor
|
||||
internal_static_cmvr_msgs_RobotDetail_MotorsEntry_descriptor;
|
||||
private static final
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable
|
||||
internal_static_cmvr_msgs_RobotDetail_MotorsEntry_fieldAccessorTable;
|
||||
|
||||
public static com.google.protobuf.Descriptors.FileDescriptor
|
||||
getDescriptor() {
|
||||
return descriptor;
|
||||
}
|
||||
private static com.google.protobuf.Descriptors.FileDescriptor
|
||||
descriptor;
|
||||
static {
|
||||
java.lang.String[] descriptorData = {
|
||||
"\n\034cmvr/msgs/robot_detail.proto\022\tcmvr.msg" +
|
||||
"s\032\025cmvr/msgs/motor.proto\"\210\001\n\013RobotDetail" +
|
||||
"\0222\n\006motors\030\001 \003(\0132\".cmvr.msgs.RobotDetail" +
|
||||
".MotorsEntry\032E\n\013MotorsEntry\022\013\n\003key\030\001 \001(\r" +
|
||||
"\022%\n\005value\030\002 \001(\0132\026.cmvr.msgs.MotorStatus:" +
|
||||
"\0028\001b\006proto3"
|
||||
};
|
||||
descriptor = com.google.protobuf.Descriptors.FileDescriptor
|
||||
.internalBuildGeneratedFileFrom(descriptorData,
|
||||
new com.google.protobuf.Descriptors.FileDescriptor[] {
|
||||
cmvr.msgs.Motor.getDescriptor(),
|
||||
});
|
||||
internal_static_cmvr_msgs_RobotDetail_descriptor =
|
||||
getDescriptor().getMessageTypes().get(0);
|
||||
internal_static_cmvr_msgs_RobotDetail_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
|
||||
internal_static_cmvr_msgs_RobotDetail_descriptor,
|
||||
new java.lang.String[] { "Motors", });
|
||||
internal_static_cmvr_msgs_RobotDetail_MotorsEntry_descriptor =
|
||||
internal_static_cmvr_msgs_RobotDetail_descriptor.getNestedTypes().get(0);
|
||||
internal_static_cmvr_msgs_RobotDetail_MotorsEntry_fieldAccessorTable = new
|
||||
com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
|
||||
internal_static_cmvr_msgs_RobotDetail_MotorsEntry_descriptor,
|
||||
new java.lang.String[] { "Key", "Value", });
|
||||
cmvr.msgs.Motor.getDescriptor();
|
||||
}
|
||||
|
||||
// @@protoc_insertion_point(outer_class_scope)
|
||||
}
|
||||
@ -3,7 +3,7 @@ syntax = "proto3";
|
||||
package cmvr.api;
|
||||
|
||||
import "cmvr/api/common.proto";
|
||||
import "cmvr/msgs/agv.proto";
|
||||
import "cmvr/api/agv_utils.proto";
|
||||
|
||||
// 查询 AGV 运行状态命令。
|
||||
message AgvRuntimeStateCommand {
|
||||
@ -45,7 +45,7 @@ message AgvNavigateToPoseCommand {
|
||||
CommandHeader.Request header = 1;
|
||||
// 目标位姿。x/y 单位:米,theta 单位:弧度。
|
||||
cmvr.msgs.AgvPose2d pose = 2;
|
||||
// 通用运动约束和执行选项。
|
||||
// 通用运动约束和执行选项;默认同步阻塞至任务终态并确认停车。
|
||||
cmvr.msgs.AgvMotionOptions options = 3;
|
||||
// AGV 适配器扩展参数,用于传递厂商特有选项。
|
||||
cmvr.msgs.AgvAdapterParams adapter_params = 4;
|
||||
@ -65,7 +65,7 @@ message AgvNavigateToStationCommand {
|
||||
CommandHeader.Request header = 1;
|
||||
// 目标站点 id。
|
||||
string station_id = 2;
|
||||
// 通用运动约束和执行选项。
|
||||
// 通用运动约束和执行选项;默认同步阻塞至任务终态并确认停车。
|
||||
cmvr.msgs.AgvMotionOptions options = 3;
|
||||
// AGV 适配器扩展参数,用于传递厂商特有选项。
|
||||
cmvr.msgs.AgvAdapterParams adapter_params = 4;
|
||||
@ -85,6 +85,8 @@ message AgvFollowPathCommand {
|
||||
CommandHeader.Request header = 1;
|
||||
// 路径段列表。每段包含起点站点 id 和终点站点 id。
|
||||
repeated cmvr.msgs.AgvPathSegment path = 2;
|
||||
// 通用执行选项;默认同步阻塞至整条路径终态并确认停车。
|
||||
cmvr.msgs.AgvMotionOptions options = 3;
|
||||
}
|
||||
// 反馈体。
|
||||
message Feedback {
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
// 文件随 AGV API 定义统一放在 cmvr/api 下,但保留 cmvr.msgs package,
|
||||
// 以兼容既有生成代码、消息完整名称和 Any type URL。
|
||||
package cmvr.msgs;
|
||||
|
||||
// AGV 在地图平面坐标系中的二维位姿。
|
||||
@ -52,8 +54,14 @@ message AgvMotionOptions {
|
||||
double reach_angle = 6;
|
||||
// 速度比例,范围通常为 [0, 1];1 表示不降速。
|
||||
double speed_ratio = 7;
|
||||
// 是否异步执行;true 表示下发任务后立即返回。
|
||||
// 是否异步执行;false(默认)表示到达、失败、取消或遇障停止后才返回,
|
||||
// true 表示任务被控制器接受后立即返回。
|
||||
bool asynchronous = 8;
|
||||
// 同步导航的最大等待时间,单位:毫秒;0 表示使用适配器默认值。
|
||||
// gRPC deadline 应大于该值或预计行程时间,否则服务端会安全取消导航。
|
||||
int32 wait_timeout_ms = 9;
|
||||
// 同步导航的状态轮询周期,单位:毫秒;0 表示使用适配器默认值。
|
||||
int32 poll_interval_ms = 10;
|
||||
}
|
||||
|
||||
// AGV 适配器扩展参数。用于传递厂商或控制器特有的参数。
|
||||
@ -0,0 +1,133 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cmvr.api.armteleop.v1;
|
||||
|
||||
// Versioned, session-oriented protocol for wired arm teleoperation. Existing
|
||||
// unary ArmService RPCs intentionally remain unchanged.
|
||||
service ArmTeleopService {
|
||||
rpc Teleoperate(stream ClientFrame) returns (stream ServerFrame);
|
||||
}
|
||||
|
||||
enum SessionPhase {
|
||||
SESSION_PHASE_UNSPECIFIED = 0;
|
||||
SESSION_PHASE_OPENED = 1;
|
||||
SESSION_PHASE_READY = 2;
|
||||
SESSION_PHASE_ACTIVE = 3;
|
||||
SESSION_PHASE_HOLDING = 4;
|
||||
SESSION_PHASE_STOPPED = 5;
|
||||
SESSION_PHASE_WATCHDOG_EXPIRED = 6;
|
||||
SESSION_PHASE_LEASE_LOST = 7;
|
||||
SESSION_PHASE_REJECTED = 8;
|
||||
SESSION_PHASE_FAILED = 9;
|
||||
}
|
||||
|
||||
enum StopReason {
|
||||
STOP_REASON_UNSPECIFIED = 0;
|
||||
STOP_REASON_OPERATOR_REQUEST = 1;
|
||||
STOP_REASON_CLIENT_SHUTDOWN = 2;
|
||||
STOP_REASON_WATCHDOG = 3;
|
||||
STOP_REASON_LEASE_REVOKED = 4;
|
||||
STOP_REASON_ROBOT_FAULT = 5;
|
||||
STOP_REASON_EMERGENCY_STOP = 6;
|
||||
STOP_REASON_PROTOCOL_ERROR = 7;
|
||||
}
|
||||
|
||||
enum EffortSource {
|
||||
EFFORT_SOURCE_UNSPECIFIED = 0;
|
||||
EFFORT_SOURCE_MOTOR_ESTIMATE = 1;
|
||||
EFFORT_SOURCE_JOINT_SENSOR = 2;
|
||||
EFFORT_SOURCE_FORCE_TORQUE_SENSOR = 3;
|
||||
EFFORT_SOURCE_OBSERVER = 4;
|
||||
}
|
||||
|
||||
message RobotManifest {
|
||||
string robot_id = 1;
|
||||
string model_sha256 = 2;
|
||||
string calibration_sha256 = 3;
|
||||
repeated string joint_names = 4;
|
||||
string position_unit = 5;
|
||||
string velocity_unit = 6;
|
||||
string effort_unit = 7;
|
||||
string base_frame = 8;
|
||||
string tool_frame = 9;
|
||||
}
|
||||
|
||||
message OpenSession {
|
||||
uint32 protocol_major = 1;
|
||||
uint32 protocol_minor = 2;
|
||||
string client_instance_id = 3;
|
||||
RobotManifest expected_robot = 4;
|
||||
uint32 requested_command_rate_hz = 5;
|
||||
uint32 requested_state_rate_hz = 6;
|
||||
uint32 watchdog_timeout_ms = 7;
|
||||
uint32 requested_lease_ms = 8;
|
||||
bool request_force_feedback = 9;
|
||||
}
|
||||
|
||||
message JointSetpoint {
|
||||
// Strictly increasing and non-zero within a session.
|
||||
uint64 sequence = 1;
|
||||
repeated double position_rad = 2;
|
||||
repeated double velocity_rad_s = 3;
|
||||
// The receiver computes its deadline from local arrival time plus this
|
||||
// duration. Zero is invalid for an active setpoint.
|
||||
uint32 valid_for_us = 4;
|
||||
}
|
||||
|
||||
message ClientHeartbeat {
|
||||
uint64 sequence = 1;
|
||||
}
|
||||
|
||||
message StopSession {
|
||||
StopReason reason = 1;
|
||||
string detail = 2;
|
||||
}
|
||||
|
||||
message ClientFrame {
|
||||
oneof payload {
|
||||
OpenSession open = 1;
|
||||
JointSetpoint setpoint = 2;
|
||||
ClientHeartbeat heartbeat = 3;
|
||||
StopSession stop = 4;
|
||||
}
|
||||
}
|
||||
|
||||
message JointState {
|
||||
uint64 sample_sequence = 1;
|
||||
repeated double position_rad = 2;
|
||||
repeated double velocity_rad_s = 3;
|
||||
repeated double effort_nm = 4;
|
||||
bool position_valid = 5;
|
||||
bool velocity_valid = 6;
|
||||
bool effort_valid = 7;
|
||||
EffortSource effort_source = 8;
|
||||
uint64 sample_age_us = 9;
|
||||
}
|
||||
|
||||
message SessionStatus {
|
||||
string session_id = 1;
|
||||
SessionPhase phase = 2;
|
||||
uint64 received_sequence = 3;
|
||||
uint64 applied_sequence = 4;
|
||||
uint64 dropped_setpoints = 5;
|
||||
uint64 rejected_setpoints = 6;
|
||||
uint32 negotiated_watchdog_ms = 7;
|
||||
uint32 lease_remaining_ms = 8;
|
||||
StopReason stop_reason = 9;
|
||||
string detail = 10;
|
||||
}
|
||||
|
||||
message RobotSafetyState {
|
||||
bool connected = 1;
|
||||
bool powered_on = 2;
|
||||
bool protective_stopped = 3;
|
||||
bool emergency_stopped = 4;
|
||||
bool fault = 5;
|
||||
string fault_detail = 6;
|
||||
}
|
||||
|
||||
message ServerFrame {
|
||||
SessionStatus status = 1;
|
||||
JointState joint_state = 2;
|
||||
RobotSafetyState safety = 3;
|
||||
}
|
||||
@ -128,16 +128,16 @@ message SetFacialExpression {
|
||||
* 用于连续发送多个面部表情,实现表情动画效果
|
||||
*/
|
||||
message StreamFacialExpression {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1; // 通用命令头
|
||||
FacialExpression expr = 2; // 执行
|
||||
bool eof = 3; // 标记是否为流结束
|
||||
}
|
||||
message Request {
|
||||
CommandHeader.Request header = 1; // 通用命令头
|
||||
FacialExpression expr = 2; // 执行
|
||||
bool eof = 3; // 标记是否为流结束
|
||||
}
|
||||
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1; // 通用反馈头
|
||||
FacialExpression expr_diff = 2; // 执行误差
|
||||
}
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1; // 通用反馈头
|
||||
FacialExpression expr_diff = 2; // 执行误差
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -267,3 +267,4 @@ message ExpressionYawn {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -5,36 +5,43 @@ import "cmvr/api/biohead_command.proto";
|
||||
|
||||
// 生物头部机器人服务接口
|
||||
service BioHeadService {
|
||||
// 设置面部表情
|
||||
rpc SetExpression(SetFacialExpression.Request) returns (SetFacialExpression.Feedback){};
|
||||
// 设置面部表情
|
||||
rpc SetExpression(SetFacialExpression.Request) returns (SetFacialExpression.Feedback){};
|
||||
|
||||
// 流式表情控制
|
||||
//rpc StreamExpression(StreamFacialExpression.Request) returns (StreamFacialExpression.Feedback){};
|
||||
// 流式表情控制
|
||||
//rpc StreamExpression(StreamFacialExpression.Request) returns (StreamFacialExpression.Feedback){};
|
||||
|
||||
rpc StreamExpression (stream StreamFacialExpression.Request) returns (stream StreamFacialExpression.Feedback);
|
||||
rpc StreamExpression (stream StreamFacialExpression.Request) returns (stream StreamFacialExpression.Feedback);
|
||||
|
||||
|
||||
// 获取状态
|
||||
rpc GetSystemStatus(GetStatus.Request) returns (GetStatus.Feedback){};
|
||||
// 获取状态
|
||||
rpc GetSystemStatus(GetStatus.Request) returns (GetStatus.Feedback){};
|
||||
|
||||
// 紧急停止
|
||||
rpc EmergencyStop(EmergencyStop.Request) returns (EmergencyStop.Feedback){};
|
||||
// 紧急停止
|
||||
rpc EmergencyStop(EmergencyStop.Request) returns (EmergencyStop.Feedback){};
|
||||
|
||||
// 开始说话
|
||||
rpc SpeakStart(SpeakStart.Request) returns (SpeakStart.Feedback){};
|
||||
// 停止说话
|
||||
rpc SpeakStop(SpeakStop.Request) returns (SpeakStop.Feedback){};
|
||||
|
||||
rpc Happy(Happy.Request) returns (Happy.Feedback){};
|
||||
|
||||
rpc Surprise(Surprise.Request) returns (Surprise.Feedback){};
|
||||
|
||||
rpc ExpressionTired(ExpressionTired.Request) returns (ExpressionTired.Feedback){};
|
||||
|
||||
rpc ExpressionAngry(ExpressionAngry.Request) returns (ExpressionAngry.Feedback){};
|
||||
|
||||
rpc ExpressionSadness(ExpressionSadness.Request) returns (ExpressionSadness.Feedback){};
|
||||
|
||||
rpc ExpressionYawn(ExpressionYawn.Request) returns (ExpressionYawn.Feedback){};
|
||||
|
||||
// 开始说话
|
||||
rpc SpeakStart(SpeakStart.Request) returns (SpeakStart.Feedback){};
|
||||
// 停止说话
|
||||
rpc SpeakStop(SpeakStop.Request) returns (SpeakStop.Feedback){};
|
||||
|
||||
rpc Happy(Happy.Request) returns (Happy.Feedback){};
|
||||
|
||||
rpc Surprise(Surprise.Request) returns (Surprise.Feedback){};
|
||||
|
||||
rpc ExpressionTired(ExpressionTired.Request) returns (ExpressionTired.Feedback){};
|
||||
|
||||
rpc ExpressionAngry(ExpressionAngry.Request) returns (ExpressionAngry.Feedback){};
|
||||
|
||||
rpc ExpressionSadness(ExpressionSadness.Request) returns (ExpressionSadness.Feedback){};
|
||||
|
||||
rpc ExpressionYawn(ExpressionYawn.Request) returns (ExpressionYawn.Feedback){};
|
||||
|
||||
}
|
||||
@ -19,9 +19,18 @@ message FrameData {
|
||||
FrameType type = 4;
|
||||
string codec = 5;
|
||||
bool is_key_frame = 6;
|
||||
// Optional capture and source metadata. Fields 1-6 remain wire-compatible
|
||||
// with existing clients; older clients safely ignore these additions.
|
||||
int64 capture_utc_ns = 7;
|
||||
uint64 source_sequence = 8;
|
||||
int64 pts = 9;
|
||||
int64 dts = 10;
|
||||
uint32 source_fps = 11;
|
||||
uint64 source_timestamp = 12;
|
||||
uint64 source_frame_number = 13;
|
||||
}
|
||||
|
||||
message Rs2Intrinsics {
|
||||
message CameraIntrinsics {
|
||||
float cx = 1; // 主点水平坐标(从左边缘的像素偏移)
|
||||
float cy = 2; // 主点垂直坐标(从上边缘的像素偏移)
|
||||
float fx = 3; // x方向焦距(像素宽度的倍数)
|
||||
@ -79,7 +88,7 @@ message GetRGBImageCommand {
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
FrameData color_frame = 2;
|
||||
Rs2Intrinsics intrinsics = 3;
|
||||
CameraIntrinsics intrinsics = 3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +100,7 @@ message GetDepthImageCommand {
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
FrameData depth_frame = 2;
|
||||
Rs2Intrinsics intrinsics = 3;
|
||||
CameraIntrinsics intrinsics = 3;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +113,7 @@ message GetRGBDImagesCommand {
|
||||
CommandHeader.Feedback header = 1;
|
||||
FrameData color_frame = 2;
|
||||
FrameData depth_frame = 3;
|
||||
Rs2Intrinsics intrinsics = 4;
|
||||
CameraIntrinsics intrinsics = 4;
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,6 +137,39 @@ message StopCameraRecordingCommand {
|
||||
}
|
||||
}
|
||||
|
||||
message ControlPtzCommand {
|
||||
enum Command {
|
||||
COMMAND_UNSPECIFIED = 0;
|
||||
TILT_UP = 1;
|
||||
TILT_DOWN = 2;
|
||||
PAN_LEFT = 3;
|
||||
PAN_RIGHT = 4;
|
||||
UP_LEFT = 5;
|
||||
UP_RIGHT = 6;
|
||||
DOWN_LEFT = 7;
|
||||
DOWN_RIGHT = 8;
|
||||
ZOOM_IN = 9;
|
||||
ZOOM_OUT = 10;
|
||||
PAN_AUTO = 11;
|
||||
}
|
||||
|
||||
enum Action {
|
||||
START = 0;
|
||||
STOP = 1;
|
||||
}
|
||||
|
||||
message Request {
|
||||
CommandHeader.Request header = 1;
|
||||
Command command = 2;
|
||||
Action action = 3;
|
||||
uint32 speed = 4;
|
||||
}
|
||||
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
}
|
||||
}
|
||||
|
||||
message GetRGBImageStreamCommand {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1;
|
||||
@ -137,7 +179,7 @@ message GetRGBImageStreamCommand {
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
FrameData color_frame = 2;
|
||||
Rs2Intrinsics intrinsics = 3;
|
||||
CameraIntrinsics intrinsics = 3;
|
||||
int32 seq_no = 4;
|
||||
}
|
||||
}
|
||||
@ -151,7 +193,7 @@ message GetDepthImageStreamCommand {
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
FrameData depth_frame = 2;
|
||||
Rs2Intrinsics intrinsics = 3;
|
||||
CameraIntrinsics intrinsics = 3;
|
||||
int32 seq_no = 4;
|
||||
}
|
||||
}
|
||||
@ -166,10 +208,9 @@ message GetRGBDImagesStreamCommand {
|
||||
CommandHeader.Feedback header = 1;
|
||||
FrameData color_frame = 2;
|
||||
FrameData depth_frame = 3;
|
||||
Rs2Intrinsics intrinsics = 4;
|
||||
CameraIntrinsics intrinsics = 4;
|
||||
int32 seq_no = 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ service CameraService {
|
||||
rpc GetRGBDImages(GetRGBDImagesCommand.Request) returns (GetRGBDImagesCommand.Feedback) {}
|
||||
rpc StartRecording(StartCameraRecordingCommand.Request) returns (StartCameraRecordingCommand.Feedback) {}
|
||||
rpc StopRecording(StopCameraRecordingCommand.Request) returns (StopCameraRecordingCommand.Feedback) {}
|
||||
rpc ControlPtz(ControlPtzCommand.Request) returns (ControlPtzCommand.Feedback) {}
|
||||
|
||||
rpc GetRGBImageStream(stream GetRGBImageStreamCommand.Request) returns (stream GetRGBImageStreamCommand.Feedback) {}
|
||||
rpc GetDepthImageStream(stream GetDepthImageStreamCommand.Request) returns (stream GetDepthImageStreamCommand.Feedback) {}
|
||||
|
||||
@ -35,6 +35,7 @@ message AudioData {
|
||||
MP3 = 1;
|
||||
AAC = 2;
|
||||
WAV = 3;
|
||||
OPUS = 4;
|
||||
}
|
||||
bytes data = 1;
|
||||
int32 sample_rate = 2;
|
||||
@ -57,3 +58,15 @@ message ConfigParam {
|
||||
bytes bytes_value = 6; // 二进制数据类型
|
||||
}
|
||||
}
|
||||
|
||||
message JsonDeviceCommand {
|
||||
message Request {
|
||||
CommandHeader.Request header = 1;
|
||||
string request_json = 2;
|
||||
}
|
||||
|
||||
message Feedback {
|
||||
CommandHeader.Feedback header = 1;
|
||||
string response_json = 2;
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@ message FreedomValue {
|
||||
float value = 2; // 值 0-1百分比
|
||||
}
|
||||
|
||||
message RH56DFTPDexHand {
|
||||
message FreedomState {
|
||||
int32 dof_id = 1; // 自由度ID,唯一标识不同的关节或自由度
|
||||
int32 angle = 2; // 自由度角度
|
||||
int32 speed = 3; // 自由度速度
|
||||
@ -57,7 +57,7 @@ message SensorData {
|
||||
|
||||
message DexHandState {
|
||||
bool is_initialized = 1; // 是否初始化
|
||||
repeated RH56DFTPDexHand hands = 2; // 包含多个自由度状态
|
||||
repeated FreedomState hands = 2; // 包含多个自由度状态
|
||||
}
|
||||
|
||||
message GetDexHandStateCommand {
|
||||
|
||||
@ -1,67 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cmvr.api;
|
||||
|
||||
|
||||
message Vec2 {
|
||||
double x = 1;
|
||||
double y = 2;
|
||||
}
|
||||
|
||||
message Vec3 {
|
||||
double x = 1;
|
||||
double y = 2;
|
||||
double z = 3;
|
||||
}
|
||||
|
||||
message SE2Pose {
|
||||
Vec2 position = 1; // (m)
|
||||
double angle = 2; // (rad)
|
||||
}
|
||||
|
||||
message SE2Velocity {
|
||||
Vec2 linear = 1; // (m/s)
|
||||
double angular = 2; // (rad/s)
|
||||
}
|
||||
|
||||
message Quaternion {
|
||||
double x = 1;
|
||||
double y = 2;
|
||||
double z = 3;
|
||||
double w = 4;
|
||||
}
|
||||
|
||||
message EulerAngleZYX {
|
||||
double z = 1;
|
||||
double y = 2;
|
||||
double x = 3;
|
||||
}
|
||||
|
||||
message SE3Pose {
|
||||
Vec3 position = 1; // (m)
|
||||
oneof rotation {
|
||||
Quaternion quaternion = 2;
|
||||
EulerAngleZYX euler = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message Inertial {
|
||||
// Mass (kg)
|
||||
double mass = 1;
|
||||
|
||||
// Center of mass (m)
|
||||
Vec3 center_of_mass = 2;
|
||||
|
||||
// Inertia tensor
|
||||
Inertia inertia = 3;
|
||||
}
|
||||
|
||||
// Inertia tensor components (kg*m^2)
|
||||
message Inertia {
|
||||
double ixx = 1;
|
||||
double iyy = 2;
|
||||
double izz = 3;
|
||||
double ixy = 4;
|
||||
double ixz = 5;
|
||||
double iyz = 6;
|
||||
}
|
||||
@ -0,0 +1,151 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cmvr.api;
|
||||
|
||||
import "cmvr/api/common.proto";
|
||||
import "cmvr/msgs/motor.proto";
|
||||
|
||||
// Selects exactly one motor inside the MotorManager named by header.device_id.
|
||||
message MotorTarget {
|
||||
CommandHeader.Request header = 1;
|
||||
oneof selector {
|
||||
uint32 motor_id = 2;
|
||||
string joint_name = 3;
|
||||
}
|
||||
}
|
||||
|
||||
message MotorWaitOptions {
|
||||
// Zero selects the server default (30 seconds).
|
||||
uint32 timeout_ms = 1;
|
||||
// Zero selects the server default (10 milliseconds).
|
||||
uint32 poll_period_ms = 2;
|
||||
// Zero selects the server default.
|
||||
double position_tolerance_rad = 3;
|
||||
double velocity_tolerance_rad_s = 4;
|
||||
// Number of consecutive in-tolerance samples. Zero selects the default (3).
|
||||
uint32 settle_sample_count = 5;
|
||||
}
|
||||
|
||||
enum MotorControlType {
|
||||
MOTOR_CONTROL_NONE = 0;
|
||||
MOTOR_CONTROL_SET_ZERO = 1;
|
||||
MOTOR_CONTROL_PROFILE_POSITION = 2;
|
||||
MOTOR_CONTROL_PROFILE_VELOCITY = 3;
|
||||
MOTOR_CONTROL_CYCLIC_POSITION = 4;
|
||||
MOTOR_CONTROL_CYCLIC_VELOCITY = 5;
|
||||
MOTOR_CONTROL_SET_ENABLED = 6;
|
||||
}
|
||||
|
||||
message MotorStatus {
|
||||
uint32 motor_id = 1;
|
||||
string joint_name = 2;
|
||||
cmvr.msgs.RunMode run_mode = 3;
|
||||
double position_rad = 4;
|
||||
double velocity_rad_s = 5;
|
||||
bool target_reached = 6;
|
||||
bool service_busy = 7;
|
||||
MotorControlType active_control = 8;
|
||||
bool emergency_stopped = 9;
|
||||
string last_error = 10;
|
||||
}
|
||||
|
||||
message MotorCommandResponse {
|
||||
CommandHeader.Feedback header = 1;
|
||||
MotorStatus status = 2;
|
||||
uint64 elapsed_ms = 3;
|
||||
}
|
||||
|
||||
message SetMotorZeroRequest {
|
||||
MotorTarget target = 1;
|
||||
}
|
||||
|
||||
message MoveMotorToZeroRequest {
|
||||
MotorTarget target = 1;
|
||||
double max_velocity_rad_s = 2;
|
||||
double acceleration_rad_s2 = 3;
|
||||
MotorWaitOptions wait = 4;
|
||||
}
|
||||
|
||||
message ProfilePositionRequest {
|
||||
MotorTarget target = 1;
|
||||
double target_position_rad = 2;
|
||||
double max_velocity_rad_s = 3;
|
||||
double acceleration_rad_s2 = 4;
|
||||
MotorWaitOptions wait = 5;
|
||||
}
|
||||
|
||||
message ProfileVelocityRequest {
|
||||
MotorTarget target = 1;
|
||||
double target_velocity_rad_s = 2;
|
||||
double acceleration_rad_s2 = 3;
|
||||
MotorWaitOptions wait = 4;
|
||||
}
|
||||
|
||||
message EmergencyStopRequest {
|
||||
MotorTarget target = 1;
|
||||
}
|
||||
|
||||
message GetMotorStatusRequest {
|
||||
MotorTarget target = 1;
|
||||
}
|
||||
|
||||
message GetMotorStatusResponse {
|
||||
CommandHeader.Feedback header = 1;
|
||||
MotorStatus status = 2;
|
||||
}
|
||||
|
||||
message SetMotorEnabledRequest {
|
||||
MotorTarget target = 1;
|
||||
bool enabled = 2;
|
||||
}
|
||||
|
||||
message CyclicStreamOpen {
|
||||
MotorTarget target = 1;
|
||||
// The PLC/driver watchdog is authoritative. This service watchdog prevents a
|
||||
// stalled gRPC client from retaining control indefinitely.
|
||||
uint32 watchdog_timeout_ms = 2;
|
||||
}
|
||||
|
||||
message CyclicPositionSetpoint {
|
||||
uint64 sequence = 1;
|
||||
double target_position_rad = 2;
|
||||
optional double target_velocity_rad_s = 3;
|
||||
}
|
||||
|
||||
message CyclicVelocitySetpoint {
|
||||
uint64 sequence = 1;
|
||||
double target_velocity_rad_s = 2;
|
||||
}
|
||||
|
||||
message CyclicPositionRequest {
|
||||
oneof payload {
|
||||
CyclicStreamOpen open = 1;
|
||||
CyclicPositionSetpoint setpoint = 2;
|
||||
}
|
||||
}
|
||||
|
||||
message CyclicVelocityRequest {
|
||||
oneof payload {
|
||||
CyclicStreamOpen open = 1;
|
||||
CyclicVelocitySetpoint setpoint = 2;
|
||||
}
|
||||
}
|
||||
|
||||
enum CyclicStreamPhase {
|
||||
CYCLIC_STREAM_PHASE_UNSPECIFIED = 0;
|
||||
CYCLIC_STREAM_OPENED = 1;
|
||||
CYCLIC_STREAM_APPLIED = 2;
|
||||
CYCLIC_STREAM_STOPPED = 3;
|
||||
CYCLIC_STREAM_WATCHDOG_EXPIRED = 4;
|
||||
CYCLIC_STREAM_FAILED = 5;
|
||||
}
|
||||
|
||||
message CyclicControlResponse {
|
||||
CommandHeader.Feedback header = 1;
|
||||
CyclicStreamPhase phase = 2;
|
||||
uint64 sequence = 3;
|
||||
uint64 dropped_setpoints = 4;
|
||||
// Present for OPENED and terminal responses. APPLIED deliberately omits
|
||||
// live status so one cyclic sample does not trigger extra fieldbus reads.
|
||||
MotorStatus status = 5;
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cmvr.api;
|
||||
|
||||
import "cmvr/api/motor_command.proto";
|
||||
|
||||
service MotorService {
|
||||
rpc setZero(SetMotorZeroRequest) returns (MotorCommandResponse);
|
||||
rpc moveToZero(MoveMotorToZeroRequest) returns (MotorCommandResponse);
|
||||
rpc profilePosition(ProfilePositionRequest) returns (MotorCommandResponse);
|
||||
rpc profileVelocity(ProfileVelocityRequest) returns (MotorCommandResponse);
|
||||
|
||||
rpc streamCyclicPosition(stream CyclicPositionRequest)
|
||||
returns (stream CyclicControlResponse);
|
||||
rpc streamCyclicVelocity(stream CyclicVelocityRequest)
|
||||
returns (stream CyclicControlResponse);
|
||||
|
||||
rpc emergencyStop(EmergencyStopRequest) returns (MotorCommandResponse);
|
||||
rpc getStatus(GetMotorStatusRequest) returns (GetMotorStatusResponse);
|
||||
rpc setEnabled(SetMotorEnabledRequest) returns (MotorCommandResponse);
|
||||
}
|
||||
@ -1,5 +1,6 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "cmvr/api/common.proto";
|
||||
import "cmvr/api/system_command.proto";
|
||||
|
||||
package cmvr.api;
|
||||
@ -10,6 +11,7 @@ service SystemService {
|
||||
rpc GetSystemStatus(GetSystemStatusCommand.Request) returns (GetSystemStatusCommand.Feedback) {}
|
||||
|
||||
rpc UpdateParams(UpdateParamsCommand.Request) returns (UpdateParamsCommand.Feedback) {}
|
||||
rpc ExecuteJsonCommand(JsonDeviceCommand.Request) returns (JsonDeviceCommand.Feedback) {}
|
||||
|
||||
rpc StopAll(StopAllCommand.Request) returns (StopAllCommand.Feedback) {}
|
||||
}
|
||||
|
||||
@ -0,0 +1,79 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cmvr.common;
|
||||
|
||||
message Vec2 {
|
||||
optional double x = 1;
|
||||
optional double y = 2;
|
||||
}
|
||||
|
||||
message Vec3 {
|
||||
optional double x = 1;
|
||||
optional double y = 2;
|
||||
optional double z = 3;
|
||||
}
|
||||
|
||||
message Vec6 {
|
||||
optional double x = 1;
|
||||
optional double y = 2;
|
||||
optional double z = 3;
|
||||
optional double rx = 4;
|
||||
optional double ry = 5;
|
||||
optional double rz = 6;
|
||||
}
|
||||
|
||||
message Quat {
|
||||
optional double w = 1;
|
||||
optional double x = 2;
|
||||
optional double y = 3;
|
||||
optional double z = 4;
|
||||
}
|
||||
|
||||
message Euler {
|
||||
optional double rx = 1;
|
||||
optional double ry = 2;
|
||||
optional double rz = 3;
|
||||
}
|
||||
|
||||
message Pose3d {
|
||||
Vec3 position = 1;
|
||||
Quat quaternion = 2;
|
||||
Euler euler = 3;
|
||||
}
|
||||
|
||||
message Pose2d {
|
||||
optional double x = 1;
|
||||
optional double y = 2;
|
||||
optional double theta = 3;
|
||||
}
|
||||
|
||||
message Mat3 {
|
||||
optional double m00 = 1;
|
||||
optional double m01 = 2;
|
||||
optional double m02 = 3;
|
||||
optional double m10 = 4;
|
||||
optional double m11 = 5;
|
||||
optional double m12 = 6;
|
||||
optional double m20 = 7;
|
||||
optional double m21 = 8;
|
||||
optional double m22 = 9;
|
||||
}
|
||||
|
||||
message Mat4 {
|
||||
optional double m00 = 1;
|
||||
optional double m01 = 2;
|
||||
optional double m02 = 3;
|
||||
optional double m03 = 4;
|
||||
optional double m10 = 5;
|
||||
optional double m11 = 6;
|
||||
optional double m12 = 7;
|
||||
optional double m13 = 8;
|
||||
optional double m20 = 9;
|
||||
optional double m21 = 10;
|
||||
optional double m22 = 11;
|
||||
optional double m23 = 12;
|
||||
optional double m30 = 13;
|
||||
optional double m31 = 14;
|
||||
optional double m32 = 15;
|
||||
optional double m33 = 16;
|
||||
}
|
||||
@ -0,0 +1,55 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cmvr.msgs;
|
||||
|
||||
message CANCardParameter {
|
||||
enum CANCardBrand {
|
||||
FAKE_CAN = 0;
|
||||
ESD_CAN = 1;
|
||||
SOCKET_CAN_RAW = 2;
|
||||
HERMES_CAN = 3;
|
||||
}
|
||||
|
||||
enum CANCardType {
|
||||
PCI_CARD = 0;
|
||||
USB_CARD = 1;
|
||||
}
|
||||
|
||||
enum CANChannelId {
|
||||
CHANNEL_ID_ZERO = 0;
|
||||
CHANNEL_ID_ONE = 1;
|
||||
CHANNEL_ID_TWO = 2;
|
||||
CHANNEL_ID_THREE = 3;
|
||||
CHANNEL_ID_FOUR = 4;
|
||||
CHANNEL_ID_FIVE = 5;
|
||||
CHANNEL_ID_SIX = 6;
|
||||
CHANNEL_ID_SEVEN = 7;
|
||||
}
|
||||
|
||||
enum CANInterface {
|
||||
NATIVE = 0;
|
||||
VIRTUAL = 1;
|
||||
SLCAN = 2;
|
||||
}
|
||||
|
||||
enum BAUDRATE {
|
||||
BCAN_BAUDRATE_1M = 0;
|
||||
BCAN_BAUDRATE_500K = 1;
|
||||
BCAN_BAUDRATE_250K = 2;
|
||||
BCAN_BAUDRATE_150K = 3;
|
||||
BCAN_BAUDRATE_NUM = 4;
|
||||
}
|
||||
|
||||
// CAN卡驱动类型配置 | 根据所用的CAN卡硬件型号或驱动类型配置
|
||||
optional CANCardBrand brand = 1;
|
||||
// CAN卡硬件接口类型配置 | 根据所用的CAN卡硬件接口类型或驱动类型配置
|
||||
optional CANCardType type = 2;
|
||||
// CAN卡端口号配置 | 根据所连接的CAN卡端口号配置
|
||||
optional CANChannelId channel_id = 3;
|
||||
// CAN卡软件接口配置
|
||||
optional CANInterface interface = 4;
|
||||
// CAN卡端口数量配置
|
||||
optional uint32 num_ports = 5;
|
||||
// CAN卡波特率配置
|
||||
optional BAUDRATE baudrate = 6;
|
||||
}
|
||||
@ -0,0 +1,157 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cmvr.msgs;
|
||||
|
||||
message SdoFrame {
|
||||
uint32 node_id = 1; // 节点ID
|
||||
CommandSpecifier cs = 2; // SDO命令字
|
||||
uint32 index = 3; // 对象字典索引
|
||||
uint32 sub_index = 4; // 子索引
|
||||
uint32 data = 5; // 数据区
|
||||
}
|
||||
|
||||
enum PdoBaseId{
|
||||
|
||||
PDO_BASE_ID_UNSPECIFIED = 0;
|
||||
|
||||
RPDO1_BASE_ID_200 = 0x200;
|
||||
RPDO2_BASE_ID_300 = 0x300;
|
||||
RPDO3_BASE_ID_400 = 0x400;
|
||||
RPDO4_BASE_ID_500 = 0x500;
|
||||
|
||||
|
||||
TPDO1_BASE_ID_180 = 0x180;
|
||||
TPDO2_BASE_ID_280 = 0x280;
|
||||
TPDO3_BASE_ID_380 = 0x380;
|
||||
TPDO4_BASE_ID_480 = 0x480;
|
||||
}
|
||||
|
||||
// PDO 传输类型
|
||||
enum TransmissionType {
|
||||
|
||||
// 同步传输
|
||||
SYNC_EVENT_DRIVEN = 0x00; // 非循环同步
|
||||
SYNC_CYCLIC = 0x01; // 循环同步
|
||||
|
||||
// 远程请求触发
|
||||
REMOTE_SYNC = 0xFC; // 远程同步
|
||||
REMOTE_ASYNC = 0xFD; // 远程异步
|
||||
|
||||
// 异步传输
|
||||
ASYNC_MANUFACTURER_SPECIFIC = 0xFE; // 异步,制造商特定事件
|
||||
ASYNC_DEVICE_SPECIFIC = 0xFF; // 异步,设备子协议特定事件
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum CommandSpecifier {
|
||||
CS_NO = 0; // 默认无效
|
||||
CS_WRITE_ONE_BYTE = 0x2F; // 写 1 字节
|
||||
CS_WRITE_TWO_BYTES = 0x2B; // 写 2 字节
|
||||
CS_WRITE_THREE_BYTES = 0x27; // 写 3 字节
|
||||
CS_WRITE_FOUR_BYTES = 0x23; // 写 4 字节
|
||||
CS_WRITE_SUCCESS_RESPONSE = 0x60; // 写成功响应
|
||||
|
||||
CS_READ_REQUEST = 0x40; // 发起读取请求
|
||||
CS_READ_RESPONSE_ONE_BYTE = 0x4F; // 响应 1 字节
|
||||
CS_READ_RESPONSE_TWO_BYTES = 0x4B;// 响应 2 字节
|
||||
CS_READ_RESPONSE_THREE_BYTES = 0x47;
|
||||
CS_READ_RESPONSE_FOUR_BYTES = 0x43;
|
||||
|
||||
CS_EXCEPTION_RESPONSE = 0x80; // 异常响应
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
enum NmtState {
|
||||
// 0x00 - 正在初始化(Initializing)
|
||||
NMT_INITIALIZING = 0x00;
|
||||
|
||||
// 0x01 - 未连接 / 应用复位(Reset Application)
|
||||
NMT_RESET_APPLICATION = 0x01;
|
||||
|
||||
// 0x02 - 正在连接(Connecting)
|
||||
NMT_CONNECTING = 0x02;
|
||||
|
||||
// 0x03 - 准备(Preparing)
|
||||
NMT_PREPARING = 0x03;
|
||||
|
||||
// 0x04 - 停止状态(Stopped),开启 SDO,关闭 PDO
|
||||
NMT_STOPPED = 0x04;
|
||||
|
||||
// 0x05 - 运行状态(Operational),开启 SDO、PDO、NMT
|
||||
NMT_OPERATIONAL = 0x05;
|
||||
|
||||
// 0x7F - 预运行状态(Pre-Operational),开启 SDO,关闭 PDO
|
||||
NMT_PRE_OPERATIONAL = 0x7F;
|
||||
}
|
||||
|
||||
|
||||
|
||||
enum NmtCommand {
|
||||
// 未指定命令
|
||||
NMT_COMMAND_UNSPECIFIED = 0x00;
|
||||
|
||||
// 0x01 - 启动远程节点(Start Remote Node)
|
||||
NMT_START_REMOTE_NODE = 0x01;
|
||||
|
||||
// 0x02 - 停止远程节点(Stop Remote Node)
|
||||
NMT_STOP_REMOTE_NODE = 0x02;
|
||||
|
||||
// 0x80 - 进入预操作状态(Enter Pre-Operational)
|
||||
NMT_ENTER_PRE_OPERATIONAL = 0x80;
|
||||
|
||||
// 0x81 - 复位节点(Reset Node)
|
||||
NMT_RESET_NODE = 0x81;
|
||||
|
||||
// 0x82 - 复位通信(Reset Communication)
|
||||
NMT_RESET_COMMUNICATION = 0x82;
|
||||
}
|
||||
|
||||
|
||||
// CANopen communication object dictionary indexes.
|
||||
// CiA402 drive-profile objects are defined in cia402.proto.
|
||||
enum CanopenObjectIndex {
|
||||
CANOPEN_OBJECT_INDEX_ZERO = 0;
|
||||
|
||||
CANOPEN_PRODUCER_HEARTBEAT_TIME_1017 = 0x1017;
|
||||
|
||||
// PDO 通信参数对象(Communication Object)
|
||||
CANOPEN_RPDO1_COMM_1400 = 0x1400;
|
||||
CANOPEN_RPDO2_COMM_1401 = 0x1401;
|
||||
CANOPEN_RPDO3_COMM_1402 = 0x1402;
|
||||
CANOPEN_RPDO4_COMM_1403 = 0x1403;
|
||||
|
||||
CANOPEN_TPDO1_COMM_1800 = 0x1800;
|
||||
CANOPEN_TPDO2_COMM_1801 = 0x1801;
|
||||
CANOPEN_TPDO3_COMM_1802 = 0x1802;
|
||||
CANOPEN_TPDO4_COMM_1803 = 0x1803;
|
||||
|
||||
// PDO 映射对象(Mapping Object)
|
||||
CANOPEN_RPDO1_MAP_1600 = 0x1600;
|
||||
CANOPEN_RPDO2_MAP_1601 = 0x1601;
|
||||
CANOPEN_RPDO3_MAP_1602 = 0x1602;
|
||||
CANOPEN_RPDO4_MAP_1603 = 0x1603;
|
||||
|
||||
CANOPEN_TPDO1_MAP_1A00 = 0x1A00;
|
||||
CANOPEN_TPDO2_MAP_1A01 = 0x1A01;
|
||||
CANOPEN_TPDO3_MAP_1A02 = 0x1A02;
|
||||
CANOPEN_TPDO4_MAP_1A03 = 0x1A03;
|
||||
|
||||
// Ti5 vendor-specific objects used through CANopen SDO.
|
||||
CANOPEN_USER_SAVE_PARA_2000 = 0x2000;
|
||||
CANOPEN_POSITION_OFFSET_2008 = 0x2008;
|
||||
}
|
||||
|
||||
// 子索引
|
||||
enum ObSubIndex {
|
||||
SUB_INDEX_0 = 0;
|
||||
SUB_INDEX_1 = 1;
|
||||
SUB_INDEX_2 = 2;
|
||||
SUB_INDEX_3 = 3;
|
||||
SUB_INDEX_4 = 4;
|
||||
SUB_INDEX_5 = 5;
|
||||
SUB_INDEX_6 = 6;
|
||||
SUB_INDEX_7 = 7;
|
||||
}
|
||||
@ -0,0 +1,64 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cmvr.msgs;
|
||||
|
||||
// CiA402 object dictionary indexes shared by CANopen and EtherCAT CoE drives.
|
||||
enum Cia402ObjectIndex {
|
||||
CIA402_OBJECT_INDEX_ZERO = 0;
|
||||
|
||||
CIA402_ERROR_CODE_603F = 0x603F;
|
||||
|
||||
CIA402_CONTROL_WORD_6040 = 0x6040;
|
||||
CIA402_STATUS_WORD_6041 = 0x6041;
|
||||
|
||||
CIA402_QUICK_STOP_OPTION_605A = 0x605A;
|
||||
CIA402_SHUTDOWN_OPTION_605B = 0x605B;
|
||||
CIA402_DISABLE_OPERATION_OPTION_605C = 0x605C;
|
||||
CIA402_HALT_OPTION_605D = 0x605D;
|
||||
CIA402_FAULT_REACTION_OPTION_605E = 0x605E;
|
||||
|
||||
CIA402_OPERATION_MODE_6060 = 0x6060;
|
||||
CIA402_MODE_DISPLAY_6061 = 0x6061;
|
||||
|
||||
CIA402_POSITION_DEMAND_VALUE_6062 = 0x6062;
|
||||
CIA402_ACTUAL_POSITION_6064 = 0x6064;
|
||||
CIA402_MAX_FOLLOWING_ERROR_6065 = 0x6065;
|
||||
CIA402_POSITION_WINDOW_6067 = 0x6067;
|
||||
CIA402_POSITION_WINDOW_TIME_6068 = 0x6068;
|
||||
|
||||
CIA402_VELOCITY_DEMAND_VALUE_606B = 0x606B;
|
||||
CIA402_ACTUAL_VELOCITY_606C = 0x606C;
|
||||
CIA402_VELOCITY_WINDOW_606D = 0x606D;
|
||||
CIA402_VELOCITY_WINDOW_TIME_606E = 0x606E;
|
||||
CIA402_VELOCITY_THRESHOLD_606F = 0x606F;
|
||||
CIA402_VELOCITY_THRESHOLD_TIME_6070 = 0x6070;
|
||||
|
||||
CIA402_TARGET_TORQUE_6071 = 0x6071;
|
||||
CIA402_MAX_TORQUE_6072 = 0x6072;
|
||||
CIA402_TORQUE_DEMAND_VALUE_6074 = 0x6074;
|
||||
CIA402_MOTOR_RATED_TORQUE_6076 = 0x6076;
|
||||
CIA402_ACTUAL_TORQUE_6077 = 0x6077;
|
||||
CIA402_ACTUAL_CURRENT_6078 = 0x6078;
|
||||
CIA402_DC_LINK_VOLTAGE_6079 = 0x6079;
|
||||
|
||||
CIA402_TARGET_POSITION_607A = 0x607A;
|
||||
CIA402_HOME_OFFSET_607C = 0x607C;
|
||||
CIA402_SOFTWARE_POSITION_LIMIT_607D = 0x607D;
|
||||
CIA402_MAX_PROFILE_VELOCITY_607F = 0x607F;
|
||||
|
||||
CIA402_PROFILE_VELOCITY_6081 = 0x6081;
|
||||
CIA402_PROFILE_ACCELERATION_6083 = 0x6083;
|
||||
CIA402_PROFILE_DECELERATION_6084 = 0x6084;
|
||||
CIA402_QUICK_STOP_DECELERATION_6085 = 0x6085;
|
||||
CIA402_TORQUE_SLOPE_6087 = 0x6087;
|
||||
|
||||
CIA402_GEAR_RATIO_6091 = 0x6091;
|
||||
CIA402_VELOCITY_OFFSET_60B1 = 0x60B1;
|
||||
CIA402_TORQUE_OFFSET_60B2 = 0x60B2;
|
||||
CIA402_INTERPOLATION_DATA_RECORD_60C1 = 0x60C1;
|
||||
CIA402_INTERPOLATION_TIME_PERIOD_60C2 = 0x60C2;
|
||||
CIA402_FOLLOWING_ERROR_ACTUAL_VALUE_60F4 = 0x60F4;
|
||||
CIA402_TARGET_VELOCITY_60FF = 0x60FF;
|
||||
|
||||
CIA402_SUPPORTED_DRIVE_MODES_6502 = 0x6502;
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package cmvr.msgs;
|
||||
|
||||
// Error codes enum for API's categorized by modules.
|
||||
enum ErrorCode {
|
||||
// No error, returns on success.
|
||||
OK = 0;
|
||||
|
||||
// Canbus module error codes start from here.
|
||||
CANBUS_ERROR = 2000;
|
||||
CAN_CLIENT_ERROR_BASE = 2100;
|
||||
CAN_CLIENT_ERROR_OPEN_DEVICE_FAILED = 2101;
|
||||
CAN_CLIENT_ERROR_FRAME_NUM = 2102;
|
||||
CAN_CLIENT_ERROR_SEND_FAILED = 2103;
|
||||
CAN_CLIENT_ERROR_RECV_FAILED = 2104;
|
||||
|
||||
// motor
|
||||
MOTOR_ERROR = 3000;
|
||||
MOTOR_ERROR_SET_ZERO = 3001;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
message StatusPb {
|
||||
ErrorCode error_code = 1;
|
||||
string msg = 2;
|
||||
}
|
||||
@ -0,0 +1,116 @@
|
||||
syntax = "proto3";
|
||||
import "cmvr/msgs/canopen.proto";
|
||||
package cmvr.msgs;
|
||||
|
||||
|
||||
|
||||
/* --------------------------------------------------------
|
||||
* CAN OPEN 定义
|
||||
* --------------------------------------------------------*/
|
||||
|
||||
|
||||
|
||||
|
||||
// 电机控制模式(Operation Mode)
|
||||
enum RunMode {
|
||||
// 未指定
|
||||
RUN_MODE_UNSPECIFIED = 0;
|
||||
|
||||
// Profile Position Mode - 位置模式
|
||||
RUN_MODE_PROFILE_POSITION = 1;
|
||||
|
||||
// Velocity Mode - 简单速度模式
|
||||
RUN_MODE_VELOCITY = 2;
|
||||
|
||||
// Profile Velocity Mode - 速度模式(带轮廓)
|
||||
RUN_MODE_PROFILE_VELOCITY = 3;
|
||||
|
||||
// Torque Mode - 转矩模式
|
||||
RUN_MODE_TORQUE = 4;
|
||||
|
||||
// Homing Mode - 回零模式
|
||||
RUN_MODE_HOMING = 5;
|
||||
|
||||
// Interpolation Mode - 位置插补模式
|
||||
RUN_MODE_INTERPOLATED_POSITION = 7;
|
||||
|
||||
// Cyclic Synchronous Position Mode - 周期位置模式
|
||||
RUN_MODE_CYCLIC_SYNC_POSITION = 8;
|
||||
|
||||
// Cyclic Synchronous Velocity Mode - 周期速度模式
|
||||
RUN_MODE_CYCLIC_SYNC_VELOCITY = 9;
|
||||
|
||||
// Cyclic Synchronous Current Mode - 周期转矩模式
|
||||
RUN_MODE_CYCLIC_SYNC_CURRENT = 10;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 电机状态数据
|
||||
message MotorStatus {
|
||||
RunMode run_mode = 1; // 当前运行模式
|
||||
|
||||
|
||||
int32 current = 2; // 当前电流(单位:mA)
|
||||
int32 target_current = 3; // 目标电流(单位:mA)
|
||||
int32 speed = 4; // 当前速度,转换为度每秒:(speed / 100 / 减速比) * 360
|
||||
int32 target_speed = 5; // 目标速度,单位同上
|
||||
int32 position = 6; // 当前电机位置(位置转角度:(position / 65536 / 减速比) * 360)
|
||||
int32 target_position = 7; // 目标位置(非位置模式无效)
|
||||
uint32 error_state = 8; // 错误状态位(见位说明)
|
||||
|
||||
int32 speed_kp = 9; // 速度环Kp,含模式和速度信息(bit复用)
|
||||
int32 speed_ki = 10; // 速度环Ki,含模式和速度信息(bit复用)
|
||||
int32 speed_kd = 11; // 速度环Kd
|
||||
|
||||
int32 position_kp = 12; // 位置环Kp
|
||||
int32 position_ki = 13; // 位置环Ki
|
||||
int32 position_kd = 14; // 位置环Kd
|
||||
|
||||
int32 bus_voltage = 15; // 母线电压
|
||||
|
||||
int32 max_abs_current = 16; // 最大电流绝对值(单位:mA)
|
||||
int32 max_pos_current = 17; // 最大正电流(单位:mA)
|
||||
int32 min_neg_current = 18; // 最小负电流(单位:mA)
|
||||
|
||||
int32 max_pos_accel = 19; // 最大正向加速度
|
||||
int32 min_neg_accel = 20; // 最小负向加速度
|
||||
int32 max_pos_velocity = 21; // 最大正向速度(转化为度/秒)
|
||||
int32 min_neg_velocity = 22; // 最小负向速度(转化为度/秒)
|
||||
|
||||
int32 max_pos_position = 23; // 最大正向位置(角度)
|
||||
int32 min_neg_position = 24; // 最小负向位置(角度)
|
||||
|
||||
int32 motor_temp = 25; // 电机温度(单位:摄氏度)
|
||||
int32 board_temp = 26; // 电路板温度(单位:摄氏度)
|
||||
|
||||
int32 current_kp = 27; // 电流P
|
||||
int32 current_ki = 28; // 电流I
|
||||
int32 current_kd = 29; // 电流D
|
||||
|
||||
int32 motor_type = 30; // 电机型号(复合字段,包含刹车、ACTUATOR_TYPE等)
|
||||
int32 motor_version = 31; // 电机版本号(软件+硬件,16进制格式)
|
||||
int32 software_version = 32;// 软件版本号(16进制格式)
|
||||
|
||||
int32 position_offset = 33; // 当前位置偏移(编码器位置 - 偏移值)
|
||||
bytes csp_data = 34; // 获取CSP,8字节数据
|
||||
int32 encoder_voltage = 35; // 编码器电池电压(新版硬件支持)
|
||||
int32 encoder_state = 36; // 编码器状态(双编码器=外圈位置,单编码器=状态)
|
||||
|
||||
int32 overvoltage_limit = 37; // 过压阈值(单位:V)
|
||||
int32 undervoltage_limit = 38; // 欠压阈值(单位:V)
|
||||
int32 coil_over_temp = 39; // 电机线圈过温阈值(单位:℃)
|
||||
int32 driver_over_temp = 40; // 驱动板过温阈值(单位:℃)
|
||||
|
||||
/* ---------------------
|
||||
* CANOPEN 特有的参数
|
||||
* --------------------*/
|
||||
SdoFrame sdo_response = 41;
|
||||
NmtState nmt_state = 42;
|
||||
// 只保留值,具体值在使用的时候使用联合体去解析
|
||||
uint32 ctrl_word = 43;
|
||||
uint32 status_word = 44;
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
|
||||
import "cmvr/msgs/motor.proto";
|
||||
package cmvr.msgs;
|
||||
|
||||
|
||||
// 包含机器人的所有信息
|
||||
|
||||
message RobotDetail{
|
||||
|
||||
// key 电机 nodeid
|
||||
map<uint32, MotorStatus> motors = 1; // node_id => status
|
||||
}
|
||||
@ -35,11 +35,11 @@ public class BaseEntity implements Serializable
|
||||
private Date createTime;
|
||||
|
||||
/** 更新者 */
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
private String updateBy;
|
||||
|
||||
/** 更新时间 */
|
||||
@TableField(fill = FieldFill.UPDATE)
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date updateTime;
|
||||
|
||||
|
||||
@ -68,6 +68,12 @@
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@ -7,11 +7,14 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import javax.sql.DataSource;
|
||||
import org.apache.ibatis.io.VFS;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import com.baomidou.mybatisplus.core.config.GlobalConfig;
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
|
||||
import com.baomidou.mybatisplus.core.toolkit.GlobalConfigUtils;
|
||||
import com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean;
|
||||
import com.github.yulichang.injector.MPJSqlInjector;
|
||||
import com.cmvr.framework.mybatisPlus.AuditFieldInterceptor;
|
||||
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@ -117,7 +120,9 @@ public class MyBatisConfig
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SqlSessionFactory sqlSessionFactory(DataSource dataSource, MPJSqlInjector mpjSqlInjector) throws Exception
|
||||
public SqlSessionFactory sqlSessionFactory(DataSource dataSource, MPJSqlInjector mpjSqlInjector,
|
||||
MetaObjectHandler metaObjectHandler, Interceptor[] interceptors,
|
||||
AuditFieldInterceptor auditFieldInterceptor) throws Exception
|
||||
{
|
||||
String typeAliasesPackage = env.getProperty("mybatis-plus.typeAliasesPackage",
|
||||
env.getProperty("mybatis.typeAliasesPackage", "com.cmvr.**.domain"));
|
||||
@ -132,8 +137,13 @@ public class MyBatisConfig
|
||||
sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
|
||||
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
|
||||
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(configLocation));
|
||||
List<Interceptor> orderedInterceptors = new ArrayList<>(Arrays.asList(interceptors));
|
||||
orderedInterceptors.remove(auditFieldInterceptor);
|
||||
orderedInterceptors.add(auditFieldInterceptor);
|
||||
sessionFactory.setPlugins(orderedInterceptors.toArray(new Interceptor[0]));
|
||||
GlobalConfig globalConfig = GlobalConfigUtils.defaults();
|
||||
globalConfig.setSqlInjector(mpjSqlInjector);
|
||||
globalConfig.setMetaObjectHandler(metaObjectHandler);
|
||||
sessionFactory.setGlobalConfig(globalConfig);
|
||||
return sessionFactory.getObject();
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import org.springframework.http.CacheControl;
|
||||
import org.springframework.web.cors.CorsConfiguration;
|
||||
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||
import org.springframework.web.filter.CorsFilter;
|
||||
import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
|
||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||
@ -26,6 +27,12 @@ public class ResourcesConfig implements WebMvcConfigurer
|
||||
@Autowired
|
||||
private RepeatSubmitInterceptor repeatSubmitInterceptor;
|
||||
|
||||
@Override
|
||||
public void configureAsyncSupport(AsyncSupportConfigurer configurer)
|
||||
{
|
||||
configurer.setDefaultTimeout(0L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry)
|
||||
{
|
||||
|
||||
@ -105,7 +105,8 @@ public class SecurityConfig
|
||||
.requestMatchers(HttpMethod.GET, "/", "/*.html", "/**.html", "/**.css", "/**.js", "/profile/**").permitAll()
|
||||
.requestMatchers("/doc.html", "/swagger-ui.html", "/v3/api-docs/**", "/swagger-ui/**",
|
||||
"/webjars/**", "/druid/**").permitAll()
|
||||
.requestMatchers("/system/file/upload", "/evaluation/callback", "/flow/**", "/flowise/**",
|
||||
.requestMatchers("/api/edge/camera/rgb-stream", "/api/edge/camera/rgb-stream/public",
|
||||
"/system/file/upload", "/evaluation/callback", "/flow/**", "/flowise/**",
|
||||
"/kws/**", "/ws/**", "/api/grpc/**", "/show/**", "/node-red/**",
|
||||
"/swagger-resources/**", "/webjars/**", "/*/api-docs", "/ti/**",
|
||||
"/flow/execute").permitAll()
|
||||
|
||||
@ -0,0 +1,110 @@
|
||||
package com.cmvr.framework.mybatisPlus;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.Collections;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.ibatis.executor.Executor;
|
||||
import org.apache.ibatis.mapping.MappedStatement;
|
||||
import org.apache.ibatis.mapping.SqlCommandType;
|
||||
import org.apache.ibatis.plugin.Interceptor;
|
||||
import org.apache.ibatis.plugin.Intercepts;
|
||||
import org.apache.ibatis.plugin.Invocation;
|
||||
import org.apache.ibatis.plugin.Signature;
|
||||
import org.apache.ibatis.reflection.MetaObject;
|
||||
import org.apache.ibatis.reflection.SystemMetaObject;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Fills audit fields before dynamic XML SQL is evaluated.
|
||||
*/
|
||||
@Component
|
||||
@Intercepts({
|
||||
@Signature(type = Executor.class, method = "update", args = {MappedStatement.class, Object.class})
|
||||
})
|
||||
public class AuditFieldInterceptor implements Interceptor
|
||||
{
|
||||
private final MyMetaObjectHandler metaObjectHandler;
|
||||
|
||||
public AuditFieldInterceptor(MyMetaObjectHandler metaObjectHandler)
|
||||
{
|
||||
this.metaObjectHandler = metaObjectHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object intercept(Invocation invocation) throws Throwable
|
||||
{
|
||||
MappedStatement mappedStatement = (MappedStatement) invocation.getArgs()[0];
|
||||
SqlCommandType commandType = mappedStatement.getSqlCommandType();
|
||||
if (commandType == SqlCommandType.INSERT || commandType == SqlCommandType.UPDATE)
|
||||
{
|
||||
fillAuditFields(invocation.getArgs()[1], commandType);
|
||||
}
|
||||
return invocation.proceed();
|
||||
}
|
||||
|
||||
void fillAuditFields(Object parameter, SqlCommandType commandType)
|
||||
{
|
||||
Set<Object> visited = Collections.newSetFromMap(new IdentityHashMap<>());
|
||||
fill(parameter, commandType, visited);
|
||||
}
|
||||
|
||||
private void fill(Object parameter, SqlCommandType commandType, Set<Object> visited)
|
||||
{
|
||||
if (parameter == null || isSimpleValue(parameter) || !visited.add(parameter))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (parameter instanceof Map<?, ?> map)
|
||||
{
|
||||
map.values().forEach(value -> fill(value, commandType, visited));
|
||||
return;
|
||||
}
|
||||
if (parameter instanceof Iterable<?> iterable)
|
||||
{
|
||||
iterable.forEach(value -> fill(value, commandType, visited));
|
||||
return;
|
||||
}
|
||||
if (parameter.getClass().isArray())
|
||||
{
|
||||
for (int index = 0; index < Array.getLength(parameter); index++)
|
||||
{
|
||||
fill(Array.get(parameter, index), commandType, visited);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
MetaObject metaObject = SystemMetaObject.forObject(parameter);
|
||||
if (!hasAuditField(metaObject))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (commandType == SqlCommandType.INSERT)
|
||||
{
|
||||
metaObjectHandler.insertFill(metaObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
metaObjectHandler.updateFill(metaObject);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean hasAuditField(MetaObject metaObject)
|
||||
{
|
||||
return metaObject.hasSetter(MyMetaObjectHandler.CREATE_BY)
|
||||
|| metaObject.hasSetter(MyMetaObjectHandler.CREATE_TIME)
|
||||
|| metaObject.hasSetter(MyMetaObjectHandler.UPDATE_BY)
|
||||
|| metaObject.hasSetter(MyMetaObjectHandler.UPDATE_TIME);
|
||||
}
|
||||
|
||||
private boolean isSimpleValue(Object value)
|
||||
{
|
||||
return value instanceof CharSequence
|
||||
|| value instanceof Number
|
||||
|| value instanceof Boolean
|
||||
|| value instanceof Character
|
||||
|| value instanceof Enum<?>;
|
||||
}
|
||||
}
|
||||
@ -32,13 +32,14 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
username = "anonymous"; // 匿名接口默认值
|
||||
}
|
||||
// 起始版本 3.3.0(推荐使用)
|
||||
this.setFieldValByName(CREATE_BY, username, metaObject);
|
||||
this.setFieldValByName(CREATE_TIME, currentTime(metaObject, CREATE_TIME), metaObject);
|
||||
this.setFieldValByName(UPDATE_BY, username, metaObject);
|
||||
this.setFieldValByName(UPDATE_TIME, currentTime(metaObject, UPDATE_TIME), metaObject);
|
||||
this.setFieldValByName(DELETED, "0", metaObject);
|
||||
setFieldValIfPresent(CREATE_BY, username, metaObject);
|
||||
setFieldValIfPresent(CREATE_TIME, currentTime(metaObject, CREATE_TIME), metaObject);
|
||||
setFieldValIfPresent(UPDATE_BY, username, metaObject);
|
||||
setFieldValIfPresent(UPDATE_TIME, currentTime(metaObject, UPDATE_TIME), metaObject);
|
||||
setFieldValIfPresent(DELETED, "0", metaObject);
|
||||
// this.setFieldValByName(STATUS, "1", metaObject);
|
||||
if (getFieldValByName(STATUS, metaObject) == null) {
|
||||
if (metaObject.hasSetter(STATUS) && metaObject.hasGetter(STATUS)
|
||||
&& getFieldValByName(STATUS, metaObject) == null) {
|
||||
this.setFieldValByName(STATUS, "1", metaObject);
|
||||
}
|
||||
}
|
||||
@ -55,8 +56,14 @@ public class MyMetaObjectHandler implements MetaObjectHandler {
|
||||
} catch (Exception e) {
|
||||
username = "anonymous"; // 匿名接口默认值
|
||||
}
|
||||
this.setFieldValByName(UPDATE_BY, username, metaObject);
|
||||
this.setFieldValByName(UPDATE_TIME, currentTime(metaObject, UPDATE_TIME), metaObject);
|
||||
setFieldValIfPresent(UPDATE_BY, username, metaObject);
|
||||
setFieldValIfPresent(UPDATE_TIME, currentTime(metaObject, UPDATE_TIME), metaObject);
|
||||
}
|
||||
|
||||
private void setFieldValIfPresent(String fieldName, Object value, MetaObject metaObject) {
|
||||
if (value != null && metaObject.hasSetter(fieldName)) {
|
||||
this.setFieldValByName(fieldName, value, metaObject);
|
||||
}
|
||||
}
|
||||
|
||||
private Object currentTime(MetaObject metaObject, String fieldName) {
|
||||
|
||||
@ -3,6 +3,7 @@ package com.cmvr.framework.websocket.handler;
|
||||
import com.cmvr.framework.websocket.manager.ChannelSubscriptionManager;
|
||||
import com.cmvr.framework.websocket.message.WSChannelSubscriptionMessage;
|
||||
import com.cmvr.framework.websocket.service.GrpcClientService;
|
||||
import com.cmvr.framework.websocket.service.MessagePushService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@ -16,6 +17,7 @@ public abstract class BaseChannelSubscribeHandler implements WSMessageHandler<WS
|
||||
protected final Logger log = LoggerFactory.getLogger(getClass());
|
||||
protected final ChannelSubscriptionManager channelSubscriptionManager;
|
||||
protected final GrpcClientService grpcClientService;
|
||||
protected final MessagePushService messagePushService;
|
||||
|
||||
/**
|
||||
* 是否需要GRPC远程调用
|
||||
@ -53,8 +55,18 @@ public abstract class BaseChannelSubscribeHandler implements WSMessageHandler<WS
|
||||
/** 订阅统一模板 */
|
||||
private void doSubscribe(String channel, WebSocketSession session) {
|
||||
boolean needGrpc = isNeedGrpc(channel);
|
||||
// 先完成本地订阅,避免远端流启动后首批媒体数据因“无人订阅”而丢失。
|
||||
boolean firstSubscriber = channelSubscriptionManager.subscribe(
|
||||
channel,
|
||||
session,
|
||||
() -> {
|
||||
if (needGrpc) {
|
||||
messagePushService.replayH264Fmp4Init(channel, session);
|
||||
}
|
||||
}
|
||||
);
|
||||
// 没人订阅 + 需要grpc → 发起远端订阅
|
||||
if (needGrpc && !channelSubscriptionManager.hasSubscribers(channel)) {
|
||||
if (needGrpc && firstSubscriber) {
|
||||
String[] params = parseGrpcParam(channel);
|
||||
String service = params[0];
|
||||
String method = params[1];
|
||||
@ -68,12 +80,11 @@ public abstract class BaseChannelSubscribeHandler implements WSMessageHandler<WS
|
||||
}
|
||||
});
|
||||
}
|
||||
// 本地统一订阅
|
||||
channelSubscriptionManager.subscribe(channel, session);
|
||||
}
|
||||
|
||||
/** 取消订阅统一模板 */
|
||||
private void doUnSubscribe(String channel, WebSocketSession session) {
|
||||
messagePushService.cancelMediaInitReplay(channel, session);
|
||||
channelSubscriptionManager.unsubscribe(channel, session);
|
||||
boolean needGrpc = isNeedGrpc(channel);
|
||||
// 无任何订阅 + 需要grpc → 远端取消
|
||||
@ -88,6 +99,10 @@ public abstract class BaseChannelSubscribeHandler implements WSMessageHandler<WS
|
||||
grpcClientService.send(false, terminalId, deviceId, service, method);
|
||||
} catch (Exception e) {
|
||||
log.error("频道{} grpc取消订阅异常", channel, e);
|
||||
} finally {
|
||||
if (!channelSubscriptionManager.hasSubscribers(channel)) {
|
||||
messagePushService.clearMediaChannel(channel);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import com.cmvr.framework.websocket.enums.WSMessageTypeEnum;
|
||||
import com.cmvr.framework.websocket.manager.ChannelSubscriptionManager;
|
||||
import com.cmvr.framework.websocket.message.WSChannelSubscriptionMessage;
|
||||
import com.cmvr.framework.websocket.service.GrpcClientService;
|
||||
import com.cmvr.framework.websocket.service.MessagePushService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
||||
@ -12,8 +13,10 @@ import org.springframework.stereotype.Component;
|
||||
@WSMessageType(value = WSMessageTypeEnum.CHANNEL_SUBSCRIPTION, messageClass = WSChannelSubscriptionMessage.class)
|
||||
public class ChannelSubscriptionMessageHandler extends BaseChannelSubscribeHandler {
|
||||
|
||||
public ChannelSubscriptionMessageHandler(ChannelSubscriptionManager channelSubscriptionManager, GrpcClientService grpcClientService) {
|
||||
super(channelSubscriptionManager, grpcClientService);
|
||||
public ChannelSubscriptionMessageHandler(ChannelSubscriptionManager channelSubscriptionManager,
|
||||
GrpcClientService grpcClientService,
|
||||
MessagePushService messagePushService) {
|
||||
super(channelSubscriptionManager, grpcClientService, messagePushService);
|
||||
}
|
||||
|
||||
// 当前频道带 / 分段,需要grpc
|
||||
|
||||
@ -1,29 +0,0 @@
|
||||
package com.cmvr.framework.websocket.handler;
|
||||
|
||||
import com.cmvr.framework.websocket.annotation.WSMessageType;
|
||||
import com.cmvr.framework.websocket.enums.WSMessageTypeEnum;
|
||||
import com.cmvr.framework.websocket.manager.ChannelSubscriptionManager;
|
||||
import com.cmvr.framework.websocket.message.WSChannelSubscriptionMessage;
|
||||
import com.cmvr.framework.websocket.service.GrpcClientService;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@WSMessageType(value = WSMessageTypeEnum.CHANNEL_SUBSCRIPTION, messageClass = WSChannelSubscriptionMessage.class)
|
||||
public class SimpleChannelSubscribeHandler extends BaseChannelSubscribeHandler {
|
||||
|
||||
public SimpleChannelSubscribeHandler(ChannelSubscriptionManager channelSubscriptionManager, GrpcClientService grpcClientService) {
|
||||
super(channelSubscriptionManager, grpcClientService);
|
||||
}
|
||||
|
||||
// 简单频道不需要grpc调用
|
||||
@Override
|
||||
protected boolean isNeedGrpc(String channel) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 不会执行到,随便返回
|
||||
@Override
|
||||
protected String[] parseGrpcParam(String channel) {
|
||||
return new String[0];
|
||||
}
|
||||
}
|
||||
@ -4,6 +4,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -14,8 +15,21 @@ public class ChannelSubscriptionManager {
|
||||
// 频道 -> 连接集合
|
||||
private final Map<String, Set<WebSocketSession>> channelSessions = new ConcurrentHashMap<>();
|
||||
|
||||
public void subscribe(String channel, WebSocketSession session) {
|
||||
channelSessions.computeIfAbsent(channel, k -> ConcurrentHashMap.newKeySet()).add(session);
|
||||
/**
|
||||
* @return 当前会话是否是该频道的第一个订阅者
|
||||
*/
|
||||
public boolean subscribe(String channel, WebSocketSession session, Runnable beforeJoinExistingChannel) {
|
||||
boolean[] firstSubscriber = new boolean[1];
|
||||
channelSessions.compute(channel, (key, sessions) -> {
|
||||
Set<WebSocketSession> target = sessions == null ? ConcurrentHashMap.newKeySet() : sessions;
|
||||
firstSubscriber[0] = target.isEmpty();
|
||||
if (!firstSubscriber[0]) {
|
||||
beforeJoinExistingChannel.run();
|
||||
}
|
||||
target.add(session);
|
||||
return target;
|
||||
});
|
||||
return firstSubscriber[0];
|
||||
}
|
||||
|
||||
public void unsubscribe(String channel, WebSocketSession session) {
|
||||
@ -36,8 +50,17 @@ public class ChannelSubscriptionManager {
|
||||
return channelSessions.containsKey(channel);
|
||||
}
|
||||
|
||||
public void clearSession(WebSocketSession session) {
|
||||
channelSessions.keySet().forEach(channel -> unsubscribe(channel, session));
|
||||
/**
|
||||
* 清理连接的所有频道,并返回因此失去最后一个订阅者的频道。
|
||||
*/
|
||||
public Set<String> clearSession(WebSocketSession session) {
|
||||
Set<String> emptiedChannels = new HashSet<>();
|
||||
channelSessions.forEach((channel, sessions) -> {
|
||||
if (sessions.remove(session) && sessions.isEmpty() && channelSessions.remove(channel, sessions)) {
|
||||
emptiedChannels.add(channel);
|
||||
}
|
||||
});
|
||||
return emptiedChannels;
|
||||
}
|
||||
|
||||
}
|
||||
@ -26,7 +26,13 @@ public class MessageHandlerRegistry implements ApplicationContextAware {
|
||||
if (bean instanceof WSMessageHandler) {
|
||||
WSMessageHandler<?> handler = (WSMessageHandler<?>) bean;
|
||||
WSMessageType anno = bean.getClass().getAnnotation(WSMessageType.class);
|
||||
handlerMap.put(anno.value(), new HandlerEntry<>(handler, anno.messageClass()));
|
||||
HandlerEntry<?, ?> previous = handlerMap.putIfAbsent(
|
||||
anno.value(), new HandlerEntry<>(handler, anno.messageClass()));
|
||||
if (previous != null) {
|
||||
throw new IllegalStateException("Duplicate WebSocket message handler for "
|
||||
+ anno.value() + ": " + previous.getHandler().getClass().getName()
|
||||
+ " and " + handler.getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,6 +4,8 @@ package com.cmvr.framework.websocket.server;
|
||||
import com.cmvr.framework.websocket.manager.ChannelSubscriptionManager;
|
||||
import com.cmvr.framework.websocket.manager.WSSessionManager;
|
||||
import com.cmvr.framework.websocket.registry.MessageHandlerRegistry;
|
||||
import com.cmvr.framework.websocket.service.GrpcClientService;
|
||||
import com.cmvr.framework.websocket.service.MessagePushService;
|
||||
import tools.jackson.databind.JsonNode;
|
||||
import tools.jackson.databind.ObjectMapper;
|
||||
import tools.jackson.databind.node.ObjectNode;
|
||||
@ -18,6 +20,8 @@ import org.springframework.web.socket.handler.TextWebSocketHandler;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@ -51,6 +55,12 @@ public class WSServer extends TextWebSocketHandler {
|
||||
@Autowired
|
||||
private ChannelSubscriptionManager channelSubscriptionManager;
|
||||
|
||||
@Autowired
|
||||
private GrpcClientService grpcClientService;
|
||||
|
||||
@Autowired
|
||||
private MessagePushService messagePushService;
|
||||
|
||||
@Override
|
||||
public void afterConnectionEstablished(@NotNull WebSocketSession session) throws Exception {
|
||||
if (!SEMAPHORE.tryAcquire()) {
|
||||
@ -85,11 +95,27 @@ public class WSServer extends TextWebSocketHandler {
|
||||
SEMAPHORE.release();
|
||||
|
||||
sessionManager.removeSession(session);
|
||||
messagePushService.removeSession(session);
|
||||
// 清除通道session
|
||||
channelSubscriptionManager.clearSession(session);
|
||||
Set<String> emptiedChannels = channelSubscriptionManager.clearSession(session);
|
||||
emptiedChannels.forEach(this::stopGrpcChannel);
|
||||
log.info("连接关闭 sid={},当前在线:{}", session.getAttributes().get("userId"), ONLINE_COUNT.get());
|
||||
}
|
||||
|
||||
private void stopGrpcChannel(String channel) {
|
||||
String[] params = channel.split("/");
|
||||
if (params.length != 4) {
|
||||
return;
|
||||
}
|
||||
CompletableFuture.runAsync(() -> grpcClientService.send(
|
||||
false, params[2], params[3], params[0], params[1]
|
||||
)).whenComplete((ignored, throwable) -> {
|
||||
if (!channelSubscriptionManager.hasSubscribers(channel)) {
|
||||
messagePushService.clearMediaChannel(channel);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public static JsonNode buildCommonMessage(String content) {
|
||||
ObjectNode node = new ObjectMapper().createObjectNode();
|
||||
|
||||
@ -13,6 +13,12 @@ import org.springframework.web.socket.WebSocketSession;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.zip.GZIPOutputStream;
|
||||
|
||||
|
||||
@ -20,11 +26,18 @@ import java.util.zip.GZIPOutputStream;
|
||||
public class MessagePushService {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MessagePushService.class);
|
||||
private static final byte[] MEDIA_MAGIC = new byte[]{'C', 'M', 'V', 'F'};
|
||||
private static final byte MEDIA_VERSION = 1;
|
||||
private static final byte MEDIA_TYPE_H264_FMP4 = 1;
|
||||
private static final int MEDIA_HEADER_SIZE = 26;
|
||||
private static final int MAX_MEDIA_INIT_SIZE = 1024 * 1024;
|
||||
|
||||
@Autowired
|
||||
private ChannelSubscriptionManager subscriptionManager;
|
||||
|
||||
private final ObjectMapper objectMapper = new ObjectMapper();
|
||||
private final Map<String, MediaBootstrap> mediaBootstraps = new ConcurrentHashMap<>();
|
||||
private final Map<String, Set<WebSocketSession>> mediaInitWaiters = new ConcurrentHashMap<>();
|
||||
|
||||
public void pushToChannel(String channel, Object payload) {
|
||||
try {
|
||||
@ -35,24 +48,12 @@ public class MessagePushService {
|
||||
|
||||
String json = objectMapper.writeValueAsString(message);
|
||||
|
||||
byte[] data = json.getBytes();
|
||||
byte[] data = json.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
// 压缩数据
|
||||
byte[] compressedData = compress(data);
|
||||
|
||||
BinaryMessage binaryMessage = new BinaryMessage(compressedData);
|
||||
if (!subscriptionManager.hasSubscribers(channel)) {
|
||||
throw new GlobalException("没有订阅该频道的会话");
|
||||
}
|
||||
subscriptionManager.getSubscribedSessions(channel).stream()
|
||||
.filter(WebSocketSession::isOpen)
|
||||
.forEach(session -> {
|
||||
try {
|
||||
session.sendMessage(binaryMessage);
|
||||
} catch (IOException e) {
|
||||
log.error("消息发送失败: {}", e.getMessage());
|
||||
}
|
||||
});
|
||||
sendToChannel(channel, compressedData);
|
||||
|
||||
} catch (GlobalException e) {
|
||||
throw new GlobalException(e.getMessage());
|
||||
@ -61,6 +62,124 @@ public class MessagePushService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 推送连续 H.264 fragmented MP4 数据。媒体负载不再进行 Base64、JSON 或 GZIP 编码。
|
||||
*/
|
||||
public void pushH264Fmp4ToChannel(String channel, byte[] payload, int sequence) {
|
||||
if (payload == null || payload.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sequence == 1) {
|
||||
mediaBootstraps.put(channel, new MediaBootstrap());
|
||||
}
|
||||
MediaBootstrap bootstrap = mediaBootstraps.computeIfAbsent(channel, key -> new MediaBootstrap());
|
||||
bootstrap.accept(payload);
|
||||
replayWaitingMediaInit(channel, bootstrap);
|
||||
if (!subscriptionManager.hasSubscribers(channel)) {
|
||||
return;
|
||||
}
|
||||
|
||||
sendToChannel(channel, buildMediaPacket(channel, payload, sequence));
|
||||
}
|
||||
|
||||
/** 给中途加入频道的会话补发fMP4初始化段。 */
|
||||
public void replayH264Fmp4Init(String channel, WebSocketSession session) {
|
||||
if (!channel.contains("/getRGBImageStream/")) {
|
||||
return;
|
||||
}
|
||||
MediaBootstrap bootstrap = mediaBootstraps.get(channel);
|
||||
byte[] initSegment = bootstrap == null ? null : bootstrap.getInitSegment();
|
||||
if (initSegment == null) {
|
||||
mediaInitWaiters.computeIfAbsent(channel, key -> ConcurrentHashMap.newKeySet()).add(session);
|
||||
return;
|
||||
}
|
||||
sendMediaInit(channel, session, initSegment);
|
||||
}
|
||||
|
||||
public void cancelMediaInitReplay(String channel, WebSocketSession session) {
|
||||
Set<WebSocketSession> sessions = mediaInitWaiters.get(channel);
|
||||
if (sessions != null) {
|
||||
sessions.remove(session);
|
||||
if (sessions.isEmpty()) {
|
||||
mediaInitWaiters.remove(channel, sessions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeSession(WebSocketSession session) {
|
||||
mediaInitWaiters.forEach((channel, sessions) -> {
|
||||
sessions.remove(session);
|
||||
if (sessions.isEmpty()) {
|
||||
mediaInitWaiters.remove(channel, sessions);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void clearMediaChannel(String channel) {
|
||||
mediaBootstraps.remove(channel);
|
||||
mediaInitWaiters.remove(channel);
|
||||
}
|
||||
|
||||
private void replayWaitingMediaInit(String channel, MediaBootstrap bootstrap) {
|
||||
byte[] initSegment = bootstrap.getInitSegment();
|
||||
if (initSegment == null) {
|
||||
return;
|
||||
}
|
||||
Set<WebSocketSession> sessions = mediaInitWaiters.remove(channel);
|
||||
if (sessions != null) {
|
||||
sessions.forEach(session -> sendMediaInit(channel, session, initSegment));
|
||||
}
|
||||
}
|
||||
|
||||
private void sendMediaInit(String channel, WebSocketSession session, byte[] initSegment) {
|
||||
if (!session.isOpen()) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
synchronized (session) {
|
||||
session.sendMessage(new BinaryMessage(buildMediaPacket(channel, initSegment, 0)));
|
||||
}
|
||||
} catch (IOException exception) {
|
||||
log.error("频道{}媒体初始化段补发失败: {}", channel, exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private byte[] buildMediaPacket(String channel, byte[] payload, int sequence) {
|
||||
byte[] channelBytes = channel.getBytes(StandardCharsets.UTF_8);
|
||||
if (channelBytes.length > 0xFFFF) {
|
||||
throw new IllegalArgumentException("WebSocket媒体频道名称过长: " + channel);
|
||||
}
|
||||
|
||||
ByteBuffer buffer = ByteBuffer.allocate(MEDIA_HEADER_SIZE + channelBytes.length + payload.length);
|
||||
buffer.put(MEDIA_MAGIC);
|
||||
buffer.put(MEDIA_VERSION);
|
||||
buffer.put(MEDIA_TYPE_H264_FMP4);
|
||||
buffer.putShort((short) 0);
|
||||
buffer.putLong(System.currentTimeMillis());
|
||||
buffer.putInt(sequence);
|
||||
buffer.putShort((short) channelBytes.length);
|
||||
buffer.putInt(payload.length);
|
||||
buffer.put(channelBytes);
|
||||
buffer.put(payload);
|
||||
return buffer.array();
|
||||
}
|
||||
|
||||
private void sendToChannel(String channel, byte[] payload) {
|
||||
subscriptionManager.getSubscribedSessions(channel).stream()
|
||||
.filter(WebSocketSession::isOpen)
|
||||
.forEach(session -> {
|
||||
try {
|
||||
// Spring原生WebSocketSession不允许多个线程并发发送。
|
||||
synchronized (session) {
|
||||
session.sendMessage(new BinaryMessage(payload));
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("频道{}消息发送失败: {}", channel, e.getMessage());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private byte[] compress(byte[] data) throws IOException {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
try (GZIPOutputStream gzip = new GZIPOutputStream(baos)) {
|
||||
@ -68,4 +187,42 @@ public class MessagePushService {
|
||||
}
|
||||
return baos.toByteArray();
|
||||
}
|
||||
|
||||
private static final class MediaBootstrap {
|
||||
private final ByteArrayOutputStream data = new ByteArrayOutputStream(64 * 1024);
|
||||
private byte[] initSegment;
|
||||
|
||||
private synchronized void accept(byte[] chunk) {
|
||||
if (initSegment != null || data.size() >= MAX_MEDIA_INIT_SIZE) {
|
||||
return;
|
||||
}
|
||||
data.write(chunk, 0, Math.min(chunk.length, MAX_MEDIA_INIT_SIZE - data.size()));
|
||||
byte[] combined = data.toByteArray();
|
||||
int moofTypeOffset = findAscii(combined, "moof");
|
||||
if (moofTypeOffset >= 4) {
|
||||
initSegment = Arrays.copyOf(combined, moofTypeOffset - 4);
|
||||
}
|
||||
}
|
||||
|
||||
private synchronized byte[] getInitSegment() {
|
||||
return initSegment == null ? null : initSegment.clone();
|
||||
}
|
||||
|
||||
private static int findAscii(byte[] data, String text) {
|
||||
byte[] target = text.getBytes(StandardCharsets.US_ASCII);
|
||||
for (int index = 0; index <= data.length - target.length; index++) {
|
||||
boolean matched = true;
|
||||
for (int offset = 0; offset < target.length; offset++) {
|
||||
if (data[index + offset] != target[offset]) {
|
||||
matched = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (matched) {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,57 @@
|
||||
package com.cmvr.framework.mybatisPlus;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertNull;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.mapping.SqlCommandType;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import com.cmvr.common.core.domain.BaseEntity;
|
||||
|
||||
class AuditFieldInterceptorTest
|
||||
{
|
||||
private final AuditFieldInterceptor interceptor =
|
||||
new AuditFieldInterceptor(new MyMetaObjectHandler());
|
||||
|
||||
@Test
|
||||
void fillsInsertAuditFieldsForNestedBatchParameters()
|
||||
{
|
||||
TestEntity first = new TestEntity();
|
||||
TestEntity second = new TestEntity();
|
||||
|
||||
interceptor.fillAuditFields(Map.of("list", List.of(first, second)), SqlCommandType.INSERT);
|
||||
|
||||
assertInsertFields(first);
|
||||
assertInsertFields(second);
|
||||
}
|
||||
|
||||
@Test
|
||||
void fillsOnlyUpdateFieldsForUpdateCommand()
|
||||
{
|
||||
TestEntity entity = new TestEntity();
|
||||
|
||||
interceptor.fillAuditFields(entity, SqlCommandType.UPDATE);
|
||||
|
||||
assertNull(entity.getCreateBy());
|
||||
assertNull(entity.getCreateTime());
|
||||
assertEquals("anonymous", entity.getUpdateBy());
|
||||
assertNotNull(entity.getUpdateTime());
|
||||
}
|
||||
|
||||
private void assertInsertFields(TestEntity entity)
|
||||
{
|
||||
assertEquals("anonymous", entity.getCreateBy());
|
||||
assertNotNull(entity.getCreateTime());
|
||||
assertEquals("anonymous", entity.getUpdateBy());
|
||||
assertNotNull(entity.getUpdateTime());
|
||||
}
|
||||
|
||||
private static class TestEntity extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package com.cmvr.framework.websocket.handler;
|
||||
|
||||
import com.cmvr.framework.websocket.manager.ChannelSubscriptionManager;
|
||||
import com.cmvr.framework.websocket.message.WSChannelSubscriptionMessage;
|
||||
import com.cmvr.framework.websocket.service.GrpcClientService;
|
||||
import com.cmvr.framework.websocket.service.MessagePushService;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.never;
|
||||
import static org.mockito.Mockito.timeout;
|
||||
import static org.mockito.Mockito.verify;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
class ChannelSubscriptionMessageHandlerTest {
|
||||
|
||||
@Test
|
||||
void simpleChannelOnlySubscribesLocally() throws Exception {
|
||||
ChannelSubscriptionManager subscriptionManager = new ChannelSubscriptionManager();
|
||||
GrpcClientService grpcClientService = mock(GrpcClientService.class);
|
||||
MessagePushService messagePushService = mock(MessagePushService.class);
|
||||
WebSocketSession session = session("user-1");
|
||||
ChannelSubscriptionMessageHandler handler =
|
||||
new ChannelSubscriptionMessageHandler(subscriptionManager, grpcClientService, messagePushService);
|
||||
|
||||
handler.handle(session, message("subscribe", "notifications"));
|
||||
|
||||
assertTrue(subscriptionManager.getSubscribedSessions("notifications").contains(session));
|
||||
verify(grpcClientService, never()).send(
|
||||
org.mockito.ArgumentMatchers.anyBoolean(),
|
||||
org.mockito.ArgumentMatchers.anyString(),
|
||||
org.mockito.ArgumentMatchers.anyString(),
|
||||
org.mockito.ArgumentMatchers.anyString(),
|
||||
org.mockito.ArgumentMatchers.anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void grpcChannelSubscribesLocallyAndStartsRemoteSubscription() throws Exception {
|
||||
ChannelSubscriptionManager subscriptionManager = new ChannelSubscriptionManager();
|
||||
GrpcClientService grpcClientService = mock(GrpcClientService.class);
|
||||
MessagePushService messagePushService = mock(MessagePushService.class);
|
||||
WebSocketSession session = session("user-1");
|
||||
ChannelSubscriptionMessageHandler handler =
|
||||
new ChannelSubscriptionMessageHandler(subscriptionManager, grpcClientService, messagePushService);
|
||||
String channel = "camera/stream/terminal-1/device-1";
|
||||
|
||||
handler.handle(session, message("subscribe", channel));
|
||||
|
||||
assertTrue(subscriptionManager.getSubscribedSessions(channel).contains(session));
|
||||
verify(grpcClientService, timeout(1_000)).send(
|
||||
true, "terminal-1", "device-1", "camera", "stream");
|
||||
}
|
||||
|
||||
private static WSChannelSubscriptionMessage message(String action, String channel) {
|
||||
WSChannelSubscriptionMessage message = new WSChannelSubscriptionMessage();
|
||||
message.setAction(action);
|
||||
message.setChannel(channel);
|
||||
return message;
|
||||
}
|
||||
|
||||
private static WebSocketSession session(String userId) {
|
||||
WebSocketSession session = mock(WebSocketSession.class);
|
||||
Map<String, Object> attributes = new HashMap<>();
|
||||
attributes.put("userId", userId);
|
||||
when(session.getAttributes()).thenReturn(attributes);
|
||||
return session;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,46 @@
|
||||
package com.cmvr.framework.websocket.registry;
|
||||
|
||||
import com.cmvr.framework.websocket.annotation.WSMessageType;
|
||||
import com.cmvr.framework.websocket.enums.WSMessageTypeEnum;
|
||||
import com.cmvr.framework.websocket.handler.WSMessageHandler;
|
||||
import com.cmvr.framework.websocket.message.WSMessage;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
class MessageHandlerRegistryTest {
|
||||
|
||||
@Test
|
||||
void rejectsDuplicateHandlersForTheSameMessageType() {
|
||||
ApplicationContext context = mock(ApplicationContext.class);
|
||||
Map<String, Object> handlers = new LinkedHashMap<>();
|
||||
handlers.put("firstHandler", new FirstHandler());
|
||||
handlers.put("secondHandler", new SecondHandler());
|
||||
when(context.getBeansWithAnnotation(WSMessageType.class)).thenReturn(handlers);
|
||||
|
||||
MessageHandlerRegistry registry = new MessageHandlerRegistry();
|
||||
|
||||
assertThrows(IllegalStateException.class, () -> registry.setApplicationContext(context));
|
||||
}
|
||||
|
||||
@WSMessageType(value = WSMessageTypeEnum.COMMON, messageClass = WSMessage.class)
|
||||
static class FirstHandler implements WSMessageHandler<WSMessage> {
|
||||
@Override
|
||||
public void handle(WebSocketSession session, WSMessage message) {
|
||||
}
|
||||
}
|
||||
|
||||
@WSMessageType(value = WSMessageTypeEnum.COMMON, messageClass = WSMessage.class)
|
||||
static class SecondHandler implements WSMessageHandler<WSMessage> {
|
||||
@Override
|
||||
public void handle(WebSocketSession session, WSMessage message) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3,7 +3,7 @@ package com.cmvr.inspection.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cmvr.msgs.Agv;
|
||||
import cmvr.msgs.AgvUtils;
|
||||
import com.baomidou.mybatisplus.spring.service.IService;
|
||||
import com.cmvr.inspection.domain.InspectionRobot;
|
||||
import com.cmvr.inspection.domain.vo.InspectionRobotVo;
|
||||
@ -104,7 +104,7 @@ public interface IInspectionRobotService extends IService<InspectionRobot>
|
||||
* @param robotId 机器人ID
|
||||
* @return 机器人位置信息
|
||||
*/
|
||||
Agv.AgvPose2d getRobotRealtimeLocation(String robotId);
|
||||
AgvUtils.AgvPose2d getRobotRealtimeLocation(String robotId);
|
||||
|
||||
/**
|
||||
* 导航到指定位置(坐标)
|
||||
|
||||
@ -5,7 +5,7 @@ import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import cmvr.msgs.Agv;
|
||||
import cmvr.msgs.AgvUtils;
|
||||
import com.baomidou.mybatisplus.spring.service.impl.ServiceImpl;
|
||||
import com.cmvr.common.utils.SecurityUtils;
|
||||
import com.cmvr.device.domain.DeDeviceTerminalConfig;
|
||||
@ -278,7 +278,7 @@ public class InspectionRobotServiceImpl extends ServiceImpl<InspectionRobotMappe
|
||||
|
||||
try {
|
||||
// 获取运行时状态(包含电池、位置等信息)
|
||||
Agv.AgvRuntimeState runtimeState = edgeAgvService.getRuntimeState(edgeCommonVO);
|
||||
AgvUtils.AgvRuntimeState runtimeState = edgeAgvService.getRuntimeState(edgeCommonVO);
|
||||
|
||||
// 设置电池电量
|
||||
if (runtimeState.hasBattery()) {
|
||||
@ -287,7 +287,7 @@ public class InspectionRobotServiceImpl extends ServiceImpl<InspectionRobotMappe
|
||||
|
||||
// 设置位置信息
|
||||
if (runtimeState.hasPose()) {
|
||||
Agv.AgvPose2d pose = runtimeState.getPose();
|
||||
AgvUtils.AgvPose2d pose = runtimeState.getPose();
|
||||
robot.setCurrentPosition(pose.getX() + "," + pose.getY() + "," + pose.getTheta());
|
||||
}
|
||||
|
||||
@ -309,7 +309,7 @@ public class InspectionRobotServiceImpl extends ServiceImpl<InspectionRobotMappe
|
||||
* @return 机器人位置信息
|
||||
*/
|
||||
@Override
|
||||
public Agv.AgvPose2d getRobotRealtimeLocation(String robotId)
|
||||
public AgvUtils.AgvPose2d getRobotRealtimeLocation(String robotId)
|
||||
{
|
||||
InspectionRobot robot = inspectionRobotMapper.selectInspectionRobotById(robotId);
|
||||
if (robot == null) {
|
||||
@ -320,7 +320,7 @@ public class InspectionRobotServiceImpl extends ServiceImpl<InspectionRobotMappe
|
||||
edgeCommonVO.setTerminalId(robot.getTerminalId());
|
||||
edgeCommonVO.setDeviceId(robot.getRobotCode());
|
||||
|
||||
Agv.AgvRuntimeState runtimeState = edgeAgvService.getRuntimeState(edgeCommonVO);
|
||||
AgvUtils.AgvRuntimeState runtimeState = edgeAgvService.getRuntimeState(edgeCommonVO);
|
||||
return runtimeState.hasPose() ? runtimeState.getPose() : null;
|
||||
}
|
||||
|
||||
@ -345,7 +345,7 @@ public class InspectionRobotServiceImpl extends ServiceImpl<InspectionRobotMappe
|
||||
}
|
||||
|
||||
// 构建目标位姿
|
||||
Agv.AgvPose2d pose = Agv.AgvPose2d.newBuilder()
|
||||
AgvUtils.AgvPose2d pose = AgvUtils.AgvPose2d.newBuilder()
|
||||
.setX(x)
|
||||
.setY(y)
|
||||
.setTheta(theta != null ? theta : 0.0)
|
||||
@ -380,7 +380,7 @@ public class InspectionRobotServiceImpl extends ServiceImpl<InspectionRobotMappe
|
||||
edgeCommonVO.setTerminalId(robot.getTerminalId());
|
||||
edgeCommonVO.setDeviceId(robot.getRobotCode());
|
||||
|
||||
Agv.AgvMapDimension mapDimension = Agv.AgvMapDimension.forNumber(dimension);
|
||||
AgvUtils.AgvMapDimension mapDimension = AgvUtils.AgvMapDimension.forNumber(dimension);
|
||||
return edgeAgvService.startMapping(edgeCommonVO, mapDimension, mapName, realTime);
|
||||
}
|
||||
|
||||
|
||||
@ -35,6 +35,8 @@ public enum ActionEnum {
|
||||
NONE("NONE", "NONE", "无操作"),
|
||||
|
||||
// 设备行为
|
||||
DEVICE_EXECUTE_JSON_COMMAND("EDGE", "DEVICE_EXECUTE_JSON_COMMAND", "执行设备通用指令"),
|
||||
|
||||
// ---------------相机---------------
|
||||
CAMERA_START("EDGE", "CAMERA_START", "启动相机"),
|
||||
CAMERA_STOP("EDGE", "CAMERA_STOP", "停止相机"),
|
||||
@ -67,6 +69,7 @@ public enum ActionEnum {
|
||||
|
||||
// --------------- agv ---------------
|
||||
AGV_MOVE_TO_POINT("EDGE", "AGV_MOVE_TO_POINT", "移动到指定点"),
|
||||
AGV_MOVE_TO_STATION("EDGE", "AGV_MOVE_TO_STATION", "移动到指定站点"),
|
||||
|
||||
// 大模型行为
|
||||
// ---------------获取触控坐标---------------
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
package com.cmvr.test.flow.runtime.operator.edge;
|
||||
|
||||
import cmvr.msgs.Agv;
|
||||
import cmvr.msgs.AgvUtils;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.edge.client.model.EdgeCommonVO;
|
||||
@ -59,7 +59,7 @@ public class EdgeAgvOperateService implements EdgeOperateService {
|
||||
}
|
||||
|
||||
// 构建目标位姿
|
||||
Agv.AgvPose2d pose = Agv.AgvPose2d.newBuilder()
|
||||
AgvUtils.AgvPose2d pose = AgvUtils.AgvPose2d.newBuilder()
|
||||
.setX(x)
|
||||
.setY(y)
|
||||
.setTheta(theta != null ? theta : 0.0)
|
||||
@ -78,6 +78,20 @@ public class EdgeAgvOperateService implements EdgeOperateService {
|
||||
break;
|
||||
}
|
||||
|
||||
case AGV_MOVE_TO_STATION: {
|
||||
String stationId = inputParams.getString("stationId");
|
||||
if (stationId == null || stationId.trim().isEmpty()) {
|
||||
throw new GlobalException("站点ID(stationId)不能为空");
|
||||
}
|
||||
|
||||
EdgeCommonVO edgeCommonVO = new EdgeCommonVO();
|
||||
edgeCommonVO.setTerminalId(terminalId);
|
||||
edgeCommonVO.setDeviceId(deviceId);
|
||||
edgeAgvService.navigateToStation(edgeCommonVO, stationId.trim());
|
||||
log.info("AGV移动到指定站点任务下发成功,设备ID: {},站点ID: {}", deviceId, stationId);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
throw new GlobalException("不支持的AGV操作类型: " + action);
|
||||
}
|
||||
|
||||
@ -0,0 +1,92 @@
|
||||
package com.cmvr.test.flow.runtime.operator.edge;
|
||||
|
||||
import cmvr.api.Common;
|
||||
import com.alibaba.fastjson2.JSON;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.cmvr.common.exception.GlobalException;
|
||||
import com.cmvr.edge.client.model.system.EdgeSystemJsonCommandVO;
|
||||
import com.cmvr.edge.client.service.EdgeSystemService;
|
||||
import com.cmvr.test.enums.ActionEnum;
|
||||
import com.cmvr.test.flow.runtime.message.TaskNodeExecuteMessage;
|
||||
import com.cmvr.test.flow.runtime.message.TaskNodeExecuteResult;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/** Executes a device-specific JSON command through the edge system service. */
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EdgeDeviceCommandOperateService implements EdgeOperateService {
|
||||
|
||||
private final EdgeSystemService edgeSystemService;
|
||||
|
||||
@Override
|
||||
public boolean supports(ActionEnum action) {
|
||||
return ActionEnum.DEVICE_EXECUTE_JSON_COMMAND.equals(action);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskNodeExecuteResult execute(TaskNodeExecuteMessage message) {
|
||||
JSONObject input = message.getInputParams() == null ? new JSONObject() : message.getInputParams();
|
||||
String terminalId = StringUtils.defaultIfBlank(message.getTerminalId(), input.getString("terminalId"));
|
||||
String deviceId = StringUtils.trimToNull(input.getString("deviceId"));
|
||||
if (StringUtils.isBlank(terminalId)) {
|
||||
throw new GlobalException("终端ID(terminalId)不能为空");
|
||||
}
|
||||
if (deviceId == null) {
|
||||
throw new GlobalException("设备ID(deviceId)不能为空");
|
||||
}
|
||||
|
||||
Object rawRequest = input.get("requestJson");
|
||||
String requestJson = normalizeRequestJson(rawRequest);
|
||||
EdgeSystemJsonCommandVO request = new EdgeSystemJsonCommandVO();
|
||||
request.setTerminalId(terminalId);
|
||||
request.setDeviceId(deviceId);
|
||||
request.setRequestJson(requestJson);
|
||||
|
||||
Common.JsonDeviceCommand.Feedback feedback = edgeSystemService.executeJsonCommand(request);
|
||||
if (feedback == null || !feedback.hasHeader()) {
|
||||
throw new GlobalException("设备通用指令响应缺少状态信息");
|
||||
}
|
||||
if (!feedback.getHeader().getSuccess()) {
|
||||
throw new GlobalException(StringUtils.defaultIfBlank(
|
||||
feedback.getHeader().getErrorMessage(), "设备通用指令执行失败"));
|
||||
}
|
||||
|
||||
String responseJson = feedback.getResponseJson();
|
||||
JSONObject output = new JSONObject();
|
||||
output.put("success", true);
|
||||
output.put("errorMessage", feedback.getHeader().getErrorMessage());
|
||||
output.put("rawResponseJson", responseJson);
|
||||
output.put("responseJson", parseResponseJson(responseJson));
|
||||
return TaskNodeExecuteResult.success(output);
|
||||
}
|
||||
|
||||
private String normalizeRequestJson(Object rawRequest) {
|
||||
if (rawRequest == null) {
|
||||
throw new GlobalException("JSON指令(requestJson)不能为空");
|
||||
}
|
||||
String requestJson = rawRequest instanceof String
|
||||
? StringUtils.trim((String) rawRequest) : JSON.toJSONString(rawRequest);
|
||||
if (StringUtils.isBlank(requestJson)) {
|
||||
throw new GlobalException("JSON指令(requestJson)不能为空");
|
||||
}
|
||||
try {
|
||||
JSON.parse(requestJson);
|
||||
} catch (RuntimeException exception) {
|
||||
throw new GlobalException("JSON指令(requestJson)格式无效");
|
||||
}
|
||||
return requestJson;
|
||||
}
|
||||
|
||||
private Object parseResponseJson(String responseJson) {
|
||||
if (StringUtils.isBlank(responseJson)) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return JSON.parse(responseJson);
|
||||
} catch (RuntimeException exception) {
|
||||
return responseJson;
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user