コード例 #1
0
 def rosservice_list_masters(self, req):
     '''
 Callback for the ROS service to get the current list of the known ROS masters.
 '''
     masters = list()
     with self.__lock:
         try:
             for (_, v) in self.masters.iteritems():
                 if not v.mastername is None:
                     masters.append(
                         ROSMaster(str(v.mastername), v.masteruri,
                                   v.timestamp, v.timestamp_local, v.online,
                                   v.discoverername, v.monitoruri))
         except:
             import traceback
             traceback.print_exc()
     return DiscoverMastersResponse(masters)
コード例 #2
0
 def rosservice_list_masters(self, req):
     '''
     Callback for the ROS service to get the current list of the known ROS masters.
     '''
     masters = list()
     self.__lock.acquire(True)
     try:
         for _key, master in self.__masters.iteritems():
             masters.append(
                 ROSMaster(str(master.name), master.getMasterUri(),
                           master.getRosTimestamp(),
                           master.getRosTimestamp(), master.online,
                           master.getTXTValue('zname', ''),
                           master.getTXTValue('rpcuri', '')))
     except:
         pass
     finally:
         self.__lock.release()
         return DiscoverMastersResponse(masters)