Пример #1
0
    def _run(self):
        """Provides the service routine for the DS polling thread."""
        safetyCounter = 0

        while self.threadKeepAlive:
            hal.waitForDSData()
            self._getData()

            if self.isDisabled():
                safetyCounter = 0

            safetyCounter += 1
            if safetyCounter >= 4:
                MotorSafety.checkMotors()
                safetyCounter = 0

            if self.userInDisabled:
                hal.observeUserProgramDisabled()

            if self.userInAutonomous:
                hal.observeUserProgramAutonomous()

            if self.userInTeleop:
                hal.observeUserProgramTeleop()

            if self.userInTest:
                hal.observeUserProgramTest()
 def _run(self):
     """Provides the service routine for the DS polling thread."""
     safetyCounter = 0
     
     while self.threadKeepAlive:
         hal.waitForDSData()
         self._getData()
         
         with self.dataCond:
             self.waitForDataPredicate = True
             self.dataCond.notify_all()
         
         #with self.mutex: # dataCond already holds the mutex
             self.newControlData = True
         
         safetyCounter += 1
         if safetyCounter >= 4:
             MotorSafety.checkMotors()
             safetyCounter = 0
             
         if self.userInDisabled:
             hal.observeUserProgramDisabled()
             
         if self.userInAutonomous:
             hal.observeUserProgramAutonomous()
             
         if self.userInTeleop:
             hal.observeUserProgramTeleop()
             
         if self.userInTest:
             hal.observeUserProgramTest()
Пример #3
0
    def _run(self):
        """Provides the service routine for the DS polling thread."""
        safetyCounter = 0

        while self.threadKeepAlive:
            hal.waitForDSData()
            self._getData()

            with self.dataCond:
                self.waitForDataPredicate = True
                self.dataCond.notify_all()

                #with self.mutex: # dataCond already holds the mutex
                self.newControlData = True

            safetyCounter += 1
            if safetyCounter >= 4:
                MotorSafety.checkMotors()
                safetyCounter = 0

            if self.userInDisabled:
                hal.observeUserProgramDisabled()

            if self.userInAutonomous:
                hal.observeUserProgramAutonomous()

            if self.userInTeleop:
                hal.observeUserProgramTeleop()

            if self.userInTest:
                hal.observeUserProgramTest()
Пример #4
0
    def _run(self) -> None:
        """Provides the service routine for the DS polling thread."""
        safetyCounter = 0

        while self.threadKeepAlive:
            hal.waitForDSData()
            self._getData()

            if self.isDisabled():
                safetyCounter = 0

            safetyCounter += 1
            if safetyCounter >= 4:
                MotorSafety.checkMotors()
                safetyCounter = 0

            if self.userInDisabled:
                hal.observeUserProgramDisabled()

            if self.userInAutonomous:
                hal.observeUserProgramAutonomous()

            if self.userInTeleop:
                hal.observeUserProgramTeleop()

            if self.userInTest:
                hal.observeUserProgramTest()