File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -204,6 +204,7 @@ class UamROS
204204 nullptr ;
205205
206206 std::vector<std::pair<size_t , float >> ranges_in_safety_area;
207+ size_t finite_ranges_count = 0 ;
207208
208209 for (size_t idx = 0 ; idx < reply.ranges .size (); idx++)
209210 {
@@ -217,6 +218,10 @@ class UamROS
217218 if (within_fov)
218219 {
219220 msg.ranges .push_back (range_m);
221+ if (!std::isnan (range_m))
222+ {
223+ finite_ranges_count++;
224+ }
220225 }
221226
222227 if (safety_area != nullptr && !std::isnan (range_m))
@@ -229,6 +234,16 @@ class UamROS
229234 }
230235 }
231236
237+ if (finite_ranges_count == 0 ) {
238+ // This driver/lidar combination will periodically boot up and publish all nan ranges for a moment.
239+ // If this happens after a lidar power cycle (when the rest of the system is initilized), it breaks the
240+ // laser filtering pipeline. The likleyhood of nominally receiving all nan readings in our usecase is so
241+ // infinitesimally small we can just skip publishing in this case.
242+ ROS_WARN_STREAM_THROTTLE (5.0 , " All ranges are infinite, skipping scan publish!" );
243+ // We return early to avoid publishing mis-leading scans or area information.
244+ return ;
245+ }
246+
232247 if constexpr (is_detected<detected_intensities, T>::value)
233248 {
234249 msg.intensities .reserve (number_of_readings);
You can’t perform that action at this time.
0 commit comments