本文整理汇总了Python中drive.Drive.stop方法的典型用法代码示例。如果您正苦于以下问题:Python Drive.stop方法的具体用法?Python Drive.stop怎么用?Python Drive.stop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类drive.Drive
的用法示例。
在下文中一共展示了Drive.stop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MyRobot
# 需要导入模块: from drive import Drive [as 别名]
# 或者: from drive.Drive import stop [as 别名]
class MyRobot(wpilib.SimpleRobot):
def __init__(self):
super().__init__()
self.loader = Loader()
self.shooter = Shooter()
self.drive = Drive(config.robotDrive, config.leftJoy, config.hsButton,
config.alignButton)
self.componets = [ self.loader, self.shooter, self.drive ]
def RobotInit(self):
wpilib.Wait(0.25)
shooterEncoder.Start()
def Disabled(self):
while wpilib.IsDisabled():
CheckRestart()
wpilib.Wait(0.01)
def Autonomous(self):
while wpilib.IsAutonomous() and wpilib.IsEnabled():
CheckRestart()
wpilib.Wait(0.01)
def OperatorControl(self):
dog = self.GetWatchdog()
dog.SetEnabled(True)
dog.SetExpiration(0.25)
self.drive.stop()
shooterMotor.Set(0)
tipperMotor.Set(0)
rollerMotor.Set(0)
while self.IsOperatorControl() and self.IsEnabled():
dog.Feed()
CheckRestart()
for componet in self.componets:
componet.tick()
#Teleop Code
#if not self.drive.aligning :
# self.drive.arcadeDrive(leftJoy.GetRawButton(halfSpeed))
shooterMotor.Set(rightJoy.GetY())
## Alignment
#if leftJoy.GetRawButton(allignButton) :
# if not self.drive.aligning:
# self.drive.aligning = True
# robotDrive.StopMotor()
# self.drive.align()
#else:
# self.drive.aligning = False
## Tipper Up and Down
if rightJoy.GetRawButton(tipperUp):
tipperMotor.Set(-1)
elif rightJoy.GetRawButton(tipperDown):
tipperMotor.Set(1)
else:
tipperMotor.Set(0)
## Roller Up and Down
if rightJoy.GetRawButton(rollerUpButton):
rollerMotor.Set(-1)
elif rightJoy.GetRawButton(rollerDownButton):
rollerMotor.Set(1)
else:
rollerMotor.Set(0)
## Loading
if rightJoy.GetRawButton(feederButton):
self.loader.load()
## Shooting
if rightJoy.GetRawButton(latchButton):
self.shooter.unlatch()
## Debug & Tuning
wpilib.Wait(0.01)