0
$\begingroup$

Rosanswers logo

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.


Originally posted by zerohour.cabb on ROS Answers with karma: 1 on 2013-06-10

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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!


Originally posted by Miguel S. with karma: 1114 on 2013-07-29

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.