get_position()
- 1 Minute to read
get_position()
- 1 Minute to read
Article summary
Did you find this summary helpful?
Thank you for your feedback
Get the current position of the robot.
Reference
Arguments
Arguments | Type | Default value | |
---|---|---|---|
pos_unit | POSITION_UNIT | POSITION_UNIT.PIXELS | Unit of measurement for the points (PIXELs or METERS). |
ang_unit | ANGLE_UNIT | ANGLE_UNIT.DEGREES | Unit of measurement for angle (DEGREES or RADIANS). |
Return
Type | Description |
---|---|
dict | A 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?