本文整理汇总了Python中control.Control.loop方法的典型用法代码示例。如果您正苦于以下问题:Python Control.loop方法的具体用法?Python Control.loop怎么用?Python Control.loop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类control.Control
的用法示例。
在下文中一共展示了Control.loop方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from control import Control [as 别名]
# 或者: from control.Control import loop [as 别名]
def main():
try:
joystick = init_pygame()
except Exception:
print "Pygame initialization failed - it MIGHT require (for unknown reasons) root"
print "You can try with root, but that won't be safer"
print
raise
control = Control(joystick)
try:
control.loop()
except Exception:
import traceback as tb
print "GOT EXCEPTION"
tb.print_exc()
raise
示例2: main
# 需要导入模块: from control import Control [as 别名]
# 或者: from control.Control import loop [as 别名]
def main():
try:
joystick = init_pygame()
except Exception:
print "Pygame initialization failed - it MIGHT require (for unknown reasons) root"
print "You can try with root, but that won't be safer"
print
raise
pi = pigpio.pi()
pump = Pump(pi, pin=config.PIN_PUMP)
pump.off()
robot = Robot(pi, config.PIN_SERVO1, config.PIN_SERVO2, config.PIN_SERVO3)
robot.disable()
control = Control(joystick, pump, robot)
try:
control.loop()
finally:
pump.off()