I have this code within a classless function:
while room.getNumCleanedTiles() < min_coverage * room.getNumTiles():
for index in range(0, len(roboList)):
room.cleanTileAtPosition(positionList[index])
roboList[index].updatePositionAndClean()
positionList[index] = roboList[index].getRobotPosition
count += 1
positionListis a list of positions of the classPosition.- The
positionclass has two methods,getXandgetY. - The
roomvariable is a room of classRectangular Room, which has a method known ascleanTileAtPosition, which takes a position as its argument and does some operations using thegetX()andgetY()methods.
The code is too large to reasonably attach here in its entirety, but the problem seems to be localized to the methods and classes I have described. I am getting an error that states:
"AttributeError: 'function' object has no attribute 'getX.'"
However, through print statements it is clear that positionList[index] is indeed a position of class Position; that room is a RectangularRoom; and that getX() and getY() work on the position when they are called independently of the cleanTileAtPosition.
Is there anything about this code that seems like it would raise the error I am getting?
add
()after getRobotPosition.