我正在尝试使用AgvExample
中的WarehouseRenderer
和AgvRenderer
运行实验。
我得到以下异常:
Exception in thread "main" java.lang.IllegalArgumentException: Could not resolve dependency for implementations of interface com.github.rinde.rinsim.core.model.road.CollisionGraphRoadModel, as requested by WarehouseRenderer.builder().
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:437)
at com.github.rinde.rinsim.core.model.DependencyResolver.constructDependencyGraph(DependencyResolver.java:90)
at com.github.rinde.rinsim.core.model.DependencyResolver.resolve(DependencyResolver.java:115)
at com.github.rinde.rinsim.core.model.ModelManager$Builder.build(ModelManager.java:268)
at com.github.rinde.rinsim.core.Simulator.<init>(Simulator.java:88)
at com.github.rinde.rinsim.core.Simulator$Builder.build(Simulator.java:347)
at com.github.rinde.rinsim.experiment.Experiment.init(Experiment.java:191)
at com.github.rinde.rinsim.experiment.Experiment.perform(Experiment.java:195)
at com.github.rinde.rinsim.experiment.LocalComputer$ExperimentRunner.call(LocalComputer.java:202)
at com.github.rinde.rinsim.experiment.LocalComputer$ExperimentRunner.call(LocalComputer.java:193)
at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)
at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:258)
at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:66)
at com.github.rinde.rinsim.experiment.LocalComputer.compute(LocalComputer.java:81)
at com.github.rinde.rinsim.experiment.Experiment$Builder.perform(Experiment.java:684)
at com.github.rinde.rinsim.experiment.Experiment$Builder.perform(Experiment.java:703)
at agv.ExperimentExample.main(ExperimentExample.java:197)
此错误
表示有一个渲染器附加到模拟器,该渲染器需要类型为 CollisionGraphRoadModel
的模型。只有当存在包含需要渲染的数据的相应模型时,渲染器才能正常运行。
在AgvExample
中,以下代码(请参阅第 86-90 行(用于添加所需的模型:
.addModel(
RoadModelBuilders.dynamicGraph(GraphCreator.createSimpleGraph())
.withCollisionAvoidance()
.withDistanceUnit(SI.METER)
.withVehicleLength(VEHICLE_LENGTH))
如果要在代码中使用WarehouseRenderer
,可以添加类似的代码。