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

AMCL doesn't move from initial position

asked 2022-06-19 14:15:11 -0500

jakub.miklus gravatar image

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 -> /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!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2022-06-20 04:14:12 -0500

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.

edit flag offensive delete link more

Comments

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

jakub.miklus gravatar image jakub.miklus  ( 2022-06-20 09:26:35 -0500 )edit

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

tianb03 gravatar image tianb03  ( 2022-06-21 04:17:03 -0500 )edit
0

answered 2022-06-21 01:42:39 -0500

jakub.miklus gravatar image

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"/>
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2022-06-19 14:15:11 -0500

Seen: 192 times

Last updated: Jun 21 '22