我们目前在RinSim上遇到仓库AGV问题。
有时在执行过程中,我们会收到以下错误:
Exception in thread "main" java.lang.NullPointerException
at com.github.rinde.rinsim.core.model.road.GraphSpatialRegistry.getConnection(GraphSpatialRegistry.java:133)
at com.github.rinde.rinsim.core.model.road.GraphRoadModelImpl.getConnection(GraphRoadModelImpl.java:478)
at com.github.rinde.rinsim.ui.renderers.AGVRenderer$VehicleUI.update(AGVRenderer.java:294)
at com.github.rinde.rinsim.ui.renderers.AGVRenderer.renderDynamic(AGVRenderer.java:98)
at com.github.rinde.rinsim.ui.SimulationViewer.paintControl(SimulationViewer.java:492)
at org.eclipse.swt.widgets.TypedListener.handleEvent(Unknown Source)
at org.eclipse.swt.widgets.EventTable.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Display.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Widget.sendEvent(Unknown Source)
at org.eclipse.swt.widgets.Composite.WM_PAINT(Unknown Source)
at org.eclipse.swt.widgets.Control.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Canvas.windowProc(Unknown Source)
at org.eclipse.swt.widgets.Display.windowProc(Unknown Source)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(Unknown Source)
at org.eclipse.swt.widgets.Display.readAndDispatch(Unknown Source)
at com.github.rinde.rinsim.ui.View.show(View.java:153)
at com.github.rinde.rinsim.core.Simulator.start(Simulator.java:186)
at Environment.run(Environment.java:136)
at Environment.main(Environment.java:61)
不会在每次执行时都发生此错误,更不用说在同一时间了(我们认为正常错误就是这种情况,因为我们对每个“随机”都使用
RandomGenerator
)。来自我们
Viewbuilder
的代码: View.Builder viewBuilder = View.builder()
.with(WarehouseRenderer.builder()
.withMargin(VEHICLE_LENGTH))
.with(AGVRenderer.builder()
.withDifferentColorsForVehicles())
.with(PDPModelRenderer.builder().withDestinationLines());
最佳答案
从RinSim v4.4.6开始,此NPE是固定的。