#NEWLINE# def callback( self , msg , callbacks = None ) : #NEWLINE# #INDENT# ' Callback for incoming messages on the rospy.Subscriber\n\n        Converts the incoming msg to JSON, then passes the JSON to the\n        registered subscriber callbacks.\n\n        Keyword Arguments:\n        msg - the ROS message coming from the subscriber\n        callbacks - subscriber callbacks to invoke\n\n        ' #NEWLINE# json = None #NEWLINE# try : #NEWLINE# #INDENT# json = message_conversion . extract_values ( msg ) #NEWLINE# #UNINDENT# except Exception as exc : #NEWLINE# #INDENT# logerr ( 'Exception while converting messages in subscriber callback : %s' , exc ) #NEWLINE# return #NEWLINE# #UNINDENT# if ( not callbacks ) : #NEWLINE# #INDENT# with self . lock : #NEWLINE# #INDENT# callbacks = self . subscriptions . values ( ) #NEWLINE# #UNINDENT# #UNINDENT# for callback in callbacks : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# callback ( json ) #NEWLINE# #UNINDENT# except Exception as exc : #NEWLINE# #INDENT# logerr ( 'Exception calling subscribe callback: %s' , exc ) #NEWLINE# pass