ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

What does 'nan' mean in lidar's scan data?

asked 2021-07-23 09:23:48 -0600

kane_choigo gravatar image

updated 2021-07-23 10:33:27 -0600

Hello, I'm working with the ROS kinetic of Ubuntu 16.04.

I'm also using Hokuyo's lidar sensor and recently realized that there are some strange data in the returned data of /scan topic.

The nan data, which stands for 'not a number', is that; if so, what is the 'nan'?

Although I've worked with a lidar sensor for over 2 years, I have no idea about when the nan data is created.

What's the nan in this? It doesn't matter when it comes to the g-mapping or other packages, but I need to do another work whit this data and nan makes no sense.

If someone familiar with lidar's range data is here, would you please give me some help?

The below is the /scan data including nan.

header: 
  seq: 6147
  stamp: 
    secs: 1627028918
    nsecs: 664962817
  frame_id: "base_footprint"
angle_min: -2.07394194603
angle_max: 2.07394218445
angle_increment: 0.00613592332229
time_increment: 2.71259814326e-05
scan_time: 0.0277769993991
range_min: 0.019999999553
range_max: 5.59999990463
ranges: [nan, nan, 2.802000045776367, 2.7309999465942383, 2.7090001106262207, 2.677000045776367,...]

Thanks :)


(add)

According to this page, I think the nan data might mean the max_range value. Is it right?

edit retag flag offensive close merge delete

Comments

It's corect! There is no obstacle at the maximum reading range. BTW, you've tested this lidar only indoor?

Ktysai gravatar image Ktysai  ( 2021-07-23 14:16:34 -0600 )edit

@Ktysai Thanks for the kind comment. Yeah, I've never used it on the road..

kane_choigo gravatar image kane_choigo  ( 2021-07-23 23:00:53 -0600 )edit

Your linked questions (or the best answer to that) speaks from two modes ( urg_node or the hokuyo_node). Which mode are you using? Which error code do you get?

Lennart gravatar image Lennart  ( 2021-07-25 15:46:19 -0600 )edit

3 Answers

Sort by ยป oldest newest most voted
3

answered 2021-07-25 11:37:57 -0600

fergs gravatar image

If the driver follows REP-117, NAN means "erroneous, invalid or missing measurement". While not every ROS driver follows REP-117, most do.

edit flag offensive delete link more

Comments

Yeah, you're right. I just modified those nan data to be the max_range value, and it worked. Although all the nan doesn't mean out of range, it would be up to the user :)

kane_choigo gravatar image kane_choigo  ( 2021-07-25 19:47:17 -0600 )edit
1

answered 2021-07-25 15:38:28 -0600

Lennart gravatar image

It seems not to be a ROS specific question but a LIDAR specific question. nan means mostly the LIDAR didn't received the his laser-ray. The most reasonable answer is "out of range". It could also have other reasons like bright light as noise or "bad" surfaces that don't reflect the ray back to the LIDAR. At your place I would search the answer to your question in first point by the LIDAR. I guess it's a measuring issue.

edit flag offensive delete link more

Comments

1

Thanks for the answer. I'm using urg_node, so I couldn't sure whether the nan really comes from 'out of range'. I still can't say all the nan should mean that clearly, it seems I need to check the test room concerning a surface or reflected light more carefully.

For the error message, I didn't get any messages but only the bugs without them, which is one of the most annoying situations :)

kane_choigo gravatar image kane_choigo  ( 2021-07-25 19:37:04 -0600 )edit
1

answered 2021-07-23 14:21:51 -0600

Mike Scheutzow gravatar image

As far as I know, nan has no standard interpretation beyond "ray value is not in supported range". In general, you can't interpret it as "greater than range_max", although with testing you might decide that is true for your specific lidar. What I do is ignore a ray with this value.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2021-07-23 09:23:48 -0600

Seen: 846 times

Last updated: Jul 25 '21