send and receive service message using rosbridge
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