pose mismatch between RVIZ and Gazebo with AMCL
Hello, I am learning a ROS course with Gazebo. During applying the AMCL, I noticed that the Laser scan is off by some degrees. I read about the AMCL initial poses which are included in the launch file
<node pkg="amcl" type="amcl" name="amcl" output="screen">
.
.
.
<param name="initial_pose_x" value="0.0"/>
<param name="initial_pose_y" value="0.0"/>
<param name="initial_pose_a" value="0.0"/>
</node>
Is there any way to get the difference between the two poses and apply it to stay in sync between the Gazebo and RViz? I believe this is very important to not rely on 2D pose estimate especially if Gazebo might be replaced by a real-world robot.
I looked for the AMCL topics and found amcl_pose
$ rostopic list | grep amcl
/amcl/parameter_descriptions
/amcl/parameter_updates
/amcl_pose
When I tried it out at the current rotated pose, I received "as expected" both poses and covariance of amcl
$ rostopic echo /amcl_pose
header:
seq: 0
stamp:
secs: 4547
nsecs: 966000000
frame_id: "map"
pose:
pose:
position:
x: 0.0035147701830781273
y: 0.014127498618076101
z: 0.0
orientation:
x: 0.0
y: 0.0
z: 0.003202069927745266
w: 0.9999948733609477
covariance: [0.2245754790525376, -0.003158366121491816, 0.0, 0.0, 0.0, 0.0, -0.0031583661214918124, 0.23894487468367523, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.06575617702179823]
This problem happens when I use ateleop
node to rotate the robot. The initial pose at the start is not that bad
My robot is in URDF (xacro) files for some wheels macros and the main robot structure.
All help is appreciated.
Update: I think the problem came from the default values of the odom_alpha
noise parameters as I didn't add it to set it to a lower value (than the default of 0.2)
<param name="odom_alpha1" value="0.01"/>
<param name="odom_alpha2" value="0.01"/>
<param name="odom_alpha3" value="0.01"/>
<param name="odom_alpha4" value="0.01"/>
<param name="odom_alpha4" value="0.01"/>
I am leaving it for others that may encounter the same issue. If there is any additional steps I should consider, please comment and I would always appreciate it.