Exemple #1
0
    def display(self, hdf):
        webutil.grabTopics(hdf, [])
        webutil.set_tabs(hdf, ["status", "services"])

        services = rosservice.get_service_list(None)
        services.sort()

        i = 0
        for service in services:
            i = i + 1
            hdf.setValue("CGI.cur.services.%d" % i, service)
Exemple #2
0
  def display(self, hdf):
    webutil.grabTopics(hdf, [])
    webutil.set_tabs(hdf, ["status", "services"])

    services = rosservice.get_service_list(None)
    services.sort()
    
    i = 0
    for service in services:
      i = i + 1
      hdf.setValue("CGI.cur.services.%d" % i, service)
Exemple #3
0
  def display(self, hdf):
    topic = hdf.getValue("Query.topic", "")
    hdf.setValue("CGI.cur.topic", topic)
    webutil.set_tabs(hdf, ["status", "topics"])
    webutil.grabTopics(hdf, ["/topics", topic, "/battery_state", "/power_board_state", "/app_status"])

    topic_data = nodeutil.topic_info(topic)

    if "error" in topic_data:
      hdf.setValue("CGI.cur.error", topic_data["error"])
    else:
      webutil.hdf_array(hdf, sorted(topic_data["publishers"]), "CGI.cur.publishers")
      webutil.hdf_array(hdf, sorted(topic_data["subscribers"]), "CGI.cur.subscribers")
Exemple #4
0
  def display(self, hdf):
    node = hdf.getValue("Query.node", "")
    hdf.setValue("CGI.cur.node", node)
    webutil.set_tabs(hdf, ["status", "nodes"])
    webutil.grabTopics(hdf, ["/topics"])

    node_data = nodeutil.node_info(node)

    webutil.hdf_array(hdf, sorted(node_data["subscriptions"]), "CGI.cur.subscriptions")
    webutil.hdf_array(hdf, sorted(node_data["publications"]), "CGI.cur.publications")
    webutil.hdf_array(hdf, sorted(node_data["services"]), "CGI.cur.services")
    
    if "error" in node_data:
      hdf.setValue("CGI.cur.error", node_data["error"])
Exemple #5
0
    def display(self, hdf):
        node = hdf.getValue("Query.node", "")
        hdf.setValue("CGI.cur.node", node)
        webutil.set_tabs(hdf, ["status", "nodes"])
        webutil.grabTopics(hdf, ["/topics"])

        node_data = nodeutil.node_info(node)

        webutil.hdf_array(hdf, sorted(node_data["subscriptions"]),
                          "CGI.cur.subscriptions")
        webutil.hdf_array(hdf, sorted(node_data["publications"]),
                          "CGI.cur.publications")
        webutil.hdf_array(hdf, sorted(node_data["services"]),
                          "CGI.cur.services")

        if "error" in node_data:
            hdf.setValue("CGI.cur.error", node_data["error"])
Exemple #6
0
  def display(self, hdf):
    webutil.grabTopics(hdf, [])
    webutil.set_tabs(hdf, ["status", "processes"])    
    try:
      proc = subprocess.Popen(["sudo", "ckill", "list"], stdout=subprocess.PIPE)
      out, err = proc.communicate()
      out = string.strip(out)
      i = 0
      lines = out.split('\n')
      if out == "" and hdf.getValue("Query.reset", "") != "":
        self.redirectUri(config.gBaseURL + "webui/reset.py?Action.DoReset=1")
      else:
        for line in lines:
          hdf.setValue("CGI.cur.lines.%d" % i, line)
          i += 1

    except:
      hdf.setValue("CGI.cur.error", "Unable to call ckill on this robot.")
Exemple #7
0
    def display(self, hdf):
        webutil.grabTopics(hdf, [])
        webutil.set_tabs(hdf, ["status", "processes"])
        try:
            proc = subprocess.Popen(["sudo", "ckill", "list"],
                                    stdout=subprocess.PIPE)
            out, err = proc.communicate()
            out = string.strip(out)
            i = 0
            lines = out.split('\n')
            if out == "" and hdf.getValue("Query.reset", "") != "":
                self.redirectUri(config.gBaseURL +
                                 "webui/reset.py?Action.DoReset=1")
            else:
                for line in lines:
                    hdf.setValue("CGI.cur.lines.%d" % i, line)
                    i += 1

        except:
            hdf.setValue("CGI.cur.error",
                         "Unable to call ckill on this robot.")
Exemple #8
0
  def display(self, hdf):
    webutil.set_tabs(hdf, ["apps", "appinfo"])
    webutil.grabTopics(hdf, [])
    taskid = hdf.getValue("Query.taskid", "")
    doc = app.App(taskid).load_yaml()
  
    prefix = "CGI.cur.app"
    hdf.setValue(prefix + "." + "taskid", taskid)
    for key, val in doc.items():
      if type(val) is list:
        for i in range(0,len(val)):
          hdf.setValue(prefix + "." + key + "." + str(i), val[i])
      elif val is not None:
        hdf.setValue(prefix + "." + key, val)
      else:
        hdf.setValue(prefix + "." + key, '')

    # for favorite apps
    user_record = self.authdb.users.lookup(self.username)
    hdf.setValue("CGI.cur.user.favorite_apps", user_record.favorite_apps)

    if user_record.is_favorite_app(taskid):
      hdf.setValue("CGI.cur.app.favorite", "1")
