Ros loses messages

Let’s take the simplest example (eg, Python’s) and update it slightly to our needs:

rospy.init_node('test')
pub = rospy.Publisher('hello', String, queue_size=10)
rate = rospy.Rate(250) # 250hz
for i in range(10):
    pub.publish("hello world"+str(i))
    rate.sleep()

And it seems to be clear what to expect in the subscriber (lets just output to the console that what came), but we can see:
Continue reading “Ros loses messages”

Rospy import dancing

I would like to share a story about how I killed a couple of hours recently. I write on rospy a small architecture to work with a robot. Since there are no good examples and I’m not an expert in the python, without thinking twice, I added the path to the project (let it be ~/work/src/coolp) in PYTHONPATH. Then I added empty __init__.py directly to the root of proper packages ( eg. coolp/control/__ init__.py next to the scripts that you want to import coolp/control/control_arm.py) and now at any place where I need this script – from control.control_arm import LeftArm.

Continue reading “Rospy import dancing”