opt:1.叉腿避障开关 2.建图界面显示车辆坐标
This commit is contained in:
@@ -14,7 +14,9 @@ import org.springframework.web.socket.config.annotation.EnableWebSocket;
|
||||
|
||||
@EnableAsync
|
||||
@EnableScheduling
|
||||
@SpringBootApplication
|
||||
@SpringBootApplication(exclude = {
|
||||
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
|
||||
})
|
||||
@EnableTransactionManagement
|
||||
@RestController
|
||||
@MapperScan("org.nl.apt15e.**.mapper")
|
||||
|
||||
@@ -284,8 +284,8 @@ public class TeachingServiceImpl implements TeachingService {
|
||||
if (response.isOk() && response.body() != null) {
|
||||
// 获取zip包
|
||||
byte[] zipBytes = response.bodyBytes();
|
||||
File fileName = new File(mapName);
|
||||
File tempZipFile = FileUtil.writeBytes(zipBytes, FileUtil.createTempFile(fileName));
|
||||
// File fileName = new File(mapName);
|
||||
// File tempZipFile = FileUtil.writeBytes(zipBytes, FileUtil.createTempFile(fileName));
|
||||
log.info("解析地图包数据");
|
||||
processZip.processZipResponse(zipBytes);
|
||||
return zipBytes;
|
||||
|
||||
@@ -6,9 +6,7 @@ import org.nl.apt15e.apt.vehicle.service.VehicleInfoService;
|
||||
import org.nl.apt15e.common.logging.annotation.Log;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@@ -36,10 +34,10 @@ public class VehicleInfoController {
|
||||
return new ResponseEntity<>(vehicleInfoService.rebootVehicle(), HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping("/setForkLegsObstacles")
|
||||
@PostMapping("/setForkLegsObstacles")
|
||||
@Log("设置叉腿避障")
|
||||
public ResponseEntity<Object> setForkLegsObstacles() {
|
||||
return new ResponseEntity<>(vehicleInfoService.setForkLegsObstacles(), HttpStatus.OK);
|
||||
public ResponseEntity<Object> setForkLegsObstacles(@RequestParam("backIoStatus") String backIoStatus) {
|
||||
return new ResponseEntity<>(vehicleInfoService.setForkLegsObstacles(backIoStatus), HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,5 +31,5 @@ public interface VehicleInfoService {
|
||||
/**
|
||||
* 设置叉尖避障
|
||||
*/
|
||||
Map<String,Object> setForkLegsObstacles();
|
||||
Map<String,Object> setForkLegsObstacles(String backIoStatus);
|
||||
}
|
||||
|
||||
@@ -127,12 +127,12 @@ public class VehicleInfoServiceImpl implements VehicleInfoService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String,Object> setForkLegsObstacles() {
|
||||
public Map<String,Object> setForkLegsObstacles(String backIoStatus) {
|
||||
// if (StrUtil.isBlank(stationCode) || StrUtil.isBlank(stationName)){
|
||||
// throw new BadRequestException("spotCode is empty");
|
||||
// }
|
||||
JSONObject params = new JSONObject();
|
||||
params.put("enable_back_tof", true);
|
||||
params.put("enable_back_tof", backIoStatus);
|
||||
HttpResponse response = null;
|
||||
try {
|
||||
response = HTTPUtil.post(URLConstant.VEHICLE_IP_PORT,"/tool/rob/setStates", params);
|
||||
@@ -150,7 +150,7 @@ public class VehicleInfoServiceImpl implements VehicleInfoService {
|
||||
return body;
|
||||
}
|
||||
}
|
||||
log.info("关闭叉腿避障失败");
|
||||
log.info("操作叉腿避障失败");
|
||||
throw new BadRequestException(LangProcess.msg("error_set_forkLegs"));
|
||||
}
|
||||
|
||||
@@ -270,7 +270,6 @@ public class VehicleInfoServiceImpl implements VehicleInfoService {
|
||||
}
|
||||
webSocketSet.forEach(c -> {
|
||||
Map<String, Object> vehicleInfoMap = new HashMap<>();
|
||||
log.info("websocket标识:{}",c.getLang());
|
||||
VehicleInfo webVehicleInfo = vehicleInfo;
|
||||
webVehicleInfo = this.queryVehicleInfoI18n(c.getLang(),webVehicleInfo);
|
||||
vehicleInfoMap.put("data", webVehicleInfo);
|
||||
|
||||
@@ -68,8 +68,15 @@ public class ProtobufWebSocketHandler extends BinaryWebSocketHandler {
|
||||
// 电量
|
||||
VehicleInfoServiceImpl.vehicleInfo.setBatteryPower((int)robotBase.getBatteryInfo().getSoc());
|
||||
//x,y,theta
|
||||
VehicleInfoServiceImpl.vehicleInfo.setX(robotBase.getLocate().getCurrentState().getX());
|
||||
VehicleInfoServiceImpl.vehicleInfo.setY(robotBase.getLocate().getCurrentState().getY());
|
||||
|
||||
DecimalFormat xFormat = new DecimalFormat("0.000");
|
||||
String x_res = xFormat.format(robotBase.getLocate().getCurrentState().getX());
|
||||
double x = Double.parseDouble(x_res);
|
||||
VehicleInfoServiceImpl.vehicleInfo.setX(x);
|
||||
DecimalFormat yFormat = new DecimalFormat("0.000");
|
||||
String y_res = xFormat.format(robotBase.getLocate().getCurrentState().getY());
|
||||
double y = Double.parseDouble(y_res);
|
||||
VehicleInfoServiceImpl.vehicleInfo.setY(y);
|
||||
VehicleInfoServiceImpl.vehicleInfo.setTheta(robotBase.getLocate().getCurrentState().getTheta());
|
||||
// System.out.println("vehicleInfo2: " + VehicleInfoServiceImpl.vehicleInfo);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user