Exemple #9
0
    def display(self, hdf):
        webutil.set_tabs(hdf, ["apps", "appinfo"])
        webutil.grabTopics(hdf, [])
        taskid = hdf.getValue("Query.taskid", "")
        doc = app.App(taskid).load_yaml()

        prefix = "CGI.cur.app"
        hdf.setValue(prefix + "." + "taskid", taskid)
        for key, val in doc.items():
            if type(val) is list:
                for i in range(0, len(val)):
                    hdf.setValue(prefix + "." + key + "." + str(i), val[i])
            elif val is not None:
                hdf.setValue(prefix + "." + key, val)
            else:
                hdf.setValue(prefix + "." + key, '')

        # for favorite apps
        user_record = self.authdb.users.lookup(self.username)
        hdf.setValue("CGI.cur.user.favorite_apps", user_record.favorite_apps)

        if user_record.is_favorite_app(taskid):
            hdf.setValue("CGI.cur.app.favorite", "1")
Exemple #10
0
    def display(self, hdf):
        webutil.grabTopics(hdf, [])

        hdf.setValue("CGI.now", str(time.time()))
        webutil.set_tabs(hdf, ["apps"])

        apps = self.db.apps.fetchAllRows()
        prefix = "CGI.cur.apps"
        i = 0
        for app in apps:
            i = i + 1
            aprefix = prefix + ".%d" % i
            app.hdfExport(aprefix, hdf)
            app.fetchApp(aprefix, hdf)

        # experimental new stuff
        apps = webutil.list_apps()
        categories = {}
        user_record = self.authdb.users.lookup(self.username)
        user_apps = user_record.favorite_apps_list()

        taskids = [db_webui.path2taskid(app) for app in apps]
        actual_apps = []

        for user_app in user_apps:
            if user_app in taskids:
                actual_apps.append(user_app)
        categories["Favorites"] = actual_apps

        n = 0
        for appfn in apps:
            taskid = db_webui.path2taskid(appfn)
            n = n + 1
            prefix = "CGI.cur.available_apps.%s" % taskid
            _app = launchman.app.App(taskid)
            doc = _app.load_yaml()

            iapp = self.db.apps.lookup(taskid=taskid)
            if iapp:
                pass

            # only show apps relevant to this type of robot
            robot_type = config.get_robot_type()
            if "robot" in doc and robot_type != doc["robot"]:
                continue

            try:
                category_apps = categories[doc.get("category", "Other")]
            except KeyError:
                category_apps = []
                categories[doc.get("category", "Other")] = category_apps
            category_apps.append(taskid)

            hdf.setValue(prefix + ".taskid", taskid)
            for key, val in doc.items():
                if type(val) is list:
                    for i in range(0, len(val)):
                        hdf.setValue(prefix + "." + key + "." + str(i), val[i])
                elif val is not None:
                    hdf.setValue(prefix + "." + key, val)
                else:
                    hdf.setValue(prefix + "." + key, '')

            if user_record.is_favorite_app(taskid):
                hdf.setValue(prefix + ".favorite", "1")

        def compare_categories(a, b):
            if a[0] == "Favorites":
                return -1
            if b[0] == "Favorites":
                return 1
            else:
                return cmp(a, b)

        prefix = "CGI.cur.categories"
        i = 0
        for category, apps in sorted(categories.items(), compare_categories):
            hdf.setValue(prefix + ".%d" % i, category)
            j = 0
            for app in apps:
                hdf.setValue(prefix + ".%d.apps.%d" % (i, j), app)
                j = j + 1
            i = i + 1
Exemple #11
0
  def display(self, hdf):
    webutil.grabTopics(hdf, [])
    webutil.set_tabs(hdf, ["status", "params"])    

    _c, _t, params = self.master.getParam(_get_caller_id(), "/")
    self.flatten(hdf, params, path="CGI.cur.params.")
Exemple #12
0
 def display(self, hdf):
   webutil.grabTopics(hdf, [])
Exemple #13
0
 def display(self, hdf):
   webutil.grabTopics(hdf, ["/topics"])
   webutil.set_tabs(hdf, ["status", "monitor"])
Exemple #14
0
 def display(self, hdf):
     webutil.grabTopics(hdf, ["/topics"])
     webutil.set_tabs(hdf, ["status", "topics"])
Exemple #15
0
 def display(self, hdf):
     webutil.grabTopics(hdf, ["/rosout", "/users"])
     webutil.set_tabs(hdf, ["status", "log"])
Exemple #16
0
 def display(self, hdf):
     webutil.grabTopics(hdf, [])
Exemple #17
0
 def display(self, hdf):
   webutil.grabTopics(hdf, ["/rosout", "/users"])
   webutil.set_tabs(hdf, ["status", "log"])