Jakub Mikluš
Jakub Mikluš

Reputation: 21

ROS1: AMCL doesn't move from initial position

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 -> /base_footprint -> /base_link -> /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/1AQz4...

Thanks for any help!

Upvotes: 0

Views: 839

Answers (1)

Jakub Mikluš
Jakub Mikluš

Reputation: 21

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

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

Upvotes: 1

Related Questions