I dynamically generated crane markup in code and used the MoveByCrane block to control crane selection, with a custom priority logic for crane assignment.
double scaleUnit = scale.pixelsPerUnit(METER);
List cranes = new ArrayList();
this.models.addAll(devices);
// 天车安全间隔
final double safetyGap = 1.5d;
for (DeviceModel device: devices) {
if (device.getType()!=DeviceModel.Type.OVERHEAD_CRANE) {
continue;
}
if (!device.getEnable()) continue;
device.setRotationCenter(DeviceModel.RotationCenter.TOP_LEFT);
var pos = device.getPosition();
List bridgeDevices = devices.stream().filter(e->e.getType()==DeviceModel.Type.CRANE_BRIDGE && e.getParentId().equals(device.getId())).collect(Collectors.toList());
if (bridgeDevices.isEmpty()) Logger.error("The bridge of the overhead crane("+device.getId()+") is empty, please check the configuration");
// 桥
List bridges = new ArrayList();
List bridgeOffsets = new ArrayList();
for (DeviceModel bridgeDevice: bridgeDevices) {
// 桥的位置、车的位置、桥的颜色
double bridgeLocation = device.getPosition().distance(bridgeDevice.getPosition());
bridgeOffsets.add(bridgeLocation);
OverheadCraneBridge bridge = new OverheadCraneBridge(bridgeLocation, device.getWidth()/2, goldenRod);
bridges.add(bridge);
bridgeStatusListMap.put(bridge, new ArrayList());
craneModelMap.put(bridge, bridgeDevice);
idCraneMap.put(bridgeDevice.getId(), bridge);
}
// 天车
OverheadCraneDescriptor descriptor = buildCraneDescriptor(device);
OverheadCrane crane = new OverheadCrane(this, SHAPE_DRAW_2D3D, true, true, descriptor,
pos.getX()*scaleUnit, pos.getY()*scaleUnit, pos.getZ()*scaleUnit, pos.getYaw()*PI/180,
// 轨道长度,吊车宽度,吊车高度
device.getLength(), device.getWidth(), device.getHeight(),
// 桥架宽度,桥架安全间隙
2, safetyGap,
// 轨道颜色,车颜色
lightSlateGray, gray,
// OVERHEAD_CRANE_GANTRY, OVERHEAD_CRANE_GIRDER_DOUBLE_TIE,
OVERHEAD_CRANE_BRIDGE, OVERHEAD_CRANE_GIRDER_DOUBLE_TIE,
bridges.toArray(OverheadCraneBridge[]::new)
);
// OVERHEAD_CRANE_MOVEMENT_STEP_BY_STEP,OVERHEAD_CRANE_MOVEMENT_CONCURRENT, OVERHEAD_CRANE_MOVEMENT_INDEPENDENT_HOIST
crane.setMovementMode(OVERHEAD_CRANE_MOVEMENT_INDEPENDENT_HOIST);
crane.setAccelerationEnabled(descriptor._accelerationEnabled_DefaultValue_xjal());
// 检查安全距离
bridgeOffsets.sort(Comparator.naturalOrder());
double lastOffset = bridgeOffsets.get(0);
for (int i=1; i
When the number of crane tasks increases, an error "No feasible target for bridge" occurs during the "On seize crane" action of the MoveByCrane block. I haven’t found any logical issues in my implementation.
Could you please advise how to diagnose the root cause of this error?
Additionally,
- the same error still occurs even when I do not customize the crane selection priority!
- the error still occurs regardless of whether I set the crane selection to return type
OverheadCraneorOverheadCraneBridge!


