Extrapolation error looking robot pose with HIL simulation with raspberry 3

asked 2021-04-06 15:05:04 -0500

rezenders gravatar image

Hello,

I am trying to run a Hardware In The Loop simulation with the navigation stack and other packages running on a raspberry pi 3 and a gazebo simulation running on a laptop.

I am able to run a mapping node without problems, however when I try to use the map I created with the navigation stack using amcl node I am getting the following error:

     [ WARN] [1617738209.055359052, 79.489000000]: Costmap2DROS transform timeout. Current time: 79.4890, global_pose stamp: 70.4020, tolerance: 0.5000
    [ERROR] [1617738210.063845021, 80.493000000]: Extrapolation Error looking up robot pose: Lookup would require extrapolation into the past.  Requested time 70.402000000 but the earliest data is at time 70.481000000, when looking up transform from frame [base_footprint] to frame [map]

    [ WARN] [1617738210.424839004, 80.848000000]: Failed to compute odom pose, skipping scan (Lookup would require extrapolation into the future.  Requested time 70.801000000 but the latest data is at time 70.402000000, when looking up transform from frame [base_footprint] to frame [odom])
    [ERROR] [1617738210.425078638, 80.848000000]: Couldn't determine robot's pose associated with laser scan
    [ERROR] [1617738211.269990600, 81.692000000]: Extrapolation Error looking up robot pose: Lookup would require extrapolation into the past.  Requested time 70.402000000 but the earliest data is at time 71.681000000, when looking up transform from frame [base_footprint] to frame [map]

I found some related questions such as this one that says that the raspberry and the computer clock must be synced, so I synced the clocks and repeated the process but still got the same error, then I tried using a simulated clock by setting /use_sim_time to true and still got the same error.

Then I replaced the raspberry for another laptop and repeated the process with the clocks synced and /use_sim_time as false and it worked, then I repeated the process with the clocks unsynced and /use_sim_time as true and it also worked. With this, I assume that the error is due to the raspberry pi 3.

I found this other question where it says that this error may be caused by the CPU being 100% used and compiling from source with DCMAKE_BUILD_TYPE=Release would solve it. So I compiled everything from source and I still get this error. But now I check and only 1 core of the raspberry is being used 100% and it is due to amcl node.

Anyone has any ideas on how I can solve it? Changing amcl node parameters? Any other tips?

My amcl parameters are:

odom_frame_id: odom
base_frame_id: base_footprint
global_frame_id: map

initial_pose_x: 0.0
initial_pose_y: 0.0
initial_pose_a: 0.0

min_particles: 200
max_particles: 2500

kld_err: 0.02     
update_min_d: 0.0 
update_min_a: 0.0 
resample_interval: 1 
transform_tolerance: 1 
recovery_alpha_slow: 0.00 
recovery_alpha_fast: 0.00 

gui_publish_rate: -1 

laser_max_range: 3.4 
laser_max_beams: 180 
laser_min_range: 0.12

laser_z_hit: 0.5     
laser_z_short: 0.05  
laser_z_max: 0.05    
laser_z_rand: 0.5   
laser_sigma_hit: 0.2 
laser_lambda_short: 0.1 
laser_likelihood_max_dist: 2.0 
laser_model_type: likelihood_field

odom_model_type: diff-corrected 
odom_alpha1: 0.001      
odom_alpha2: 0.001      
odom_alpha3: 0.001      
odom_alpha4: 0.001
edit retag flag offensive close merge delete