save_location()
  • 1 Minute to read

save_location()


Article summary

save_location()

Add a permanent new location in robotic device.
This function will allow later to use navigate_to_location() function instead navigate_to_position().

Reference

Arguments

ArgumentsTypeDefault value
location_namestrThe name of the specified location.
map_namestrThe name of the map where the location will be saved.
current_poseboolFalseTrue if you want to save the current position where the robot is. In this case, the arguments x, y, angle will not be considered.
xfloatX coordinate on the map.
yfloatY coordinate on the map.
anglefloatTarget angle.
pos_unitPOSITION_UNITPOSITION_UNIT.PIXELSUnit of measurement for the points (PIXELs or METERS).
ang_unitANGLE_UNITANGLE_UNIT.DEGREESUnit of measurement of angles (DEGREES or RADIANS).

Return

True if the whole function finished with no errors.

Exceptions

  • RayaNavNoMapLoaded
  • RayaWrongArgument
  • RayaNavCurrentlyMapping
  • 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')
        self.map_name = "newmap01"
        ...

    async def loop(self):
        await self.navigation.save_location( 
                    x=1.0, 
                    y=0.5, 
                    angle=1.0,
                    location_name='new_location01', 
                    pos_unit=POS_UNIT.METERS, 
                    ang_unit=ANG_UNIT.RAD, 
                    map_name='unity_apartment'
                )
        self.log.info(f'Location saved')
        ...

    async def finish(self):
         ...

See the nav_all_unity_apartment, nav_get_info to check some valid uses.


Was this article helpful?