def switchLEDs(self, numLEDs): lights = HeadLightState() numLEDs = int(numLEDs) lights.HeadLightInterval = 0 lights.LEDState0 = 1 if numLEDs > 0 else 0 lights.LEDState1 = 1 if numLEDs > 1 else 0 lights.LEDState2 = 1 if numLEDs > 2 else 0 lights.LEDState3 = 1 if numLEDs > 3 else 0 lights.LEDState4 = 1 if numLEDs > 3 else 0 lights.LEDState5 = 1 if numLEDs > 2 else 0 lights.LEDState6 = 1 if numLEDs > 1 else 0 lights.LEDState7 = 1 if numLEDs > 0 else 0 lights.LEDPhase0 = 1 lights.LEDPhase1 = 1 lights.LEDPhase2 = 1 lights.LEDPhase3 = 1 lights.LEDPhase4 = 1 lights.LEDPhase5 = 1 lights.LEDPhase6 = 1 lights.LEDPhase7 = 1 lights.LEDAmplitude0 = 1.0 lights.LEDAmplitude1 = 1.0 lights.LEDAmplitude2 = 1.0 lights.LEDAmplitude3 = 1.0 lights.LEDAmplitude4 = 1.0 lights.LEDAmplitude5 = 1.0 lights.LEDAmplitude6 = 1.0 lights.LEDAmplitude7 = 1.0 if not rospy.is_shutdown(): if self.last + self.rate < rospy.get_time(): self.pub.publish(lights) self.last = rospy.get_time()
def spinningLEDs(self): lights = HeadLightState() lights.HeadLightInterval = 80 lights.LEDState0 = 3 lights.LEDState1 = 3 lights.LEDState2 = 3 lights.LEDState3 = 3 lights.LEDState4 = 3 lights.LEDState5 = 3 lights.LEDState6 = 3 lights.LEDState7 = 3 lights.LEDPhase0 = 10 lights.LEDPhase1 = 20 lights.LEDPhase2 = 30 lights.LEDPhase3 = 40 lights.LEDPhase4 = 50 lights.LEDPhase5 = 60 lights.LEDPhase6 = 70 lights.LEDPhase7 = 80 lights.LEDAmplitude0 = 1.0 lights.LEDAmplitude1 = 1.0 lights.LEDAmplitude2 = 1.0 lights.LEDAmplitude3 = 1.0 lights.LEDAmplitude4 = 1.0 lights.LEDAmplitude5 = 1.0 lights.LEDAmplitude6 = 1.0 lights.LEDAmplitude7 = 1.0 if not rospy.is_shutdown(): self.pub.publish(lights)