get_zone_center()
  • 1 Minute to read

get_zone_center()


Article summary

get_zone_center()

Retrieve the center coordintates of a specified zone.

Reference

Arguments

ArgumentsTypeDefault value
zone_namestrThe requested zone on the map.
pos_unitPOSITION_UNITPOSITION_UNIT.PIXELSUnit of measurement for the points (PIXELs or METERS).

Return

Returns
x, y = zone_center.x, zone_center.y

Exceptions

  • RayaNavNotLocated
  • RayaNavZonesNotFound
  • RayaWrongArgument
  • RayaNavUnkownError

See the complete list of navigation exceptions.

Usage Example

Code:

...
class RayaApplication(RayaApplicationBase):

    async def setup(self):
        self.nav = await self.enable_controller('navigation')
        ...

    async def loop(self):
        ...
        zone_center = await self.nav.get_zone_center(
                    zone_name=kitchen, 
                    pos_unit=POSITION_UNIT.PIXELS
                )
        self.log.info(zone_center)
        ...

See the nav_all_unity_apartment, nav_get_info to check some valid uses.


Was this article helpful?