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

Revision history [back]

The value, 0.00, will always show up since it's data type is still a float. Notice the trailing zeros to two decimal points, the zeroes after the decimal point. Instead, what you could do is for the ROS Publisher script, add a conditional statement to only print the float value if it's not zero.

In between the curly brackets of void loop(), a few lines of code like if ( [publish_value_variable] > 0) { pub.publish(&msg) } or if ( [publisher_value_variable] != 0) { pub.publish(&msg) should suffice your needs. Replace [publisher_value_variable] with the name of the variable that stores the current value of the publisher.