AI Robot Programming Problem

Hi!
Our team is working on the programming of AI robots and encountered a problem: How to correctly detect and obtain the position of Triball in real time? This code on Github for detecting Triball in real time doesn’t seem to be accurate every time.

Why is the target not found when target.mapLocation.x == 0 && target.mapLocation.y == 0? When the position is (0, 0), shouldn’t the Triball be in the center of the field?

Thank you!

I haven’t looked at the code very extensively, but I’m going to assume target.mapLocation is the location of the triball on the field. (0, 0) would be in the very top-left corner, even on the wall depending on the dimensions. If no triball is found, the values x and y stay at their default, which is 0. If a distance sensor is being used for seeing the triballs (0,0) could also be the top-left of the sensor, which depending on the position of the sensor could be up in the sky. In conclusion, without disecting the code, it’s because the default values of (0, 0) haven’t been changed.

I forgot to specify that in computers (0,0) is top left, not middle