get_position()
  • 1 Minute to read

get_position()


Article summary

Get the current position of the robot.

Reference

Arguments

ArgumentsTypeDefault value
pos_unitPOSITION_UNITPOSITION_UNIT.PIXELSUnit of measurement for the points (PIXELs or METERS).
ang_unitANGLE_UNITANGLE_UNIT.DEGREESUnit of measurement for angle (DEGREES or RADIANS).

Return

TypeDescription
dictA dictionary that contains the x, y and angle position of the robot.

Exceptions

  • RayaNavNotLocated
  • RayaNavAlreadyNavigating
  • 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):
        ...
        robot_position = await self.navigation.get_position(
                    pos_unit = POS_UNIT.PIXEL, 
                    ang_unit = ANG_UNIT.DEG
                )
        self.log.info(robot_position)
        ...

Console output

{"x": 23, "y": 12, "angle":42.5}

See the Navigate to click , nav_all_unity_apartment, nav_get_info to check some valid uses.


Was this article helpful?

What's Next