implemented calculation between coordinate functions in aicontroller