use of com.microsoft.Malmo.Schemas.AgentQuitFromReachingPosition in project malmo by Microsoft.
the class MazeDecoratorImplementation method recordStartAndEndPoints.
private void recordStartAndEndPoints(Cell start, Cell end, MissionInit missionInit) {
// TODO: how do we set the goal position, now it no longer has a declaration in the Mission xml?
int scale = this.mazeParams.getSizeAndPosition().getScale();
// Position the start point:
PosAndDirection p = new PosAndDirection();
p.setX(new BigDecimal(scale * (start.x + 0.5) + this.xOrg));
p.setY(new BigDecimal(1 + this.yOrg + this.startHeight));
p.setZ(new BigDecimal(scale * (start.z + 0.5) + this.zOrg));
// TODO - for the moment, force all players to being at the maze start point - but this needs to be optional.
for (AgentSection as : missionInit.getMission().getAgentSection()) {
p.setPitch(as.getAgentStart().getPlacement().getPitch());
p.setYaw(as.getAgentStart().getPlacement().getYaw());
as.getAgentStart().setPlacement(p);
}
if (this.mazeParams.getAddQuitProducer() != null) {
String desc = this.mazeParams.getAddQuitProducer().getDescription();
this.quitter = new AgentQuitFromReachingPosition();
PointWithToleranceAndDescription endpoint = new PointWithToleranceAndDescription();
endpoint.setDescription(desc);
endpoint.setTolerance(new BigDecimal(0.5 + scale / 2.0));
double endX = scale * (end.x + 0.5) + this.xOrg;
// Assuming we approach on the optimal path, need the height of the goal to be reachable.
double endY = 1 + this.optimalPathHeight + this.yOrg;
double endZ = scale * (end.z + 0.5) + this.zOrg;
endpoint.setX(new BigDecimal(endX));
endpoint.setY(new BigDecimal(endY));
endpoint.setZ(new BigDecimal(endZ));
this.quitter.getMarker().add(endpoint);
}
}
Aggregations