Robotics StackExchange | Archived questions

AMCL doesn't move from initial position

Hello,

I'm trying to do an AMCL localization for a pre-created map. AMCL should take laserScan played back from .bag file (containing 2 lasers that are combined into /scan_multi). Issue is that AMCL doesn't seem to do anything, even though odometry works and TF tree should be linked correctly.

Tried also for different initial positions specified from launch file, all of which are correctly represented on map in rviz.

Parts of my launch file that might be relevant:

<arg name="map_file" default="$(find project2)/map/map.yaml"/>
<node name="map_server" pkg="map_server" type="map_server" args="$(arg map_file)" />

<node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.0 0.0 0.0 0.0 /map /odom 40" />

<node pkg="tf" type="static_transform_publisher" name="odom_to_base_footprint" args="0.0 0.0 0.0 0.0 0.0 0.0 /odom /base_footprint 40" />

<node pkg="tf" type="static_transform_publisher" name="base_footprint_base_link" args="0.0 0.0 0.0 0.0 0.0 0.0 /base_footprint /base_link 40" />


<arg name="scan_topic"     default="scan"/>
<arg name="initial_pose_x" default="0.0"/>
<arg name="initial_pose_y" default="0.0"/>
<arg name="initial_pose_a" default="0.0"/>

<node pkg="amcl" type="amcl" name="amcl">


<param name="initial_pose_x"            value="$(arg initial_pose_x)"/>
<param name="initial_pose_y"            value="$(arg initial_pose_y)"/>
<param name="initial_pose_a"            value="$(arg initial_pose_a)"/>

<param name="odom_frame_id"             value="odom"/>
<param name="base_frame_id"             value="base_footprint"/>
<param name="frame_id"                  value="base_link"/>
<param name="map_frame_id"              value="map"/>
<param name="use_map_topic"             value="true"/>
<remap from="map"                       to="/map"/>
<remap from="scan"                      to="scan_multi"/> 
</node>

Structure of TF tree: /map -> /odom -> /basefootprint -> /baselink -> /laser front

I tried using roswtf, got only 1 warning:
The following node subscriptions are unconnected: * /rviz: * /map_updates

Follow here for the whole project: https://drive.google.com/file/d/1AQz4xTyKr8AWm_8jPBNf4qZuylWosXfC/view?usp=sharing

Thanks for any help!

Asked by jakub.miklus on 2022-06-19 14:15:11 UTC

Comments

Answers

You should delete the following two lines.

<node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.0 0.0 0.0 0.0 /map /odom 40" />

<node pkg="tf" type="static_transform_publisher" name="odom_to_base_footprint" args="0.0 0.0 0.0 0.0 0.0 0.0 /odom /base_footprint 40" />

Map to Odom should be broadcast by AMCL. Odom to base_footprint should be broadcast by the mobile base driver or some other odometry. Both are not static transformations.

Asked by tianb03 on 2022-06-20 04:14:12 UTC

Comments

Plain deleting them doesn't do the trick. How should I set up dynamic broadcast?

Asked by jakub.miklus on 2022-06-20 09:26:35 UTC

AMCL is by default publishing the map -> odom transformation. You need to check whether your mobile base system is publishing odom -> base_footprint, in your tf tree

Asked by tianb03 on 2022-06-21 04:17:03 UTC

Deleting all static transforms from .launch file all replacing them with dynamic one between /odom and /base_footprint solved the issue. You can use directly the node from src folder.

<node pkg="project2" name="odom_tf" respawn="false" type="odom_tf" output="screen"/>

Asked by jakub.miklus on 2022-06-21 01:42:39 UTC

Comments