def publish_state(self): state = DrinksStatus() for n in range(0,8): state.status.append((self.digital_state >> n) & 1) state.status = map(lambda x: not (x[0] ^ x[1]), zip(MASK,state.status)) reorder = map(lambda x: state.status[x], REORDER) state.status = reorder self._drinks_pub.publish(state)
def publish_state(self): state = DrinksStatus() for n in range(0, 8): state.status.append((self.digital_state >> n) & 1) state.status = map(lambda x: not (x[0] ^ x[1]), zip(MASK, state.status)) reorder = map(lambda x: state.status[x], REORDER) state.status = reorder self._drinks_pub.publish(state)
def request_digital(self, req): self._requested_digital=True self._serial.write("!R") while (self._requested_digital): rospy.sleep(0.1) state = DrinksStatus() for n in range(0,8): state.status.append((self.digital_state >> n) & 1) state.status = map(lambda x: not (x[0] ^ x[1]), zip(MASK,state.status)) state.status = map(lambda x: state.status[x], REORDER) resp = RequestDrinksStatusResponse(state) return resp
def request_digital(self, req): self._requested_digital = True self._serial.write("!R") while (self._requested_digital): rospy.sleep(0.1) state = DrinksStatus() for n in range(0, 8): state.status.append((self.digital_state >> n) & 1) state.status = map(lambda x: not (x[0] ^ x[1]), zip(MASK, state.status)) state.status = map(lambda x: state.status[x], REORDER) resp = RequestDrinksStatusResponse(state) return resp