ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
if __name__ == '__main__': while not rospy.is_shutdown(): listener() rospy.Publisher('talk', Float64, queue_size=5).publish(ranges) rospy.sleep(0.01)
You are re-creating your subscriber every 0.01
seconds, which is probably not what you want.
However when I move the data from the callback functions to my processing algorithm the using global variables, the variables are updated very slowly.
I can imagine that the chances of ROS succesfully registering your subscriber, receiving a message and delivering it to your callback in 0.01
sec are rather slim, and only succeeds every now and then. If that leads to most messages being missed, it would appear as if updates to ranges
are very slow. In reality, they are actually very infrequent.
2 | No.2 Revision |
if __name__ == '__main__': while not rospy.is_shutdown(): listener() rospy.Publisher('talk', Float64, queue_size=5).publish(ranges) rospy.sleep(0.01)
You are re-creating your subscriber every 0.01
seconds, which is probably not what you want.
However when I move the data from the callback functions to my processing algorithm the using global variables, the variables are updated very slowly.
I can imagine that the chances of ROS succesfully registering your subscriber, receiving a message and delivering it to your callback in 0.01
sec are rather slim, and only succeeds every now and then. If that leads to most messages being missed, it would appear as if updates to ranges
are very slow. In reality, they are actually probably very infrequent.
3 | No.3 Revision |
if __name__ == '__main__': while not rospy.is_shutdown(): listener() rospy.Publisher('talk', Float64, queue_size=5).publish(ranges) rospy.sleep(0.01)
You are re-creating your subscriber every 0.01
seconds, which is probably not what you want.
However when I move the data from the callback functions to my processing algorithm the using global variables, the variables are updated very slowly.
I can imagine that the chances of ROS succesfully successfully registering your subscriber, receiving a message and delivering it to your callback in 0.01
sec are rather slim, and only succeeds every now and then. If that leads to most messages being missed, it would appear as if updates to ranges
are very slow. In reality, they are probably very infrequent.