当他们无事可做并寻找新工作时,我的车辆会随机移动,但有时,在它们碰撞之前会引发以下异常:
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()
一些错误中找到了一些评论。我想知道是否有任何解决方法?或者我有什么明显的遗漏吗?