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

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
2

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

Question Tools

2 followers

Stats

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

Seen: 1,304 times

Last updated: Jul 08 '20