How do you set the initial pose for ROS AMCL navigation?

James Nishida7 min read
Other ManufacturerOther TopicTroubleshooting
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

On this ROSbot 2.0, initialize AMCL with an approximate pose on the map in RViz after confirming that only one node publishes odom to base_link; otherwise move_base cannot obtain a reliable robot pose. The reported timeout is separate from setting the initial pose: increasing the local costmap tolerance to 0.5 removed the warning in this setup, while duplicate TF publishers and AMCL update settings still need attention.

Transform chain and runtime symptoms

AMCL localizes the laser scan against the occupancy map and estimates the robot’s pose in the map frame. The navigation stack needs a usable transform from map through odom to base_link. The odometry source normally supplies odom → base_link; AMCL supplies the map-relative correction. If the initial pose has not been provided, or required transforms are missing or stale, the costmap cannot retrieve the robot pose and may cancel a reconfiguration.

Observed symptom Evidence in this setup First check
Costmap transform timeout; robot pose unavailable Global tolerance was 0.5, local tolerance 0.25; changing local to 0.5 removed the warning. Check the transform chain and timestamps, then use a local tolerance consistent with the global setting.
TF authority contention serial_node and drive_controller both reported publishing odom → base_link. Identify both publishers and leave one authoritative publisher for that transform.
Robot spins, loses track, then reaches the goal The initial AMCL settings in the launch excerpt differ from the runtime parameter summary. Check the effective AMCL parameters and localization before changing planner speed or obstacle settings.

These symptoms are related through navigation’s dependence on valid pose data, but a tolerance change does not resolve competing TF authorities or establish the correct starting pose.

Single ownership of the odometry transform

The roswtf report names two publishers for the same parent-child transform. TF consumers need one coherent authority for odom → base_link; competing publishers can provide conflicting estimates and produce unstable or time-inconsistent pose data. The shown launch file starts drive_controller, but the report also names serial_node, so inspect the other launch files and already-running nodes rather than assuming the displayed file starts everything.

  1. Prerequisite: Stop navigation and inspect the active ROS nodes and TF tree. Find which launch or driver starts serial_node and which starts drive_controller. Gate: Confirm both reported publishers are accounted for before changing the configuration.
  2. Configure the hardware setup to publish odom → base_link from only the intended odometry source. Disable or reconfigure the other publisher so it does not broadcast that same transform. Gate: Run roswtf again and confirm the duplicate-authority error is gone.
  3. Check the TF tree and transform timestamps while the robot is stationary and while it moves. Gate: Confirm a continuous, current transform chain from map to base_link before starting pose-dependent navigation.

Do not remove a publisher solely by its node name: establish which component owns the actual wheel odometry and retain the correct source.

Initial pose on the prebuilt map

With the map loaded and TF ownership corrected, use RViz’s 2D Pose Estimate tool to give AMCL an approximate starting position and heading. The launch excerpt starts map_server, AMCL, and RViz, and maps the laser through a static base_link → laser_frame transform. The reported map is 1984 × 1984 cells at 0.1 m/pixel.

  1. Prerequisite: Start the robot’s odometry and laser driver, the static laser transform, map_server, AMCL, and RViz. Confirm RViz displays the intended map and the laser scan aligns with nearby walls. Gate: If the map or scan is absent, fix the map/topic/frame configuration before setting a pose.
  2. Select 2D Pose Estimate in RViz. Click the robot’s approximate physical position on the map, then drag in its approximate heading direction. This provides AMCL an initial estimate; it is not a substitute for correct odometry or map alignment. Gate: Confirm the estimated robot marker appears at the expected location and orientation.
  3. Watch the scan and pose estimate as the robot remains still, then moves slowly in a clear area. Gate: Confirm scans remain aligned with mapped features and the pose estimate follows motion without jumping or rotating unexpectedly before commanding a goal.

Use a fresh pose estimate after startup when the robot’s starting location is not already known to AMCL. A costmap tolerance adjustment alone does not tell AMCL where the robot starts.

Costmap transform tolerance

