Exemplo n.º 1
0
 def __init__(self,
              medium_motor=OUTPUT_A,
              left_motor=OUTPUT_C,
              right_motor=OUTPUT_B):
     RemoteControlledTank.__init__(self, left_motor, right_motor)
     self.medium_motor = MediumMotor(medium_motor)
     self.medium_motor.reset()
Exemplo n.º 2
0
    def __init__(self, medium_motor, left_motor, right_motor):
        RemoteControlledTank.__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()
Exemplo n.º 3
0
    def __init__(self, left_motor_port=OUTPUT_B, right_motor_port=OUTPUT_C, medium_motor_port=OUTPUT_A):
        RemoteControlledTank.__init__(self, left_motor_port, right_motor_port)
        self.set_polarity(MediumMotor.POLARITY_NORMAL)
        self.medium_motor = MediumMotor(medium_motor_port)
        self.ts = TouchSensor()
        self.mts = MonitorTouchSensor(self)
        self.mrc = MonitorRemoteControl(self)
        self.shutdown_event = Event()

        # Register our signal_term_handler() to be called if the user sends
        # a 'kill' to this process or does a Ctrl-C from the command line
        signal.signal(signal.SIGTERM, self.signal_term_handler)
        signal.signal(signal.SIGINT, self.signal_int_handler)

        self.claw_open(True)
        self.remote.on_channel4_top_left = self.claw_close
        self.remote.on_channel4_bottom_left = self.claw_open
Exemplo n.º 4
0
#!/usr/bin/env python3

from ev3dev2.sound import Sound
from ev3dev2.control.rc_tank import RemoteControlledTank


sound = Sound()
sound.beep()

tank = RemoteControlledTank('outB', 'outC')
tank.on_for_seconds(50, 50, 0.2)
tank.main()
Exemplo n.º 5
0
#!/usr/bin/env micropython

# *** BUG as of 2020: happens in MICROPYTHON only (fine in Python3) ***
# ERROR:ev3dev2.control.rc_tank:'InfraredSensor' object has no attribute '_state'
# Traceback (most recent call last):
#   File "ev3dev2/control/rc_tank.py", line 40, in main
#   File "ev3dev2/sensor/lego.py", line 959, in process
# AttributeError: 'InfraredSensor' object has no attribute '_state'

from ev3dev2.motor import Motor, OUTPUT_B, OUTPUT_C
from ev3dev2.control.rc_tank import RemoteControlledTank

RC_TANK = RemoteControlledTank(left_motor_port=OUTPUT_B,
                               right_motor_port=OUTPUT_C,
                               polarity=Motor.POLARITY_NORMAL,
                               speed=1000,
                               channel=1)

RC_TANK.main()