save_zone()
  • 1 Minute to read

save_zone()


Article summary

save_zone()

Add a permanent new zone area in robotic device.
This function will allow later to use navigate_to_zone() function instead navigate_to_position().

Reference

Arguments

ArgumentsTypeDefault valueDescription
zone_namestrName of the zone to save.
pointslistList of points defining the zone, must have 2 positions.
map_namestrName of the map where the zone will be saved.
pos_unitPOSITION_UNITPOSITION_UNIT.PIXELSUnit of measurement for the points (PIXELs or METERS).
callback_feedbackCallableNoneCallable function for feedback (optional).
callback_finishCallableNoneCallable function for finish (optional).
waitboolFalseCoolean indicating whether to wait for user response (optional).

Return

True if the whole function finished with no errors.

Exceptions

  • RayaNavNoMapLoaded
  • RayaWrongArgument
  • RayaNavCurrentlyMapping
  • RayaNavUnkownError

See the complete list of navigation exceptions.

Callback Arguments

callback_feedback

ArgumentType
feedback_codeintCode for the type of feedback.
feedback_msgstrDetails regarding the feedback code (empty if no error).

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

callback_finish

ArgumentType
error_codeint
error_msgstr

Usage Example

Code:

...
class RayaApplication(RayaApplicationBase):

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

    async def loop(self):
        ...
          await self.nav.save_zone( 
                zone_name='kitchen', 
                points=[[0, 1],[1, 1],[1, 0],[0, 0]], 
                pos_unit = POSITION_UNIT.METERS
                )
            ...
            
    async def finish(self):
       ...

See the nav_get_info examples to check some valid uses.


Was this article helpful?