The reported global costmap uses transform_tolerance: 0.5, while the local costmap uses 0.25. In this installation, changing the local value to 0.5 to match the global costmap removed the timeout warning, and the configuration was confirmed as the right fix. Treat that value as the demonstrated setting for this configuration, not as a universal value for every robot.

  1. Prerequisite: Confirm the TF chain exists and its timestamps advance. Gate: If a transform is absent or a publisher is contending, correct that issue first; a larger tolerance cannot create a missing transform.
  2. Set move_base/local_costmap/transform_tolerance to 0.5, matching move_base/global_costmap/transform_tolerance. Gate: Restart or reload the costmap configuration and confirm the effective local value is 0.5.
  3. Observe the costmap and terminal output during robot movement. Gate: Confirm the timeout and “Could not get robot pose” warnings stop while the pose remains stable. If warnings persist, inspect the transform timestamps and frame IDs rather than increasing tolerance repeatedly.

A transform tolerance accommodates transform age during lookup; it does not synchronize clocks, repair stale timestamps, or resolve the duplicate publisher identified by roswtf.

AMCL update settings and runtime values

The launch excerpt sets update_min_d to 0.5 and update_min_a to 1.0. The runtime summary instead reports update_min_d: 0.05, update_min_a: 0.1, min_particles: 500, and odom_model_type: diff. That mismatch means the running node is not using all of the values shown in the excerpt, or another configuration is overriding them. Read the effective parameters before tuning.

For the reported spinning and localization loss, the suggested trial settings were update_min_d: 0.1, update_min_a: 0.1, min_particles: 2500, and max_particles: 10000. Smaller motion thresholds let AMCL process updates after less movement; a larger particle population can improve the range of pose hypotheses represented, at added computation cost. These are tuning values to test after TF and initial-pose checks, not a guarantee that the planner path will become faster or optimal.

  1. Prerequisite: Stabilize the TF tree, set the initial pose, and confirm scans align with the map. Gate: Record the effective parameters using the ROS parameter server; do not infer runtime values from the launch text alone.
  2. Apply the suggested update thresholds and particle bounds in the configuration actually loaded by AMCL. Gate: Read the parameters back and confirm the node reports the values intended for the trial.
  3. Repeat the same controlled movement and goal test. Gate: Compare pose tracking and spinning behavior, and monitor whether the host can keep up with the increased particle workload. Change one class of tuning at a time.

Navigation commissioning checks

The runtime summary also shows TrajectoryPlannerROS/max_vel_x: 0.2, min_vel_x: 0.1, max_vel_theta: 0.35, and controller_frequency: 10.0. These are planner/controller settings, distinct from AMCL localization settings. Since the robot eventually reaches the goal but moves slowly and sometimes spins, first establish stable localization; then compare commanded and measured motion and review the active planner limits if speed remains the issue.

  1. With the robot stationary, set the initial pose and verify map-to-robot alignment, scan alignment, and the absence of duplicate TF authority.
  2. Move the robot through a short, clear route and verify the estimated pose follows the physical motion without losing map alignment or spinning in place.
  3. Send a goal only after those checks pass. Confirm the costmaps update, the robot progresses toward the goal, and the timeout warnings remain absent.
  4. If localization is stable but motion remains slow, inspect the effective TrajectoryPlannerROS velocity parameters and compare them with commanded motion before adjusting them. Finish by repeating the same route and confirming both pose tracking and goal completion.

Frequently asked questions

How do I set the initial pose for AMCL in RViz?

Select 2D Pose Estimate, click the robot’s approximate location on the loaded map, and drag to set its heading. Confirm the scan aligns with map features before sending a navigation goal.

Why does move_base report a transform timeout after AMCL starts?

Check that the map → odom → base_link chain exists with current timestamps and one publisher owns odom → base_link. In this setup, setting the local costmap transform tolerance to 0.5 to match the global value removed the warning.

Why does a ROSbot spin or lose its AMCL pose?

First check for competing odometry TF publishers, an inaccurate initial pose, and laser/map misalignment. Then read the effective AMCL parameters; the suggested trial was update_min_d: 0.1, update_min_a: 0.1, min_particles: 2500, and max_particles: 10000.

Back to blog