Exemplo n.º 1
0
 def stitch(self):
     site, ok = QInputDialog.getItem(self, "Pick a site",
                                     "Pick a site to set the panorama for",
                                     self.sites.keys())
     if not ok:
         return
     s = self.sites[site]
     self.science_mark = s
     self.panorama.send_goal(rover_panorama.msg.PanoramaGoal(), self.goal,
                             None, self.feedback)
Exemplo n.º 2
0
 def _on_remove_perspective(self):
     # input dialog to choose perspective to be removed
     names = list(self.perspectives)
     names.remove(self._current_perspective)
     name, return_value = QInputDialog.getItem(
         self._menu_manager.menu,
         self._menu_manager.tr('Remove perspective'),
         self._menu_manager.tr('Select the perspective'), names, 0, False)
     # convert from unicode
     name = str(name)
     if return_value == QInputDialog.Rejected:
         return
     self._remove_perspective(name)
Exemplo n.º 3
0
    def trigger_configuration(self):
        """
        Callback when the configuration button is clicked
        """
        changed = False
        map_topics = sorted(rostopic.find_by_type('nav_msgs/OccupancyGrid'))
        try:
            index = map_topics.index(self.map_topic)
        except ValueError:
            index = 0
        map_topic, ok = QInputDialog.getItem(self, "Select map topic name",
                                             "Topic name", map_topics, index)
        if ok:
            if map_topic != self.map_topic:
                changed = True
            self.map_topic = map_topic

        # Paths
        path_topics = sorted(rostopic.find_by_type('nav_msgs/Path'))
        path_topics = [(topic, topic in self.paths) for topic in path_topics]
        dialog = ListDialog("Select path topic(s)", path_topics, self)
        paths, ok = dialog.exec_()

        if ok:
            if not paths:
                changed = True
            diff = set(paths).symmetric_difference(set(self.paths))
            if diff:
                self.paths = paths
                changed = True

        # Polygons
        polygon_topics = sorted(
            rostopic.find_by_type('geometry_msgs/PolygonStamped'))
        polygon_topics = [(topic, topic in self.polygons)
                          for topic in polygon_topics]
        dialog = ListDialog("Select polygon topic(s)", polygon_topics, self)
        polygons, ok = dialog.exec_()

        if ok:
            if not polygons:
                changed = True
            diff = set(polygons).symmetric_difference(set(self.polygons))
            if diff:
                self.polygons = polygons
                changed = True

        if changed:
            rospy.logdebug(
                "New configuration is different, creating a new nav_view")
            self.new_nav_view()