Quantcast
Channel: ROS Answers: Open Source Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 24

send and receive service message using rosbridge

$
0
0
Hello, I'm using rosbridge 2.0 to connect to a remote computer and call a ROS service on the remote machine. I'm using the sample client below (from the the rosbride website) to make the connection and call the service: from json import dumps from ws4py.client.threadedclient import WebSocketClient class GetLoggersClient(WebSocketClient): def get_loggers(self): msg = {'op': 'call_service', 'service': '/rosout/get_loggers'} self.send(dumps(msg)) def opened(self): print "Connection opened..." self.get_loggers() def closed(self, code, reason=None): print code, reason def received_message(self, m): print "Received:", m if __name__=="__main__": try: ws = GetLoggersClient('ws://127.0.0.1:9090/') ws.connect() except KeyboardInterrupt: ws.close() My question is how I can receive the output message of the service call. The output message is printed in the console by received_message(self,m), but I intend to assign this output to a variable. Thanks

Viewing all articles
Browse latest Browse all 24

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>