Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions nav2_simple_commander/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ See its [API Guide Page](https://navigation.ros.org/commander_api/index.html) fo

The methods provided by the basic navigator are shown below, with inputs and expected returns. If a server fails, it may throw an exception or return a `None` object, so please be sure to properly wrap your navigation calls in try/catch and check results for `None` type.

New as of September 2023: the simple navigator constructor will accept a `namespace` field to support multi-robot applications or namespaced Nav2 launches.

| Robot Navigator Method | Description |
| --------------------------------- | -------------------------------------------------------------------------- |
| setInitialPose(initial_pose) | Sets the initial pose (`PoseStamped`) of the robot to localization. |
Expand Down
14 changes: 7 additions & 7 deletions nav2_simple_commander/nav2_simple_commander/robot_navigator.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class TaskResult(Enum):

class BasicNavigator(Node):

def __init__(self, node_name='basic_navigator'):
super().__init__(node_name=node_name)
def __init__(self, node_name='basic_navigator', namespace=''):
super().__init__(node_name=node_name, namespace=namespace)
self.initial_pose = PoseStamped()
self.initial_pose.header.frame_id = 'map'
self.goal_handle = None
Expand Down Expand Up @@ -83,13 +83,13 @@ def __init__(self, node_name='basic_navigator'):
self.initial_pose_pub = self.create_publisher(PoseWithCovarianceStamped,
'initialpose',
10)
self.change_maps_srv = self.create_client(LoadMap, '/map_server/load_map')
self.change_maps_srv = self.create_client(LoadMap, 'map_server/load_map')
self.clear_costmap_global_srv = self.create_client(
ClearEntireCostmap, '/global_costmap/clear_entirely_global_costmap')
ClearEntireCostmap, 'global_costmap/clear_entirely_global_costmap')
self.clear_costmap_local_srv = self.create_client(
ClearEntireCostmap, '/local_costmap/clear_entirely_local_costmap')
self.get_costmap_global_srv = self.create_client(GetCostmap, '/global_costmap/get_costmap')
self.get_costmap_local_srv = self.create_client(GetCostmap, '/local_costmap/get_costmap')
ClearEntireCostmap, 'local_costmap/clear_entirely_local_costmap')
self.get_costmap_global_srv = self.create_client(GetCostmap, 'global_costmap/get_costmap')
self.get_costmap_local_srv = self.create_client(GetCostmap, 'local_costmap/get_costmap')

def destroyNode(self):
self.destroy_node()
Expand Down