navigate_to_position()
  • 1 Minute to read

navigate_to_position()


Article summary

This function allows you to navigate to the desired goal destination in an autonomous way.

Reference

Arguments

ArgumentsTypeDefault value
xfloatX-coordinate of the position.
yfloatY-coordinate of the position.
anglefloatAngle of the position.
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).
callback_feedbackCallableNoneCallable function for feedback (optional).
callback_finishCallableNoneCallable function for finish (optional).
waitboolFalseBoolean indicating whether to wait for user response (optional).

Callback Arguments

callback_feedback

ArgumentType
feedback_codeintCode for the type of feedback.
feedback_msgstrDetails regarding the feedback code (empty if no error).
distance_to_goalfloatDistance to goal in meters.
speedfloatRobot current speed.

For a complete list of feedbacks see the complete list of navigation feedbacks.

callback_finish

ArgumentType
error_codeint
error_msgstr

Return

None, unless there is callback.

Exceptions

  • RayaNavNotLocated
  • RayaNavAlreadyNavigating
  • RayaUnableToFollowPath
  • RayaUnableToComputePath
  • RayaNavUnkownError

See the complete list of navigation exceptions.

Usage Example

Code:

...
class RayaApplication(RayaApplicationBase):

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

    async def loop(self):
        ...
        await self.navigation.navigate_to_position( 
                x=5.0, 
                y=20.0, 
                angle=50.0,
                pos_unit = POS_UNIT.PIXEL, 
                ang_unit = ANG_UNIT.DEG
            )
        ...

    async def finish(self):
       ...

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


Was this article helpful?

What's Next