This commit is contained in:
xuzhiheng 2025-06-18 10:35:01 +08:00
parent 952d0db0d1
commit 7ac42a2b80
5 changed files with 17 additions and 26 deletions

View File

@ -439,28 +439,6 @@ public class LoopbackCommunicationAdapter
getProcessModel().setState(Vehicle.State.EXECUTING); getProcessModel().setState(Vehicle.State.EXECUTING);
Step step = command.getStep(); Step step = command.getStep();
Vehicle newVehicle = vehicleService.fetchObject(Vehicle.class, getProcessModel().getName());
List<Set<TCSResourceReference<?>>> allocatedResources = newVehicle.getAllocatedResources();
//使用副本更新车辆模型防止异常情况
List<Set<TCSResourceReference<?>>> copiedResources = new ArrayList<>(allocatedResources);
copiedResources.clear();
if (step.getSourcePoint() != null) {
//下发起点不为空
Point point = objectService.fetchObject(Point.class, step.getSourcePoint().getName());
Set<TCSResourceReference<?>> resource = new HashSet<>();
resource.add(point.getReference());
copiedResources.add(resource);
}
if (step.getPath() != null) {
Path path = objectService.fetchObject(Path.class, step.getPath().getName());
Set<TCSResourceReference<?>> resource = new HashSet<>();
resource.add(path.getReference());
copiedResources.add(resource);
}
newVehicle.withAllocatedResources(copiedResources);
if (step.getPath() == null) { if (step.getPath() == null) {
actionExec(command); actionExec(command);
} else { } else {

View File

@ -35,6 +35,8 @@ dependencies {
implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5' implementation 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
//JTS //JTS
implementation 'org.locationtech.jts:jts-core:1.18.2' implementation 'org.locationtech.jts:jts-core:1.18.2'
// https://mvnrepository.com/artifact/org.locationtech.jts.io/jts-io-common
// implementation("org.locationtech.jts.io:jts-io-common:1.20.0")
} }
processResources.doLast { processResources.doLast {

View File

@ -41,10 +41,6 @@ public class ContourAlgorithm {
}; };
// new BezierCurve()
return true; return true;
} }

View File

@ -86,6 +86,18 @@ public class VehicleHandler {
throw new ObjectUnknownException("postReceiveCallback Unknown vehicle: " + name); throw new ObjectUnknownException("postReceiveCallback Unknown vehicle: " + name);
} }
// String adapterName = "org.opentcs.virtualvehicle.LoopbackCommunicationAdapterDescription";
// VehicleCommAdapterDescription newAdapter
// = vehicleService.fetchAttachmentInformation(vehicle.getReference())
// .getAvailableCommAdapters()
// .stream()
// .filter(description -> description.getClass().getName().equals(adapterName))
// .findAny()
// .orElseThrow(
// () -> new IllegalArgumentException("Unknown vehicle driver class name: " + adapterName)
// );
// vehicleService.attachCommAdapter(vehicle.getReference(), newAdapter);
//将数据更新到线程安全的集合中防止线程阻塞 //将数据更新到线程安全的集合中防止线程阻塞
AdapterManage.setAdapterStatus(name); AdapterManage.setAdapterStatus(name);
if (type == 1) { //上报agv详细信息 if (type == 1) { //上报agv详细信息

View File

@ -849,6 +849,7 @@ public class DefaultVehicleController
); );
if (Objects.equals(evt.getPropertyName(), VehicleProcessModel.Attribute.POSITION.name())) { if (Objects.equals(evt.getPropertyName(), VehicleProcessModel.Attribute.POSITION.name())) {
System.out.println("Position changed updateVehiclePosition");
updateVehiclePosition((String) evt.getNewValue()); updateVehiclePosition((String) evt.getNewValue());
} }
else if (Objects.equals( else if (Objects.equals(
@ -1002,9 +1003,11 @@ public class DefaultVehicleController
vehicle.getName(), vehicle.getName(),
point point
); );
System.out.println("update position updatePositionWithoutOrder 999999");
updatePositionWithoutOrder(point); updatePositionWithoutOrder(point);
} }
else { else {
System.out.println("update position updatePositionWithOrder 0000");
updatePositionWithOrder(point); updatePositionWithOrder(point);
} }
} }