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

Socket error using Rosparam (rospy)

asked 2013-06-10 02:31:35 -0600

zerohour.cabb gravatar image

Hi there,

I'm running two python scripts concurrently and using global rosparams as a simple way for them to share variables. They variously set and delete the parameters, or wait for them to be set or deleted. When running a simulation I'm repeatedly getting errors on lines like this:

while rap.has_param('/foo'):

...wherein the text returns a socket error saying it Cannot assign requested address. I'm not familiar with using sockets to make connections (hence using ROS to do it for me!) but this is really starting to frustrate me. Any help or tips would be HUGELY appreciated!

I'm using Groovy.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-07-29 01:29:31 -0600

Miguel S. gravatar image

I'm not sure what can be the exact cause of your error. However I'd say you're using the wrong tool for this job. From the ROS wiki:

As the Parameter Server is not designed for high-performance, it is best used for static, non-binary data such as configuration parameters.

Instead I would try to set-up a ROS service using code similar to this:

from std_srvs.srv import Empty
class Bar:
    def sync_callback(self, req):
        self.foo = False
    def __init__(self):
        rospy.init_node("example")
        self.foo = True
        self.sync_service = rospy.Service("sync", Empty, self.sync_callback)
    def run(self):
        while self.foo:
           #rest of code as usual

if __name__ == '__main__':
    b = Bar()
    b.run()

Hope this helps!

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-06-10 02:31:35 -0600

Seen: 481 times

Last updated: Jul 29 '13