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