Example #1
0
  def run(self, immediate=False):
    #try:
      # load the file again in case it has changed since the cuesheet was loading
      self.load()

      timestep = .05
      printPeriodPeriod = .25
      printPeriodTimestepCount = printPeriodPeriod / timestep

      # Light Arms - may be absent
      # TODO fade light arms!
      try:
        if self.armData: Arms.load(self.armData)
      except:
        pass

      # DMX
      if self.targetDMX:
        target = self.targetDMX
        current = DMX.get()
        vel = [0] * len(current)

        # calculate delta for each timestep
        # -1 means don't change
        for i in range(len(target)):
          if target[i] >= 0:
            vel[i] = (target[i] - current[i]) * (timestep / self.period)

        print('                 fading for', self.period, 'seconds..', end='', flush=True)
        startTime = time.time()
        endTime = startTime + self.period
        nextTime = startTime + timestep
        nextPrintTime = startTime + printPeriodPeriod

        while 1:
          # calculate new channel values and transmit
          for i in range(len(current)): current[i] += vel[i]
          channels = [round(x) for x in current] 
          DMX.setAndSend(0, channels)

          now = time.time()

          # print a period every so often
          if now >= nextPrintTime:
            print('.', end='', flush=True)
            nextPrintTime += printPeriodPeriod

          if now > endTime: break
          nexTime += timestep
          time.sleep(nextTime - time.time())

        # make sure we arrive at the target numbers, as rounding error may creep in
        DMX.setAndSend(0, target)
        print('DONE')
Example #2
0
  def run(self, immediate=False):
      # load the file again in case it has changed since the cuesheet was loading
      self.load()

      if self.targetDMX:
        DMX.setAndSend(0, self.targetDMX)

      # Light Arms - may be absent
      try:
        if self.armData: Arms.load(self.armData)
      except:
        pass
Example #3
0
  def run(self, immediate=False):
      # load the file again in case it has changed since the cuesheet was loading
      self.load()

      if self.targetDMX:
        DMX.setAndSend(0, self.targetDMX)

      if self.limbs: #TODO figure out if we have a pose or an animation
        Prinboo.limbs.setAngle(self.limbs)

      if self.armData:
        Arms.load(self.armData)
Example #4
0
 def finish(self):
   # make sure we arrive at the target numbers, as rounding error may creep in
   Arms.load(self.armData)