set_map()
  • 1 Minute to read

set_map()


Article summary

set_map()

Activates a specific map.

In order to navigate and localize the robot, we must use this function and set the correct map of the environment.

Reference

Arguments

ArgumentsTypeDefault value
map_namestrName of the map.
wait_localizationboolFalseWhether to wait for localization before returning.
timeoutfloat0.0Timeout duration for localization waiting (in seconds).
callback_feedbackCallableNoneCallable function for feedback (optional).
callback_finishCallableNoneCallable function for finish (optional).
waitboolFalseBoolean indicating whether to wait for user response (optional).
optionsobjectAdditional options for setting the map.

Return

If wait_location would return True if the robot is localized. If wait_location is False it will return true if the map changed correctly.

Exceptions

  • RayaWrongArgument
  • RayaNavUnknownMapName
  • RayaNavCurrentlyMapping

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_localized = await self.nav.set_map(
                map_name=self.map_name, 
                wait_localization=True, 
                timeout=3.0,
                callback_feedback=self.cb_set_map_feedback,
                callback_finish=self.cb_set_map_finish
            )
        if not robot_localized:
            self.log.error(f'Robot couldn\'t localize itself')
            self.finish_app()
        ...

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


Was this article helpful?

What's Next