Problems with robot localization on map and navigation when using 2 ekf_localization nodes and amcl
I have a robot, mounted with lidar (rplidar a2), imu(mpu6050) and wheel encoders, and I am trying to make it navigate on map in indoor environment. Wheels encoders, which provides initial odometry, are not accurate when it comes to turn, so I am using ekf_localization_node to fuse with data from imu and post transforms to odom frame (1st ekf node). Then I'm using another instance of ekf_node_localization to fuse odometry, data from imu, and amcl pose and publish it into map frame. With such setup, amcl_pose visualized in rviz seems correct, but other readings (odometry/filtered, laser_scan, position of robot through polygon topic from move_base node) tends to drift off after some movement. I think the problem is in a configurations of how I using ekf node, but I can't find out what I should do, in order to fix it.
amcl.launch <launch> <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="min_particles" value="500"/>
<param name="max_particles" value="3000"/>
<param name="kld_err" value="0.02"/>
<param name="update_min_d" value="0.10"/>
<param name="update_min_a" value="0.10"/>
<param name="resample_interval" value="1"/>
<param name="transform_tolerance" value="0.5"/>
<param name="recovery_alpha_slow" value="0.00"/>
<param name="recovery_alpha_fast" value="0.00"/>
<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="gui_publish_rate" value="100.0"/>
<param name="tf_broadcast" value= "false"/>
<remap from="scan" to="$(arg scan_topic)"/>
<param name="laser_max_range" value="3.5"/>
<param name="laser_max_beams" value="180"/>
<param name="laser_z_hit" value="0.5"/>
<param name="laser_z_short" value="0.05"/>
<param name="laser_z_max" value="0.05"/>
<param name="laser_z_rand" value="0.5"/>
<param name="laser_sigma_hit" value="0.2"/>
<param name="laser_lambda_short" value="0.1"/>
<param name="laser_likelihood_max_dist" value="2.0"/>
<param name="laser_model_type" value="likelihood_field"/>
<param name="odom_model_type" value="diff"/>
<param name="odom_alpha1" value="0.1"/>
<param name="odom_alpha2" value="0.1"/>
<param name="odom_alpha3" value="0.1"/>
<param name="odom_alpha4" value="0.1"/>
<param name="odom_frame_id" value="odom"/>
<param name="base_frame_id" value="base_link"/>
</node> </launch>
ekf_odom.params.yaml
frequency: 50 silent_tf_failure: false sensor_timeout: 0.0 two_d_mode: true transform_time_offset: 0.3 transform_timeout: 0.0
publish_tf: true
map_frame: map
odom_frame: odom
base_link_frame: base_link
world_frame: odom
odom0: odrv_ros/odom odom0_config: [true, true, false, false, false, true, true, true, false, false, false, true, false, false, false]
odom0_queue_size: 6 odom0_nodelay: false odom0_differential: true odom0_relative: false
imu0: imu/data imu0_config: [false, false, false, false, false, true, true, true, false, false, false, true, false, false, false] imu0_nodelay: false imu0_relative: false imu0_queue_size: 4 imu0_differential: false imu0_remove_gravitational_acceleration: false
process_noise_covariance: [0.05, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ...