Skip to content

Commit

Permalink
Add optional node names to wait (#2811)
Browse files Browse the repository at this point in the history
* add option to specify navigator and localizer to wait for

* add docs for waituntilNav2Active

* wait for pose only for amcl

* revert order
  • Loading branch information
Tony Najjar authored and SteveMacenski committed May 6, 2022
1 parent 0ecfa57 commit 996adce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nav2_simple_commander/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The methods provided by the basic navigator are shown below, with inputs and exp
| clearGlobalCostmap() | Clears the global costmap. |
| getGlobalCostmap() | Returns the global costmap, `nav2_msgs/Costmap` |
| getLocalCostmap() | Returns the local costmap, `nav2_msgs/Costmap` |
| waitUntilNav2Active() | Blocks until Nav2 is completely online and lifecycle nodes are in the active state. To be used in conjunction with autostart or external lifecycle bringup. |
| waitUntilNav2Active(navigator='bt_navigator, localizer='amcl') | Blocks until Nav2 is completely online and lifecycle nodes are in the active state. To be used in conjunction with autostart or external lifecycle bringup. Custom navigator and localizer nodes can be specified |
| lifecycleStartup() | Sends a request to all lifecycle management servers to bring them into the active state, to be used if autostart is `false` and you want this program to control Nav2's lifecycle. |
| lifecycleShutdown() | Sends a request to all lifecycle management servers to shut them down. |

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,12 @@ def getResult(self):
else:
return TaskResult.UNKNOWN

def waitUntilNav2Active(self):
def waitUntilNav2Active(self, navigator='bt_navigator', localizer='amcl'):
"""Block until the full navigation system is up and running."""
self._waitForNodeToActivate('amcl')
self._waitForInitialPose()
self._waitForNodeToActivate('bt_navigator')
self._waitForNodeToActivate(localizer)
if localizer == 'amcl':
self._waitForInitialPose()
self._waitForNodeToActivate(navigator)
self.info('Nav2 is ready for use!')
return

Expand Down

0 comments on commit 996adce

Please sign in to comment.