Skip to content

Commit

Permalink
Handle NaNs in AMCL beam sensor model (#3929) (#3936)
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]>
(cherry picked from commit 06c3550)

Co-authored-by: Michel Hidalgo <[email protected]>
  • Loading branch information
mergify[bot] and hidmic authored Nov 3, 2023
1 parent f136e36 commit 741f585
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 741f585

Please sign in to comment.