gpt4 book ai didi

java - moveTo() 方法中的VerifyException

转载 作者:行者123 更新时间:2023-11-30 06:09:20 24 4
gpt4 key购买 nike

当我的车辆无事可做并寻找新工作时,它们会随机移动,但有时,在它们发生碰撞之前会引发以下异常:

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() 遵循路径。我还从 AgvAgentAgvExample 类复制了一些代码,但即使它适用于它们,但在我的情况下却不起作用。我确实在 GraphRoadModelImpl.doFollowPath() 中找到了一些关于一些错误的评论。我想知道是否有任何解决方法?或者我缺少什么明显的东西吗?

最佳答案

事实证明,RinSim 中存在与导致此行为的舍入错误相关的错误。此错误已于RinSim v4.4.6起修复.

关于java - moveTo() 方法中的VerifyException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50608968/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com