当他们无事可做时,我的车辆将随机移动并寻找新的工作,但有时候,他们会在碰撞以下异常之前提出:
Exception in thread "Thread-0" com.google.common.base.VerifyException: [(14.11111111111111,0.0), (16.0,0.0), -0.36111111111111116]
at com.google.common.base.Verify.verify(Verify.java:462)
at com.github.rinde.rinsim.core.model.road.CollisionGraphRoadModelImpl.computeTravelableDistance(CollisionGraphRoadModelImpl.java:138)
at com.github.rinde.rinsim.core.model.road.GraphRoadModelImpl.doFollowPath(GraphRoadModelImpl.java:178)
at com.github.rinde.rinsim.core.model.road.CollisionGraphRoadModelImpl.doFollowPath(CollisionGraphRoadModelImpl.java:82)
at com.github.rinde.rinsim.core.model.road.AbstractRoadModel.moveTo(AbstractRoadModel.java:133)
at com.github.rinde.rinsim.core.model.road.AbstractRoadModel.moveTo(AbstractRoadModel.java:102)
at project.agents.AgvAgent.movementTick(AgvAgent.java:281)
at project.agents.AgvAgent.tickImpl(AgvAgent.java:213)
at com.github.rinde.rinsim.core.model.pdp.Vehicle.tick(Vehicle.java:55)
at com.github.rinde.rinsim.core.model.time.TimeModel.tickImpl(TimeModel.java:139)
at com.github.rinde.rinsim.core.model.time.SimulatedTimeModel.doStart(SimulatedTimeModel.java:32)
at com.github.rinde.rinsim.core.model.time.TimeModel.start(TimeModel.java:94)
at com.github.rinde.rinsim.ui.SimulationViewer$5.run(SimulationViewer.java:401)
以下是移动到目的地的代码(tickImpl方法的一部分)以及用于选择新目的地和路径的代码:
CollisionGraphRoadModelImpl model = (CollisionGraphRoadModelImpl) getRoadModel();
if (!randomDestination.isPresent()) {
nextRandomDestination(model);
}
getRoadModel().moveTo(this, randomDestination.get(), time);
if (model.getPosition(this).equals(randomDestination.get())) {
nextRandomDestination(model);
}
void nextRandomDestination(CollisionGraphRoadModelImpl model) {
randomDestination = Optional.of(model.getRandomPosition(rng));
Point end = randomDestination.get();
Point start = model.getPosition(this);
if (model.getConnection(this).isPresent()) {
start = model.getConnection(this).get().to();
}
randomPath = new LinkedList<>(model.getShortestPathTo(start, end));
}
我尝试移动到关键点以及跟随RoadModel.followPath()
的路径。我还复制了AgvAgent
和AgvExample
类中的一些代码,但即使它适用于它们,它在我的情况下也不起作用。我确实在GraphRoadModelImpl.doFollowPath()
中找到了一些关于一些错误的评论。我想知道是否有任何解决方法?或者是否有一些我不知道的明显事物?