ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Using Nav2 with external localization source

asked 2022-11-11 08:23:17 -0500

mamado gravatar image

I would like to use Nav2 to navigate my robot from its current location to a waypoint or set of waypoints. I have an external localization computer that computes the exact location and provides the tf of map->odom->base_link to ros2. I launched the nav2_bringup with amcl and I can see my robot in RViz with no issues. I then tried to run the navigate_to_waypoint example from the nav2_simple_commander navigation package but I always get the following error:

[INFO] [1668174934.714896959] [basic_navigator]: Setting initial pose 
 [INFO] [1668174934.715584247] [basic_navigator]: Publishing Initial Pose 
 [INFO] [1668174934.716242568] [basic_navigator]: Waiting for amcl_pose to be received.

I also get the following in the nav2_bringup window:

[component_container_isolated-3] [INFO] [1668174656.886551258] [amcl]: Setting pose (1668174656.886551): 3.450 2.150 3.142

Is there anything I am missing. How can I use Nav2 to for navigation without using its internal localization.

I am using ROS2 Humble

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2022-11-11 12:05:59 -0500

updated 2022-11-11 12:07:00 -0500

Nav2 has no problem using any localizer you choose. If it provides the map to odom transformation, the rest of the system doesn't care which is used.

From [basic_navigator], that look to me like you're using the Simple Commander API. We wait for the pose to be received in the waitUntilNav2Activefunction: https://github.com/ros-planning/navig...

As you can see from the signature, you can specify the localizer node's name being used. Only when this is set to AMCL will this wait for that topic to receive a pose. Otherwise, it does not.

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

It just looks to me like you need to specify your localization node to wait for activation correctly. This is also specified in the Nav2 documentation on the API https://navigation.ros.org/commander_...

edit flag offensive delete link more

Comments

@mamado if you are running your own external global localization, you shouldn't be using AMCL at the same time. Having two ros nodes publishing the map->odom TF is going to lead to unstable localization.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2022-11-13 07:25:28 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2022-11-11 08:23:17 -0500

Seen: 368 times

Last updated: Nov 11 '22