def __init__(self, dmx_addr): """Create a new wrapper for the Venus.""" self.dmx_addr = dmx_addr - 1 self.base_rotation = RampingParameter() self.cradle_motion = RampingParameter() self.head_rotation = RampingParameter() self.color_rotation = RampingParameter() self.lamp_on = False
class Venus(object): def __init__(self, dmx_addr): """Create a new wrapper for the Venus.""" self.dmx_addr = dmx_addr - 1 self.base_rotation = RampingParameter() self.cradle_motion = RampingParameter() self.head_rotation = RampingParameter() self.color_rotation = RampingParameter() self.lamp_on = False def update(self, timestep): self.base_rotation.update(timestep) self.cradle_motion.update(timestep) self.head_rotation.update(timestep) self.color_rotation.update(timestep) def render(self, dmx_univ): """Render the Venus into a DMX universe.""" dmx_addr = self.dmx_addr base_dir, base_val = bipolar_to_dir_and_val(self.base_rotation.current) cradle_val = unit_float_to_range(0, 255, self.cradle_motion.current) head_dir, head_val = bipolar_to_dir_and_val(self.head_rotation.current) # limit color wheel speed to 50% for the time being col_dir, col_val = bipolar_to_dir_and_val( 0.5 * self.color_rotation.current) lamp_val = 255 if self.lamp_on else 0 vals = ( base_dir, base_val, cradle_val, head_dir, head_val, col_dir, col_val, lamp_val) #logging.debug("{}".format(vals)) for offset, val in enumerate(vals): dmx_univ[dmx_addr+offset] = val
def __init__(self, dmx_addr): self.dmx_addr = dmx_addr - 1 # unipolar self.lamp_1_intensity = 0.0 self.lamp_2_intensity = 0.0 # bipolar self.ball_rotation = RampingParameter() self.ball_start = False # unipolar self.color_rotation = 0.0 self.color_start = False self.strobe_1_state = False self.strobe_2_state = False # unipolar self.strobe_1_intensity = 0.0 self.strobe_2_intensity = 0.0 self.strobe_1_rate = 0.0 self.strobe_2_rate = 0.0
class Venus(object): def __init__(self, dmx_addr): """Create a new wrapper for the Venus.""" self.dmx_addr = dmx_addr - 1 self.base_rotation = RampingParameter() self.cradle_motion = RampingParameter() self.head_rotation = RampingParameter() self.color_rotation = RampingParameter() self.lamp_on = False def update(self, timestep): self.base_rotation.update(timestep) self.cradle_motion.update(timestep) self.head_rotation.update(timestep) self.color_rotation.update(timestep) def render(self, dmx_univ): """Render the Venus into a DMX universe.""" dmx_addr = self.dmx_addr base_dir, base_val = bipolar_to_dir_and_val(self.base_rotation.current) cradle_val = unit_float_to_range(0, 255, self.cradle_motion.current) head_dir, head_val = bipolar_to_dir_and_val(self.head_rotation.current) # limit color wheel speed to 50% for the time being col_dir, col_val = bipolar_to_dir_and_val(0.5 * self.color_rotation.current) lamp_val = 255 if self.lamp_on else 0 vals = (base_dir, base_val, cradle_val, head_dir, head_val, col_dir, col_val, lamp_val) #logging.debug("{}".format(vals)) for offset, val in enumerate(vals): dmx_univ[dmx_addr + offset] = val
class Lumasphere (object): """Control abstraction for the lumapshere. lumasphere DMX profile: 1: outer ball rotation speed note: requires a value of ~17% in order to be activated (ball start button) 2: outer ball rotation direction split halfway 3: color wheel rotation (might want to implement bump start) 4: strobe 1 intensity 5: strobe 1 rate 6: strobe 2 intensity 7: strobe 2 rate There are also two lamp dimmer channels, which are conventionally set to be the two channels after the lumasphere's built-in controller: 8: lamp 1 dimmer 9: lamp 2 dimmer """ def __init__(self, dmx_addr): self.dmx_addr = dmx_addr - 1 # unipolar self.lamp_1_intensity = 0.0 self.lamp_2_intensity = 0.0 # bipolar self.ball_rotation = RampingParameter() self.ball_start = False # unipolar self.color_rotation = 0.0 self.color_start = False self.strobe_1_state = False self.strobe_2_state = False # unipolar self.strobe_1_intensity = 0.0 self.strobe_2_intensity = 0.0 self.strobe_1_rate = 0.0 self.strobe_2_rate = 0.0 def update(self, timestep): self.ball_rotation.update(timestep) def _render_ball_rotation(self): val = self.ball_rotation.current speed = abs(val) direction = val >= 0.0 if self.ball_start and speed < 0.2: speed = 0.2 dmx_speed = unit_float_to_range(0, MAX_ROTATION_SPEED, speed) dmx_direction = 0 if direction else 255 return dmx_speed, dmx_direction def _render_color_rotation(self): if self.color_start and self.color_rotation < 0.2: speed = 0.2 else: speed = self.color_rotation return unit_float_to_range(0, 255, speed) def render(self, dmx_univ): """Render this Comet into a DMX universe.""" start = self.dmx_addr # render the shutter value dmx_univ[start:start+2] = self._render_ball_rotation() dmx_univ[start+2] = self._render_color_rotation() dmx_univ[start+3:start+5] = _render_strobe( self.strobe_1_state, self.strobe_1_intensity, self.strobe_1_rate) dmx_univ[start+5:start+7] = _render_strobe( self.strobe_2_state, self.strobe_2_intensity, self.strobe_2_rate) dmx_univ[start+7] = unit_float_to_range(0, 255, self.lamp_1_intensity) dmx_univ[start+8] = unit_float_to_range(0, 255, self.lamp_2_intensity) log.info(dmx_univ[start:start+9])
class Lumasphere (object): """Control abstraction for the lumapshere. lumasphere DMX profile: 1: outer ball rotation speed note: requires a value of ~17% in order to be activated (ball start button) 2: outer ball rotation direction split halfway 3: color wheel rotation (might want to implement bump start) 4: strobe 1 intensity 5: strobe 1 rate 6: strobe 2 intensity 7: strobe 2 rate There are also two lamp dimmer channels, which are conventionally set to be the two channels after the lumasphere's built-in controller: 8: lamp 1 dimmer 9: lamp 2 dimmer """ def __init__(self, dmx_addr): self.dmx_addr = dmx_addr - 1 # unipolar self.lamp_1_intensity = 0.0 self.lamp_2_intensity = 0.0 # bipolar self.ball_rotation = RampingParameter() self.ball_start = False # unipolar self.color_rotation = 0.0 self.color_start = False self.strobe_1_state = False self.strobe_2_state = False # unipolar self.strobe_1_intensity = 0.0 self.strobe_2_intensity = 0.0 self.strobe_1_rate = 0.0 self.strobe_2_rate = 0.0 def update(self, timestep): self.ball_rotation.update(timestep) def _render_ball_rotation(self): val = self.ball_rotation.current speed = abs(val) direction = val >= 0.0 if self.ball_start and speed < 0.2: speed = 0.2 dmx_speed = unit_float_to_range(0, 255, speed) dmx_direction = 0 if direction else 255 return dmx_speed, dmx_direction def _render_color_rotation(self): if self.color_start and self.color_rotation < 0.2: speed = 0.2 else: speed = self.color_rotation return unit_float_to_range(0, 255, speed) def render(self, dmx_univ): """Render this Comet into a DMX universe.""" start = self.dmx_addr # render the shutter value dmx_univ[start:start+2] = self._render_ball_rotation() dmx_univ[start+2] = self._render_color_rotation() dmx_univ[start+3:start+5] = _render_strobe( self.strobe_1_state, self.strobe_1_intensity, self.strobe_1_rate) dmx_univ[start+5:start+7] = _render_strobe( self.strobe_2_state, self.strobe_2_intensity, self.strobe_2_rate) dmx_univ[start+7] = unit_float_to_range(0, 255, self.lamp_1_intensity) dmx_univ[start+8] = unit_float_to_range(0, 255, self.lamp_2_intensity) log.info(dmx_univ[start:start+9])