def __init__(self): rospy.init_node('garbagecollector_pick_service_server') my_service = rospy.Service( '/garbagecollector_pick', Empty, self.my_callback ) # create the Service called my_service with the defined callback self.garbagecollector_object = GarbageCollector() self.garbagecollector_object.init_position() rospy.spin() # mantain the service open.
def main(): parser = get_args_parser().parse_args() registry_host = parser.registryhost registry_port = parser.registryport registry_secure = True if parser.secure else False local_index = True if parser.localindex else False index_url = parser.indexurl gc = GarbageCollector(registry_host=registry_host, registry_port=registry_port, registry_secure=registry_secure, local_index=local_index, index_git=index_url) gc.collect()
class GarbageCollectorService(object): def __init__(self): rospy.init_node('garbagecollector_pick_service_server') my_service = rospy.Service( '/garbagecollector_pick', Empty, self.my_callback ) # create the Service called my_service with the defined callback self.garbagecollector_object = GarbageCollector() self.garbagecollector_object.init_position() rospy.spin() # mantain the service open. def my_callback(self, request): print "My_callback has been called" self.garbagecollector_object.pick() return EmptyResponse()
def main(): parser = get_args_parser().parse_args() registry_host = parser.registryhost registry_port = parser.registryport registry_secure = True if parser.secure else False index_location = parser.indexlocation local_index = True if parser.localindex else False index_git_url = parser.indexgiturl collect = True if parser.collect else False verbose = True if parser.verbose else False GarbageCollector(registry_host=registry_host, registry_port=registry_port, registry_secure=registry_secure, index_git=index_git_url, index_location=index_location, local_index=local_index, collect=collect, verbose=verbose).run()
def __init__(self, argv, style): QApplication.__init__(self, argv) # Sick! The QT doc recommends the following: # "To ensure that the application's style is set correctly, it is best # to call this function before the QApplication constructor, if # possible". However if I do it before QApplication.__init__() then # there is a crash! At least with some styles on Ubuntu 12.04 64 bit. # So I have to call the initialization after the __init__ call. QApplication.setStyle(style) self.mainWindow = None self.__lastFocus = None self.__beforeMenuBar = None # Sick! It seems that QT sends Activate/Deactivate signals every time # a dialog window is opened/closed. This happens very quickly (and # totally unexpected!). So the last focus widget must not be focused # unconditionally as the last focus may come from a dialog which has # already been destroyed. Without checking that a widget is still alive # (e.g. clicking 'Cancel' in a dialog box) leads to a core dump. QApplication.setWindowIcon(PixmapCache().getIcon('icon.png')) self.focusChanged.connect(self.__onFocusChanged) # Avoid having rectangular frames on the status bar and # some application wide style changes appCSS = GlobalData().skin.appCSS if appCSS != "": self.setStyleSheet(appCSS) # Install custom GC self.__gc = GarbageCollector(self) self.installEventFilter(self) return