示例#1
0
 def test_medium_motor(self):
     get_input('Attach a MediumMotor then continue')
     d = MediumMotor()
     print(d.type)
     d.run_forever(100, regulation_mode=False)
     print(d.run)
     time.sleep(5)
     d.stop()
示例#2
0
 def test_medium_motor(self):
     get_input('Attach a MediumMotor then continue')
     d = MediumMotor()
     print(d.driver_name)
     d.run_forever(100, speed_regulation=False)
     print(d.state)
     time.sleep(5)
     d.stop()
 def test_medium_motor(self):
     get_input('Attach a MediumMotor then continue')
     d = MediumMotor()
     print(d.driver_name)
     d.run_forever(100, speed_regulation=False)
     print(d.state)
     time.sleep(5)
     d.stop()
 def test_medium_motor(self):
     get_input('Attach a MediumMotor then continue')
     d = MediumMotor()
     print(d.type)
     d.run_forever(100, regulation_mode=False)
     print(d.run)
     time.sleep(5)
     d.stop()
    def test_medium_motor(self):
        get_input('Attach a MediumMotor then continue')
        d = MediumMotor()
        print(d.type)
        #d.run_forever(25, regulation_mode=False)
	d.run_time_limited(time_sp=5000, speed_sp=25, regulation_mode=False,
                           stop_mode=Motor.STOP_MODE.COAST, ramp_up_sp=100, ramp_down_sp=100)
        print(d.run)
        time.sleep(5)
        d.stop()
示例#6
0
文件: test.py 项目: bfic/BeerBot
class Arm():
  """ Class Arm represents build from LEGO Mindstorms arm for catching and moving cans of beer """

  def __init__(self, port='A', speed=100, **kwargs):
    self.port = port
    self.speed = speed
    self.test_direction = 1
    self.motor = MediumMotor(port=self.port)
    self.motor.reset()
    self.task_state = None

  @revert_task_state_to_none_after_call
  def get(self):
    self.task_state = GETTING
    self.speed = 100
    self.motor.run_forever(self.speed, regulation_mode=False)

  @revert_task_state_to_none_after_call
  def put(self):
    self.task_state = PUTTING
    self.speed = -50
    self.motor.run_forever(self.speed, regulation_mode=False)

  @revert_task_state_to_none_after_call
  def stop(self):
    self.task_state = STOPPING
    self.motor.stop()

  def test(self):
    while True:
      if self.test_direction == -1:
        self.put()
      else:
        self.get()
      self.test_direction *= -1
      raw_input("Press enter")
    self.motor.stop()