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_position()
Get the current position of the robot.
Reference
Arguments
Arguments | Type | Default value | |
---|---|---|---|
pos_unit | POS_UNIT | POS_UNIT.PIXEL | ENUM 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_unit | ANG_UNIT | ANG_UNIT.DEG | ENUM 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
Exception | Condition |
---|---|
RayaNavNotLocated | The robot is not located on the map. |
RayaNavNotPositionReceived | an unknown error occurs. |
RayaWrongArgument | POS_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?