Skip to content

Commit

Permalink
Handle NaNs in AMCL beam sensor model (ros-navigation#3929)
Browse files Browse the repository at this point in the history
* Handle NaNs in AMCL beam sensor model

Signed-off-by: Michel Hidalgo <[email protected]>

* Use proper isnan check

Signed-off-by: Michel Hidalgo <[email protected]>

---------

Signed-off-by: Michel Hidalgo <[email protected]>
  • Loading branch information
hidmic authored Nov 3, 2023
1 parent ef51e01 commit 06c3550
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions nav2_amcl/src/sensors/laser/beam_model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ BeamModel::sensorFunction(LaserData * data, pf_sample_set_t * set)
step = (data->range_count - 1) / (self->max_beams_ - 1);
for (i = 0; i < data->range_count; i += step) {
obs_range = data->ranges[i][0];

// Check for NaN
if (isnan(obs_range)) {
continue;
}

obs_bearing = data->ranges[i][1];

// Compute the range according to the map
Expand Down

0 comments on commit 06c3550

Please sign in to comment.