ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question
1

AMCL cannot publish a pose or update the transform. Please set the initial pose...

asked 2022-05-23 14:54:54 -0600

Woz gravatar image

updated 2022-05-23 15:03:44 -0600

I'm a ROS2 n00b trying to learn navigation2. I have a lot of experience with ROS1's navigation stack but am having basic issues with navigation2. I'm running ROS2 galactic built from source on an NVidia Jetson Xavier NX running Ubuntu 18.04.6 LTS bionic. I'm currently have an issue where AMCL doesn't publish the map->odom transform. This message gets printed every 2 seconds:

AMCL cannot publish a pose or update the transform. Please set the initial pose...

I'm not sure what AMCL is asking for here. How can I set an initial pose if map->odom isn't defined? I have an initial pose of 0, 0, 0, 0 set in my config and what seems to be a valid map. One thing that confuses me is why the map_server only publishes the map once when it launches and never again. Could this be part of the problem?

I'm launching navigation2 with their localization bring up launch file: nav2_bringup/launch/localization_launch.py

rqt_graph:

image description

tf tree:

image description

Link to launch file in question:

https://github.com/frc-88/tj2_ros/blo...

Full terminal output:

[INFO] [launch]: All log files can be found below /home/tj2/.ros/log/2022-05-23-15-43-07-215734-porygon2-18955
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [map_server-1]: process started with pid [18963]
[INFO] [amcl-2]: process started with pid [18964]
[INFO] [lifecycle_manager-3]: process started with pid [18965]
[lifecycle_manager-3] [INFO] [1653334989.312059616] [lifecycle_manager_localization]: Creating
[lifecycle_manager-3] [INFO] [1653334989.362775040] [lifecycle_manager_localization]: Creating and initializing lifecycle service clients
[lifecycle_manager-3] [INFO] [1653334989.473732992] [lifecycle_manager_localization]: Starting managed nodes bringup...
[lifecycle_manager-3] [INFO] [1653334989.473970336] [lifecycle_manager_localization]: Configuring map_server
[map_server-1] [INFO] [1653334989.629669088] [map_server]: 
[map_server-1]  map_server lifecycle node launched. 
[map_server-1]  Waiting on external lifecycle transitions to activate
[map_server-1]  See https://design.ros2.org/articles/node_lifecycle.html for more information.
[map_server-1] [INFO] [1653334989.630390592] [map_server]: Creating
[map_server-1] [INFO] [1653334989.646481792] [map_server]: Configuring
[map_server-1] [INFO] [map_io]: Loading yaml file: /home/tj2/ros2_ws/install/tj2_navigation/share/tj2_navigation/maps/map_1653284131.yaml
[map_server-1] [DEBUG] [map_io]: resolution: 0.05
[map_server-1] [DEBUG] [map_io]: origin[0]: -4.07
[map_server-1] [DEBUG] [map_io]: origin[1]: -6
[map_server-1] [DEBUG] [map_io]: origin[2]: 0
[map_server-1] [DEBUG] [map_io]: free_thresh: 0.25
[map_server-1] [DEBUG] [map_io]: occupied_thresh: 0.65
[map_server-1] [DEBUG] [map_io]: mode: trinary
[map_server-1] [DEBUG] [map_io]: negate: 0
[map_server-1] [INFO] [map_io]: Loading image_file: /home/tj2/ros2_ws/install/tj2_navigation/share/tj2_navigation/maps/map_1653284131.pgm
[map_server-1] [DEBUG] [map_io]: Read map /home/tj2/ros2_ws/install/tj2_navigation/share/tj2_navigation/maps/map_1653284131.pgm: 206 X 187 map @ 0.05 m/cell
[amcl-2] [INFO] [1653334989.724978304] [amcl]: 
[amcl-2]    amcl lifecycle node launched. 
[amcl-2]    Waiting on external lifecycle transitions to activate
[amcl-2]    See https://design.ros2.org/articles/node_lifecycle.html for more information.
[amcl-2] [INFO] [1653334989.725556160] [amcl]: Creating
[lifecycle_manager-3] [INFO] [1653334989.760930624] [lifecycle_manager_localization]: Configuring amcl
[amcl-2] [INFO] [1653334989.824301664] [amcl]: Configuring
[amcl-2] [INFO] [1653334989.826404096] [amcl]: initTransforms
[amcl-2] [INFO] [1653334989.899745056] [amcl]: initPubSub
[amcl-2] [INFO] [1653334989.917563232] [amcl]: Subscribed to map topic.
[lifecycle_manager-3] [INFO] [1653334989.936369088] [lifecycle_manager_localization]: Activating map_server
[map_server-1] [INFO] [1653334989.938350944] [map_server]: Activating
[map_server-1] [INFO] [1653334989.941107424] [map_server]: Creating bond (map_server) to lifecycle ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2022-05-24 08:48:26 -0600

Joe28965 gravatar image

updated 2022-05-24 08:52:42 -0600

AMCL wants to know where the robot is located in the map. That will be its initial position and from which it starts map->odom transform.

You can do this by using RViz2 and choosing 2D Pose Estimate or by directly publishing on a topic called initial_pose or initial_position something like that. Check your topic list to find the exact topic and message type.

EDIT: There is a third way of setting the initial pose, by setting it as a parameter. Except you need to change set_initial_pose to true in line 18 of your config file.

You can find the list of parameters for AMCL here with the description of set_initial_pose as:

Description
    Causes AMCL to set initial pose from the initial_pose* parameters instead of waiting for the initial_pose message.
edit flag offensive delete link more

Comments

Setting the set_initial_pose to true fixed my original issue. I have a new issue now, AMCL is crashing with no error message. It seems to crash when it resamples. I've tried a few different config files with the same result: [ERROR] [amcl-2]: process has died [pid 14225, exit code -11, cmd '/home/tj2/ros2_galactic/install/nav2_amcl/lib/nav2_amcl/amcl --ros-args -r __node:=amcl --params-file /tmp/tmp1agefuly -r /tf:=tf -r /tf_static:=tf_static']. Is there a way to get more debug information than that? I tried to build with debug but it didn't seem to change anything: colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Debug --packages-select nav2_amcl --allow-overriding nav2_amcl

Woz gravatar image Woz  ( 2022-05-27 23:45:33 -0600 )edit

Ok, I've fixed my issue with AMCL crashing. I'm on galactic and changed this parameter from: robot_model_type: nav2_amcl::OmniMotionModel

to

robot_model_type: omnidirectional

Woz gravatar image Woz  ( 2022-05-28 00:21:27 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-05-23 14:54:54 -0600

Seen: 77 times

Last updated: May 24