Robotics StackExchange | Archived questions

Why "ROS_INFO" can correct my "runtime_error"?

When launching a lidar driver, the program gives me

"terminate called after throwing an instance of 'std::runtime_error' what(): Time is out of dual 32-bit range".

It seems that the type of time is wrong. But when debugging the codes, I found that when adding a "ROS_INFO("111")" line, the program can surprisingly run.

So does ROS_INFO change the time in ROS, or something else?

Screenshot

Asked by larrydong on 2020-09-07 21:14:08 UTC

Comments

It's probably not the ROS_INFO() specifically that "fixes" the issue. It's probably some race condition / accesing a variable before it is set by dvr(). I would bet if you sleep for some microseconds there instead of ROS_INFO() the behavior would be similar.

Asked by Reamees on 2020-09-09 07:36:15 UTC

Thanks for your reply. Turely it's not because of ROS_INFO, but some delay there can solve the problem. Thanks so much!

Asked by larrydong on 2020-09-28 07:40:58 UTC

A bit late and I'm not sure how you ended up solving the issue, but just adding some delay is not a proper fix. The amount of time you would generally need to wait is to some extent random and definitely system specific. To properly solve it you would need to add some checks that all required data is initialized. Most appropriate would probably be in the driver class initialization function. If that is out of your control then you can add a check instead of the ROS_INFO(). By the error it seems that some Time variable is probably not initialized before trying to use it.

Asked by Reamees on 2020-11-30 03:45:07 UTC

Answers