Exemple #1
0
    def init(self, params):
        self._id = int(params['id'])
        self._target_id = -1
        self._target_range = np.inf  # added to keep track of current target range
        self._wp = np.array([0, 0, 0])
        self._weapons_range = enums.MAX_RANGE_DEF
        self._fov_width = enums.HFOV_DEF
        self._fov_height = enums.VFOV_DEF
        self._bboxes = enums.get_battleboxes()
        self._own_pose = apbrg.Geodometry()
        self._blues = dict()
        self._reds = dict()
        self._shot = set()
        self._taken = set(
        )  # this is the set that this UAV will use to keep track of "taken" enemy
        self._t_id = list()  # sets up lists of found enemy
        self._t_range = list()
        self._safe_waypoint = np.array([0, 0, 0])
        self._action = ["None", 0]
        self._name = 'USMAQuadMsg'
        self._bearing_adj = 0

        # This is the new messaging logic (from the documentation)
        self.pubs['taken'] = self.createPublisher('taken', apmsg.MsgStat, 1)
        self.subs['taken'] = self.createSubscriber('taken', apmsg.MsgStat,
                                                   self.receive_msg_stat)
Exemple #2
0
    def init(self, params):
        self._id = int(params['id'])
        self._target_id = -1
        self._wp = np.array([0, 0, 0])
        self._weapons_range = enums.MAX_RANGE_DEF
        self._tracking_range = self._weapons_range * 1.5
        self._fov_width = enums.HFOV_DEF
        self._fov_height = enums.VFOV_DEF
        self._bboxes = enums.get_battleboxes()
        self._own_pose = apbrg.Geodometry()
        self._blues = dict()
        self._reds = dict()
        self._shot = set()
        self._safe_waypoint = np.array([0, 0, 0])
        self._action = ["None", 0]
        self._name = 'Pincer'

        self._state = States.new_start

        try:
            self._vehicle_type = int(params['vehicle_type'])
        except KeyError:
            self._vehicle_type = enums.AC_UNKNOWN

        self.box_center = self.interpolate(self._bboxes[1][0][0],
                                           self._bboxes[1][0][1],
                                           self._bboxes[1][1][0],
                                           self._bboxes[1][1][1], 0.5)
        self._safe_corners = self.set_safe_corners()
Exemple #3
0
 def init(self, params):
     self._id = int(params['id'])
     self._target_id = -1
     self._wp = np.array([0, 0, 0])
     self._weapons_range = enums.MAX_RANGE_DEF
     self._fov_width = enums.HFOV_DEF
     self._fov_height = enums.VFOV_DEF
     self._bboxes = enums.get_battleboxes()
     self._own_pose = apbrg.Geodometry()
     self._blues = dict()
     self._reds = dict()
     self._shot = set()
     self._safe_waypoint = np.array([0, 0, 0])
     self._action = ["None", 0]
     self._name = 'Vortex'
Exemple #4
0
    def __init__(self, sc_state):
        super(SC_QtGUIModule, self).__init__(sc_state, "qt_gui",
                                             "qt_gui module")
        self.__app = QApplication([])

        self.mapWidget = MapWidget()
        self.mapWidget.show()

        self.__dashboardDialog = DashboardDialog(self.sc_state, self.mapWidget)
        self.__dashboardDialog.show()

        #periodic updates...
        self.__updater = QTimer()
        self.__updater.setInterval(500)
        self.__updater.timeout.connect(self.time_to_update)
        self.__updater.start()

        #more frequent updates...
        self.__updaterFrequent = QTimer()
        self.__updaterFrequent.setInterval(40)
        self.__updaterFrequent.timeout.connect(self.time_to_update_frequent)
        self.__updaterFrequent.start()

        #zoom to default location:
        if SITL_LOCATION == 4:
            self.mapWidget.zoomTo(16, 33.274562, -81.577593)
        elif SITL_LOCATION == 3:
            self.mapWidget.zoomTo(16, 43.872280, -112.726646)
        elif SITL_LOCATION == 2:
            self.mapWidget.zoomTo(16, 41.390717, -73.953278)
        elif SITL_LOCATION == 1:
            self.mapWidget.zoomTo(16, 41.360461, -74.032838)
        else:
            self.mapWidget.zoomTo(16, 35.716888, -120.7646408)

        #add game-related icons and boxes
        (bbox, cline, _, bluestage, _, redstage) = \
            enums.get_battleboxes()
        self.mapWidget.addGoalIcons(enums.GOAL_POSITS["blue"], \
                                    enums.GOAL_POSITS["red"])
        self.mapWidget.drawBattleBox(bluestage.get_corners(),
                                     color=(125, 125, 255))
        self.mapWidget.drawBattleBox(redstage.get_corners(),
                                     color=(255, 125, 125))
        self.mapWidget.drawBattleBox(bbox.get_corners(), cline)

        #slots
        self.mapWidget.getView().just_selected_uav.connect(self.on_uav_select)
 def init(self, params):
     self._id = int(params['id'])
     self._target_count = 0
     self._wp = np.array([0, 0, 0])
     self._max_range = enums.MAX_RANGE_DEF
     self._fov_width = enums.HFOV_DEF
     self._fov_height = enums.VFOV_DEF
     self._own_pose = apbrg.Geodometry()
     self._blues = dict()
     self._reds = dict()
     self._shot = set()
     self._safe_waypoint = np.array([0, 0, 0])
     self._action = ["None", 0]
     self._name = 'EvadeOrAttack'
     self._fov_width_radians = math.radians(enums.HFOV_DEF)
     self._bboxes = enums.get_battleboxes()      # added 4/22/17 for live-fly