def __init__(self, medium_motor=OUTPUT_A, left_motor=OUTPUT_C, right_motor=OUTPUT_B): WebControlledTank.__init__(self, left_motor, right_motor) self.medium_motor = MediumMotor(medium_motor) if not self.medium_motor.connected: log.error("%s is not connected" % self.medium_motor) sys.exit(1) self.medium_motor.reset()
def __init__(self): self.shutdown = False self.flipper = LargeMotor(OUTPUT_A) self.turntable = LargeMotor(OUTPUT_B) self.colorarm = MediumMotor(OUTPUT_C) self.color_sensor = ColorSensor() self.color_sensor.mode = self.color_sensor.MODE_RGB_RAW self.infrared_sensor = InfraredSensor() self.cube = {} self.init_motors() self.state = ['U', 'D', 'F', 'L', 'B', 'R'] self.rgb_solver = None signal.signal(signal.SIGTERM, self.signal_term_handler) signal.signal(signal.SIGINT, self.signal_int_handler)
def __init__(self, medium_motor, left_motor, right_motor, speed_sp=400, channel=1): RemoteControlledTank.__init__(self, left_motor, right_motor, speed_sp=speed_sp, channel=channel) self.medium_motor = MediumMotor(medium_motor) if not self.medium_motor.connected: log.error("%s is not connected" % self.medium_motor) sys.exit(1) self.medium_motor.reset()
To enable the medium motor toggle the beacon button on the EV3 remote. """ def __init__(self, left_motor, right_motor, speed_sp=400, channel=1): RemoteControlledTank.__init__(self, left_motor, right_motor, speed_sp=speed_sp, channel=channel) # assuming we start with both pens up pen_shifts = [-30, +30, +30, -30] pen_state = len(pen_shifts) - 1 # the last pen state # from the even position, -30 is left pen down and +30 is right pen down medmotor = MediumMotor(OUTPUT_A) medmotor.reset() # set motor position to 0 class TRACK3RWithPen(TRACK3R): def __init__(self, medium_motor, left_motor=OUTPUT_B, right_motor=OUTPUT_C, speed_sp=400, channel=1): TRACK3R.__init__(self, left_motor, right_motor, speed_sp=speed_sp, channel=channel)