ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

How to publish +Inf and -Inf in sensor_msgs/Range?

asked 2020-07-07 13:54:36 -0600

parzival gravatar image

From the documentation, if value of sonar is more than max range, +Inf should be published. Similarly for min range and -Inf. But how do I do that? The script would only accept float values.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2020-07-08 04:23:32 -0600

pcoenen gravatar image

float("inf") and float("-inf") for python.

std::numeric_limits<sensor_msgs::Range::_range_type>::infinity() for C++. std::numeric_limits<float>::infinity() will also work, but assumes that range will not change to float64 in the future.

On Arduino you can use INFINITY.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2020-07-07 13:54:36 -0600

Seen: 768 times

Last updated: Jul 08 '20