get_position()
  • 1 Minute to read

get_position()


Article summary

get_position()

Get the current position of the robot.

Reference

Arguments

ArgumentsTypeDefault value
pos_unitPOS_UNITPOS_UNIT.PIXELENUM to determine whether the x,y values should be returned as pixels of the map image (POS_UNIT.PIXEL) or Cartesian position in meters (POS_UNIT.METERS)
ang_unitANG_UNITANG_UNIT.DEGENUM to determine whether angle should be returned as radians(ANG_UNIT.RAD) or degrees (ANG_UNIT.DEG)

Return

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

Exceptions

ExceptionCondition
RayaNavNotLocatedThe robot is not located on the map.
RayaNavNotPositionReceivedan unknown error occurs.
RayaWrongArgumentPOS_UNIT is neither pixels nor meters or ANG_UNIT is neither degrees nor radians.

See the complete list of Raya Exceptions.

Example

Code:

...
robot_position = self.navigation.get_position(pos_unit = POS_UNIT.PIXEL, ang_unit = ANG_UNIT.DEG)
print(robot_position)

Console output

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

Was this article helpful?

What's Next