Skip to content

Commit 06c3550

Browse files
authored
Handle NaNs in AMCL beam sensor model (#3929)
* 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]>
1 parent ef51e01 commit 06c3550

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

nav2_amcl/src/sensors/laser/beam_model.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ BeamModel::sensorFunction(LaserData * data, pf_sample_set_t * set)
7272
step = (data->range_count - 1) / (self->max_beams_ - 1);
7373
for (i = 0; i < data->range_count; i += step) {
7474
obs_range = data->ranges[i][0];
75+
76+
// Check for NaN
77+
if (isnan(obs_range)) {
78+
continue;
79+
}
80+
7581
obs_bearing = data->ranges[i][1];
7682

7783
// Compute the range according to the map

0 commit comments

Comments
 (0)