def getLocation(self) -> int:
        """Gets the location of the team's driver station controls.

        :returns: The location of the team's driver station controls:
            1, 2, or 3
        """
        allianceStationID = hal.getAllianceStation()
        return self._station_numbers.get(allianceStationID, 0)
    def getLocation(self) -> int:
        """Gets the location of the team's driver station controls.

        :returns: The location of the team's driver station controls:
            1, 2, or 3
        """
        allianceStationID = hal.getAllianceStation()
        return self._station_numbers.get(allianceStationID, 0)
    def getAlliance(self) -> Alliance:
        """Get the current alliance from the FMS.

        :returns: The current alliance
        """
        allianceStationID = hal.getAllianceStation()
        hAid = hal.AllianceStationID

        if allianceStationID in (hAid.kRed1, hAid.kRed2, hAid.kRed3):
            return self.Alliance.Red
        elif allianceStationID in (hAid.kBlue1, hAid.kBlue2, hAid.kBlue3):
            return self.Alliance.Blue
        else:
            return self.Alliance.Invalid
    def getAlliance(self) -> Alliance:
        """Get the current alliance from the FMS.

        :returns: The current alliance
        """
        allianceStationID = hal.getAllianceStation()
        hAid = hal.AllianceStationID

        if allianceStationID in (hAid.kRed1, hAid.kRed2, hAid.kRed3):
            return self.Alliance.Red
        elif allianceStationID in (hAid.kBlue1, hAid.kBlue2, hAid.kBlue3):
            return self.Alliance.Blue
        else:
            return self.Alliance.Invalid
Beispiel #5
0
    def getLocation(self) -> int:
        """Gets the location of the team's driver station controls.

        :returns: The location of the team's driver station controls:
            1, 2, or 3
        """
        allianceStationID = hal.getAllianceStation()
        hAid = hal.AllianceStationID

        if allianceStationID in (hAid.kRed1, hAid.kBlue1):
            return 1
        elif allianceStationID in (hAid.kRed2, hAid.kBlue2):
            return 2
        elif allianceStationID in (hAid.kRed3, hAid.kBlue3):
            return 3
        else:
            return 0
    def getLocation(self):
        """Gets the location of the team's driver station controls.

        :returns: The location of the team's driver station controls:
            1, 2, or 3
        """
        allianceStationID = hal.getAllianceStation()
        hAid = hal.AllianceStationID
        
        if allianceStationID in (hAid.kRed1, hAid.kBlue1):
            return 1
        elif allianceStationID in (hAid.kRed2, hAid.kBlue2):
            return 2
        elif allianceStationID in (hAid.kRed3, hAid.kBlue3):
            return 3
        else:
            return 0
Beispiel #7
0
    def _sendMatchData(self):
        alliance = hal.getAllianceStation()
        hAid = hal.AllianceStationID
        isRedAlliance = alliance in {hAid.kRed1, hAid.kRed2, hAid.kRed3}
        stationNumber = self._station_numbers.get(alliance, 0)

        with self.cacheDataMutex:
            eventName = self.matchInfo.eventName.decode('utf-8')
            gameSpecificMessage = self.matchInfo.gameSpecificMessage.decode(
                'utf-8')
            matchNumber = self.matchInfo.matchNumber
            replayNumber = self.matchInfo.replayNumber
            matchType = self.matchInfo.matchType

        self.matchDataSender.alliance.setBoolean(isRedAlliance)
        self.matchDataSender.station.setDouble(stationNumber)
        self.matchDataSender.eventName.setString(eventName)
        self.matchDataSender.gameSpecificMessage.setString(gameSpecificMessage)
        self.matchDataSender.matchNumber.setDouble(matchNumber)
        self.matchDataSender.replayNumber.setDouble(replayNumber)
        self.matchDataSender.matchType.setDouble(matchType)
Beispiel #8
0
    def _sendMatchData(self) -> None:
        alliance = hal.getAllianceStation()
        isRedAlliance = alliance in self._red_alliance_ids
        stationNumber = self._station_numbers.get(alliance, 0)

        with self.cacheDataMutex:
            eventName = self.matchInfo.eventName
            gameSpecificMessage = self.matchInfo.gameSpecificMessage
            matchNumber = self.matchInfo.matchNumber
            replayNumber = self.matchInfo.replayNumber
            matchType = self.matchInfo.matchType

        self.matchDataSender.alliance.setBoolean(isRedAlliance)
        self.matchDataSender.station.setDouble(stationNumber)
        self.matchDataSender.eventName.setString(eventName)
        self.matchDataSender.gameSpecificMessage.setString(gameSpecificMessage)
        self.matchDataSender.matchNumber.setDouble(matchNumber)
        self.matchDataSender.replayNumber.setDouble(replayNumber)
        self.matchDataSender.matchType.setDouble(matchType)

        with self.controlWordMutex:
            bits = self.controlWordCache.bits

        self.matchDataSender.controlWord.setDouble(bits)
    def _sendMatchData(self) -> None:
        alliance = hal.getAllianceStation()
        isRedAlliance = alliance in self._red_alliance_ids
        stationNumber = self._station_numbers.get(alliance, 0)

        with self.cacheDataMutex:
            eventName = self.matchInfo.eventName
            gameSpecificMessage = self.matchInfo.gameSpecificMessage
            matchNumber = self.matchInfo.matchNumber
            replayNumber = self.matchInfo.replayNumber
            matchType = self.matchInfo.matchType

        self.matchDataSender.alliance.setBoolean(isRedAlliance)
        self.matchDataSender.station.setDouble(stationNumber)
        self.matchDataSender.eventName.setString(eventName)
        self.matchDataSender.gameSpecificMessage.setString(gameSpecificMessage)
        self.matchDataSender.matchNumber.setDouble(matchNumber)
        self.matchDataSender.replayNumber.setDouble(replayNumber)
        self.matchDataSender.matchType.setDouble(matchType)

        with self.controlWordMutex:
            bits = self.controlWordCache.bits

        self.matchDataSender.controlWord.setDouble(bits)