check_path_to_goal()
  • 1 Minute to read

check_path_to_goal()


Article summary

Check if there is a path to a given coordinate.

Reference

Arguments

ArgumentsTypeDefault valueDescription
xfloatX-coordinate of the goal.
yfloatY-coordinate of the goal.
in_map_coordinatesboolFalseWhether the coordinates are in map coordinates or pixels.

Return

TypeDescription
boolValue indicating whether there is path to goal.

Exceptions

  • RayaNavNotLocated
  • RayaNavNoMapLoaded
  • RayaNavUnkownError

See the complete list of navigation exceptions.

Usage Example

...
class RayaApplication(RayaApplicationBase):

    async def setup(self):
        self.nav = await self.enable_controller('navigation')
        self.costmap_image, self.map_info = await self.nav.get_costmap()
        ....
        
    async def loop(self):
     ....
        path_to_zero_position = await self.navigation.check_path_to_goal(
                x=0.0, 
                y=0.0, 
                in_map_coordinates=True
            )
        self.log.info((
                'Exists path to zero coordinate =' 
                f'{path_to_zero_position}'
            ))
      ...
      
    async def finish(self):
      ...

See the nav_all_unity_apartment to check some valid uses.


Was this article helpful?

What's Next